C.1 Moons

Updated a month ago

Code Setup

  • TBD

Editor Setup

DISCLAIMER
This page assumes you have already set up Unity and completed the following two pages:

If you have not completed those steps, please do so before continuing.


Creating Your Moon Definition

  1. In your Unity Project window, create a new folder for your moon.

    • Example: PathToContentContainer/Content/Moons/MyMoon.
  2. Inside that folder, create another folder named Registry.

    • Example: PathToContentContainer/Content/Moons/MyMoon/Registry.
  3. Inside the Registry folder, right-click and select:
    Create → DawnLib → Definitions → Dusk Moon Definition.

  4. Make sure you have the following ready before proceeding:

    • A SelectableLevel ScriptableObject with all necessary vanilla blank references configured.
    • A valid Unity Scene properly set up for your moon.

Configuring the DuskMoonDefinition

Once you’ve created the DuskMoonDefinition, you’ll see several fields that need to be filled in.

Required Fields

Field Description
Config Entries Place you can create various Config Entries in.
Namespace A unique identifier prefix for your mod or content. Example: code_rebirth.
Key Becomes autofilled in by reading the planet name in your SelectableLevel.
SelectableLevel Assign your existing SelectableLevel ScriptableObject here.
Pricing Strategy (optional) Defines custom pricing logic for your moon that supercedes the cost field.
Terminal Predicate (optional) Allows conditional logic for when the moon should appear in the terminal.
Cost Cost of the moon, overriden by Pricing Strategy if created.
OutsideEnemiesSpawnProbabilityRange Range of outside enemies that spawn each cycle, vanilla has it hardcoded to 3 by default.
GenerateEnemyPowerCountConfigs Creates a config to edit the power count of inside, outside and daytime enemies.
GenerateEnemySpawnCurveConfigs Creates a config to edit the animation curves for enemy spawn weights.
GenerateEnemySpawnProbabilityRangeConfigs Creates a config to edit the random range of enemies that spawn for each cycle for inside outside and daytime enemies.
GenerateMinMaxScrapConfig Creates a config to edit the min and max scrap amounts of a moon.
GenerateTimeConfig Creates a config to edit the time speed multiplier of the moon.
GenerateCostConfig Creates a config to edit the cost of the moon.
GenerateDisablePredicateConfig Creates a config to get rid of the Terminal Predicate affecting the moon.
GenerateDisablePricingStrategyConfig Creates a config to get rid of the pricing strategy and rely purely on cost.

Setting Up Scene Data

The SceneDatas list determines which scenes are linked to this moon.
You must add at least one entry to this list.

For each SceneData entry:

  1. Drag your scene asset into the Scene Reference field.
  2. Set a Namespace for that scene (Key is auto-filled in).
    • Example: code_rebirth.
  3. Configure the following optional parameters if needed:
    • Landing Override – Custom scene used when the player lands.
    • Leaving Override – Custom scene used when leaving the moon.
    • Base Weight – Controls how often the scene appears relative to others.
    • Weather Weights – Adjusts scene selection based on weather conditions (e.g., eclipsed, rainy, stormy).

Organizing and Bundling

After your scenes and definitions are configured:

  1. Put your Scene asset into its own AssetBundle.

    • Example: oxydescene1.
  2. Put your DuskMoonDefinition (and any related assets) into a separate AssetBundle.

    • Example: oxydemoondefinition.
  3. Add ONLY the moon definition's AssetBundle to the list of AssetBundles in your ContentContainer
    (created during the Unity Setup stage).

Once that’s done, your content is registered!


Final Notes

Remember:
You can always contact @xuxiaolan on Discord for support, either through the Lethal Modding server or via direct messages, if you run into issues or have questions.