-
Notifications
You must be signed in to change notification settings - Fork 8
Creating Mods
All mods must be C# Class Libraries targeting .NET Framework 4.0+. See this OLD screenshot for an example of project creation settings in Visual Studio Community 2017 (free download).
Additionally, reference the following assemblies in your mod project as needed:
-
0Harmony.dll
(Optional; Patching library) -
ACTk.Runtime.dll
(Optional; Obscured value access) -
PulsarModLoader.dll
(PML code) -
Assembly-CSharp.dll
(Game code) -
UnityEngine.CoreModule.dll
(Optional; Engine code needed for some value types and methods) -
UnityEngine.*.dll
(Optional; Specific DLL depends what changes are made)
Mods must also contain a subclass of PulsarModLoader.PulsarMod
for your mod to load. This class is instantiated once during game startup (currently before PLGlobal.Awake()
), so you can handle mod setup in its constructor. The base constructor already loads Harmony, so only overriding protected string HarmonyIdentifier()
is required for simple mods. To extend setup, override the constructor with a call to base.
For standardization, The PulsarMod extension class should be named 'Mod', and the harmony Identifier should be a combination of the author name and the mod name.
class Mod : PulsarMod
{
public Mod() : base()
{
// Do additional setup here
}
protected override string HarmonyIdentifier()
{
// Make this unique to your mod!
return "Author.ModName";
}
[...]
}
Using Harmony
to hook PULSAR methods is strongly recommended due to its simple API and tools that help multiple Mods play nicely when modifying the same methods (stacking hooks instead of overwriting each other, prioritization, etc). Any class using Harmony decorators will magically hook their methods.
using Harmony;
namespace ExampleMod
{
[HarmonyPatch(typeof(PLNetworkManager), "Start")]
class VersionModifier
{
static void Postfix(PLNetworkManager __instance)
{
__instance.VersionString += "\nCool Kid Version";
}
}
}
Distribute mods as .dll
assemblies. To install, simply drop the assembly into the Mods
folder; any properly-defined *.dll
mod assemblies are automatically loaded.