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.exeandMonoGame.Framework.dll(both files are located within game's directory) so that you can interact with the game itself. - Implement the
IModinterface:
Create a class and implement theIModinterface.
Example:using WorldMachineLoader.API.Core; using WorldMachineLoader.API.Interfaces; namespace net.referr.samplemod { public class Mod : IMod { ModContext context; public void OnLoad(ModContext modContext) { context = modContext; 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.jsonfile.
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.dllmod.json- (Optional)
icon.png
- Build your project - you'll get something like
- Launch the game:
Just runWorldMachineLoader.exeand you're done!
Next Steps
Once your mod is loading, you can explore: