Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Celeste.Mod.mm/Mod/Helpers/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ public static void OpenSoundTest() {
OuiModOptions.Instance.Overworld.Goto<OuiSoundTest>();
}
}

[Flags]
private enum WhatToSave {
File = 1 << 0,
Settings = 1 << 1,
All = File | Settings
}

[Command("save", "saves the game")]
public static void Save(string whatToSave = "all") {
if (!string.IsNullOrWhiteSpace(whatToSave) && Enum.TryParse(whatToSave, ignoreCase: true, out WhatToSave what)) {
bool isFile = (what & WhatToSave.File) != 0;
bool isSettings = (what & WhatToSave.Settings) != 0;

// If the user has not entered a file yet, trying to save the file will crash; so avoid that
if (SaveData.Instance is null) isFile = false;

if (isFile || isSettings)
UserIO.SaveHandler(isFile, isSettings);
}
else
Engine.Commands.Log($"Invalid option! Use File, Settings, or All");
}
}


Expand Down