Jump to content

Looking to get started with modding


Recommended Posts

Would anyone like to post an up to date tutorial on how to get a simple 'hello world' style mod up and running on the mod system Klei has set up? An overview of the file structure required (and whether the community developed modloader is still needed), compiling the solution and so on would be very helpful. Bonus points if the tutorial shows how to modify (or add) structures :)

Link to comment
Share on other sites

Unfortunately I don't have time to write a tutorial, but to give you an idea: https://github.com/javisar/ONI-Modloader#creating-a-mod <- this guide actually still works, except you don't need the modloader anymore, the game loads your mod for you. Place your finished DLL in it's own subfolder under C:\Users\<user>\Documents\Klei\OxygenNotIncluded\mods\dev and enable it in the mods menu to test.

You will have to use Harmony in order to get your code to execute, I'd recommend starting by creating a Postfix-patch. Or check out and play around with some pre-existing mods, they're all open source with the sourcecode usually being linked in their description in the Steam Workshop. You can also ask for help in the modding channel on the ONI Discord server, as this subforum is still a bit sleepy.

Link to comment
Share on other sites

First you need to gain access to the ONI source code. This can be done with ILSpy. The file you are interested in looking at is OxygenNotIncluded_Data\Managed\Assembly-CSharp.dll.

You can attach your code to existing code using Harmony. It has a lot of features, but in most cases what you need is Prefix and Postfix. This will allow you to create methods, which will be called before or after a certain method in the source is called.

Other than that, look at the source code for existing mods. Most if not all modders use public git repositories.

Personally whenever I start a new mod, I just copy an existing mod and alter the name, both for the project two project file names and using notepad++ to replace all instances of the name in those two files. There is also the assembly info file, which needs a new name. That's the easiest way to get all the paths set up and stuff like that.

Ask questions if you have something specific. Klei have mentioned planning on making their own modding tutorials after the next release. That combined with the fact that the next release might change something regarding modding (like hopefully adding easy access to add custom graphics), the modders aren't that interested in spending ages writing a proper guide right now.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...