I have no idea what I’m doing; this guide contains the steps that worked for me. Hopefully it can help other people get started too.
This guide assumes you’re using the Steam version of Dinkum on a 64bit Windows PC, because that's what I’m using.
You don’t want to ruin the world you spent hours creating with a badly written mod do you?
C:\Users\<username>\AppData\LocalLow\James Bendon\Dinkum
Install BepinEx, exactly the same way you do for using mods
Run Dinkum so it generates config files
NOTE: You’ve probably already done those steps, unless you’ve decided to code a Dinkum mod before using any other Dinkum mods.
Edit the Logging Console section of Bepinex’s config file <Dinkum installation dir>\BepInEx\config\BepInEx.cfg
[Logging.Console]
## Enables showing a console for log output.
# Setting type: Boolean
# Default value: false
Enabled = true
Now when you run Dinkum you’ll see a Bepenix console window open up as well.
dotnet-sdk-6.0.400-win-x64 from https://dotnet.microsoft.com/en-us/download
Open up a command prompt window and run
dotnet new -i BepInEx.Templates --nuget-source
https://nuget.bepinex.dev/v3/index.json
I’m using Visual Studio Code.
You can use any tool you like, even a simple text editor like notepad. It's a lot easier with a proper IDE though.
Create a new directory to hold your mods
Open a command prompt, navigate to that directory, run the following commands:
dotnet new bep6plugin_unitymono -n MyFirstPlugin -T netstandard2.0 -U 2020.3.17
dotnet restore MyFirstPlugin
Run Visual Studio Code; if it asks you about trust tell it to trust the folder you are putting your mods in. Then select File -> Open Folder and open the MyFirstPlugin folder.
<AssemblyName>net.myvanitydomain.bepinex.testplugin1</AssemblyName>
<Description>Test Plugin I</Description>
<Version>1.0.0.0</Version>
AssemblyName will become the GUID of the mod so it must be unique.
You can decompile the game's code using a .NET decompiler. The file you want to decompile is "Dinkum\Dinkum_Data\Managed\Assembly-CSharp.dll" in the game's installation folder.
Make sure you always update your game to the latest version and reference the latest Assembly-CSharp.dll in your mod projects.
You will be able to use BepInEx and Harmony to hook into the games code and modify it or reference existing code and run your own custom methods.
Before writing your own code make sure to reference the necessary assembly files in your mod project, the most important assembly is Assembly-CSharp.dll
sometimes you will need additional references like when editing network related code you will need to reference Mirror.dll or when editing Text you will need to reference Unity.TextMeshPro.dll
The below links will help you get started in writing your own code.
Harmony Documentation
BepInEx 6 Documentation
From a command prompt, navigate to the mods directory and run
dotnet build
Compiling will create a bin\Debug\netstandard2.0
folder in your mods directory, with a dll named <modname>.dll
If using an IDE you will simply use the GUI to build your solution/project into a .dll
Copy the DLL you just created to the <Dinkum installation dir>\BepInEx\plugins
directory. Just like installing a real mod!
Run Dinkum, and look in the Bepinex console to confirm your mod has loaded.
https://docs.bepinex.dev/master/articles/dev_guide/plugin_tutorial/1_setup.html
#modding_space on the Dinkum Discord