Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

How to develop mods

dani0105 edited this page Apr 13, 2022 · 1 revision

requirements

  • Visual studio Community
  • .NET Framework >= 4.6.1
  • Download mod loader version that you want

Project creation

Open Visual studio Community and create a new project of type "Bclass library(.NET Framework)"
Imgur
Now configure the project with the name of your mod and the version of .net you want
Imgur

In the project folder create a folder called "Dependencies" and inside put a .gitignore file with the following content

*
!.gitignore

This is to avoid uploading the dlls to the repository. Followed by that place within "Dependencies" at least the files Assembly-CSharp.dll, Modloader.dll, UnityEngine.dll,0Harmony.dll and UnityEngine.CoreModule.dll.
Imgur
Now add the references of these files in the Visual studio Community
Imgur

Now in your main class make it extend SFSMod and implement its methods, and you should be left with something like this:

using ModLoader;
using System;
using UnityEngine;

namespace ModTest
{
    public class Class1 : SFSMod
    {
        public Class1() : base(
           "testid", // Mod id
           "Test mod", // Mod Name
           "auhtor", // Mod Author
           "v1.1.x", // Mod loader version
           "v1.0.0" // Mod version
           )
        {
        }


        public override void load()
        {
            Debug.Log("Test Mod");
            // do stuff here
        }

        public override void unload()
        {
            throw new NotImplementedException();
        }
    }
}

Finally compile your project to generate a dll file and place it in the MODS folder following the same steps as if you were going to install one more mod.

Note: just copy the dll file of your mod and not the dependencies