Choose storage from the value’s owner. A cooldown belongs to a live player. A user preference belongs to Remix configuration. A fact about one campaign belongs to campaign save data.
| Value | Owner | Storage |
|---|---|---|
| Current ability cooldown | One live Player | Per-instance state |
| Enable or disable the ability | The mod user | Remix configuration |
| Ability unlocked in one campaign | That campaign | SaveState data through SlugBase |
Read a Remix setting
Bind a setting once on the registered OptionInterface, following Remix settings:
public readonly Configurable<bool> abilityEnabled;
public AbilityOptions()
{
abilityEnabled = config.Bind(
"ability_enabled",
true,
new ConfigurableInfo("Enable the upward boost."));
}The ability handler can then stop when !options.abilityEnabled.Value. The visible Remix Save action copies bound control values into configurables and writes the mod configuration. This value applies as user configuration and is not tied to a campaign slot.
Store a campaign unlock
SlugBase is an optional dependency that adds typed custom data to Rain World’s existing save owners. Import its namespace and begin from an active story session:
using SlugBase.SaveData;
private static bool TryGetAbilityUnlocked(Player player, out bool unlocked)
{
unlocked = false;
RainWorldGame game = player == null || player.room == null
? null : player.room.game;
if (game == null || !game.IsStorySession)
return false;
var data = game.GetStorySession.saveState
.deathPersistentSaveData
.GetSlugBaseData();
unlocked = data.TryGet<bool>(
"my_mod.ability_unlocked",
out bool stored) && stored;
return true;
}
private static void UnlockAbility(Player player)
{
RainWorldGame game = player.room.game;
var data = game.GetStorySession.saveState
.deathPersistentSaveData
.GetSlugBaseData();
data.Set("my_mod.ability_unlocked", true);
}Call UnlockAbility only from a guarded story gameplay event. Prefix the key with a stable mod identifier. Set changes SlugBase’s in-memory dictionary. Rain World’s normal save lifecycle later serializes it. Do not call SaveToString or edit save files to force a write.
DeathPersistentSaveData fits an unlock meant to remain after death or quitting. Use MiscWorldSaveData.GetSlugBaseData() for a world fact that follows ordinary campaign world state. PlayerProgression.MiscProgressionData.GetSlugBaseData() is broader than one campaign and fits only progress intended to be shared there. Campaign save data traces those serializers and owners.
Expected checks
Test the setting by saving it in Remix, restarting, and checking both enabled and disabled behavior. Test campaign progress in a disposable save through shelter save, death, quit, reload, and another campaign slot. Arena paths should skip the campaign lookup. The Remix binding compiled against the recorded baseline. The SlugBase fragment was checked against source commit dac343359d0f6e311de9f89345954f9ad2b25f3e, but it was not compiled because the recorded installation has no SlugBase assembly reference. No save operation or migration was run for this recipe.
Sources
global::OptionInterface.ConfigHolder,global::StoryGameSession.saveState,global::DeathPersistentSaveData,global::MiscWorldSaveData, andglobal::PlayerProgression.MiscProgressionDatain the baseline assembly recorded by Runtime reference.- SlugBase save data extension methods
- SlugBase typed data access