Table of Contents

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

  1. 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.
  2. Reference the WML.API:
    You should reference WML.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 to OneShotMG.exe and MonoGame.Framework.dll (both files are located within game's directory) so that you can interact with the game itself.
  3. Implement the IMod interface:
    Create a class and implement the IMod 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!");
             }
         }
     }
    
  4. Create mod.json:
    You'll also need to have your mod's metadata in mod.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!
    }
    
  5. Build and install:
    1. Build your project - you'll get something like net.referr.samplemod.dll.
    2. In your game directory, create mods\SampleMod\ and put there:
      • net.referr.samplemod.dll
      • mod.json
      • (Optional) icon.png
  6. Launch the game:
    Just run WorldMachineLoader.exe and you're done!

Next Steps

Once your mod is loading, you can explore: