-
Notifications
You must be signed in to change notification settings - Fork 81
Beginners Guide to Modding
Download Visual Studio Here! You will want Visual Studio Community 2019. It's free. Once downloaded install it. Mods require knowledge of C#!
Open Visual Studio. Go to File -> New -> Project.
Mods for Colony Survival are .Net 4.7.2 DLL's. In the new project screen you want to select the following:
you will need to Right click on your project, select Add -> References.
You can find the required DLL's Here:
Once you have the DLL's selected you should see them under the References tree in your project.
In order for the game to see your mod you need 2 things 1 is the modinfo.json, in there you tell the game what DLL to load in.
[
{
"dllpath": "Pandaros.Settlers.dll",
"name": "Pandaros.Settlers",
"namepretty": "Pandaros' Settlers!",
"version": "0.8.2.0",
"enabled": true,
"marksgamemodded": true,
"compatibleversions": [
"0.7.0"
],
}
]
The other is in your DLL, any method that has a Modloader.ModCallback, the class must have the [ModLoader.ModManager] attribute
[ModLoader.ModManager]
public static class GameLoader
{
public static string ICON_FOLDER_PANDA_REL = @"gamedata\mods\Pandaros\settlers\icons";
public static string LOCALIZATION_FOLDER_PANDA = @"gamedata\mods\Pandaros\settlers\localization";
public static string MOD_FOLDER = @"gamedata\mods\Pandaros\settlers";
public const string NAMESPACE = "Pandaros.Settlers";
[ModLoader.ModCallback(ModLoader.EModCallbackType.OnAssemblyLoaded, NAMESPACE + ".OnAssemblyLoaded")]
public static void OnAssemblyLoaded(string path)
{
MOD_FOLDER = Path.GetDirectoryName(path);
PandaLogger.Log("Found mod in {0}", MOD_FOLDER);
LOCALIZATION_FOLDER_PANDA = Path.Combine(MOD_FOLDER, "localization");
ICON_FOLDER_PANDA_REL = Path.Combine(MOD_FOLDER, "icons");
}
The ModLoader.ModCallback has 2 arguments.
- The Enum ModLoader.EModCallbackType - This tells the game when to call this method. See The "Colony Survival\gamedata\mods" Help.txt for more information about the callbacks and their parameters.
- The indexed name of the callback. This should include your namespace so you do not interfere with any other mods.