Getting Started
This guide will walk you through the basic steps of creating a mod for OneShot: World Machine Edition using the WML.API.
Prerequisites
- .NET Framework (preferably 4.6.2)
- Steam copy of OneShot: World Machine Edition
- Visual Studio 2022 (recommended) or any other code editor with C# support. Note that this guide was made for Visual Studio 2022 only.
Project Setup
- Create a new Class Library (.NET Framework) project:
Give your project's name a unique ID. (e.g.net.referr.samplemod
).- You need to do this to avoid conflicts between mods.
- Reference the WML.API:
You should referenceWML.API.dll
(provided with the modloader) so you can use the API in your mod. Currently you can do this manually. Also, you need to add references toOneShotMG.exe
andMonoGame.Framework.dll
(both files are located within game's directory) so that you can interact with the game itself. - Implement the
IMod
interface:
Create a class and implement theIMod
interface.
Example:using WorldMachineLoader.API.Core; using WorldMachineLoader.API.Interfaces; namespace net.referr.samplemod { public class Mod : IMod { ModContext context; public void OnLoad(ModContext context) { context.Logger.Log("Mod loading!"); } public void OnShutdown() { context.Logger.Log("Shutting down!"); } } }
- Create
mod.json
:
You'll also need to have your mod's metadata inmod.json
file.
Example:{ "name": "SampleMod", "id": "net.referr.samplemod", "description": "This is Sample Mods description!", "author": "ref-err", "version": "1.0.0", "url": "https://github.com/ref-err/WorldMachineLoader", "icon": "icon.png", "assembly_name": "net.referr.samplemod" // without .dll! }
- Build and install:
- Build your project - you'll get something like
net.referr.samplemod.dll
. - In your game directory, create
mods\SampleMod\
and put there:net.referr.samplemod.dll
mod.json
- (Optional)
icon.png
- Build your project - you'll get something like
- Launch the game:
Just runWorldMachineLoader.exe
and you're done!
Next Steps
Once your mod is loading, you can explore: