A modding framework for Kitten Space Agency that allows mods to easily add menu entries.
To see ModMenu in action, it is recommended to install ModMenu.ExampleMod and put that mod in your KSA Content folder.
For developers it is also recommended to see how ModMenu.ExampleMod uses the ModMenu.
There are two ways to use ModMenu, the first way is a looser method, more dependent on the Mod creator and gives the general user more flexibility. The second is a stricter method that is more dependent on the user and gives the Mod creater less to worry about.
- Use the ModMenu.Attributes NuGet Package and the
[ModMenuEnty()]attribute as shown below. - Declare ModMenu a non-optional dependency under a
[StarMap]tag in your mod.toml. Instructions here.
Add the NuGet package to your mod project in Visual Studio, go to Manage NuGet Packages ->
Search for ModMenu.Attributes.
Once installed add the using ModMenu; to your Mod and add the [ModMenuEntry("Mod Name")]tag , or [ModMenuEntry("Mod Name", nameof(some_boolean)] tag to which ever function you want to be called by ModMenu. If you add any ImGui code in the function, it will be drawn inside a submenu that is labeled with the "Mod Name" you put in the tag. If you include the nameof(some_boolean), ModMenu will automatically set that boolean to true once it has initalized.
using ModMenu;
public class MyMod
{
[ModMenuEntry("My Mod Name")]
public static void DrawMenu()
{
ImGui.Text("Hello World!");
}
}or
using ModMenu;
public class MyMod
{
public static bool _isModMenuActive { get; set; } = false;
[ModMenuEntry("My Mod Name", nameof(_isModMenuActive))]
public static void DrawMenu()
{
ImGui.Text("Hello World!");
}
}The second way will give you a boolean that ModMenu will set to true once ModMenu has activated. This will let you know whether or not the user has ModMenu enabled/installed so you can create your own ImGui window if you need to.
Warning
If you are using the [ModMenuEntry()] attribute, you MUST include the ModMenu.Attributes.dll file in your Mod folder otherwise the mod WILL CRASH on startup. You can download the ModMenu.Attributes.dll in the releases.
Once you have the built files, put your Mod's .dll and the ModMenu.Attributes.dll into your Mod's folder. Then make sure you have ModMenu installed and put in your Documents/My Games/Kitten Space Agency/mods folder and you can launch StarMap and see the Submenu for your mod.
using ModMenu
public class MyMod {
public static void RegisterModMenu() {
ModMenu.AddToModMenu("Mod Name", DrawMenu);
}
public static void DrawMenu() {
ImGui.Text("Hello World!");
}
}The RegisterModMenu() function will add an entry to ModMenu where the submenu will be populated by the DrawMenu() function.
- Download
ModMenu.zipfrom Releases - Extract it to
Documents/My Games/Kitten Space Agency/mods - Add to the
manifest.tomlinDocuments/My Games/Kitten Space Agency/for Windows.
[[mods]]
id = "ModMenu"
enabled = true- Launch the game via StarMap
Any installed mods using ModMenu will automatically appear in the "Mods" menu.
/ModMenu.Attributes/- NuGet package with the[ModMenuEntry]attribute/ModMenu/- Main mod DLL
MIT