Skip to content

Tutorial two: Adding a config.

JMteam09 edited this page Feb 21, 2018 · 2 revisions

Welcome back!

Great to see that you want to learn more, lets get started.
So remember where we left off?
Lets change our I_Do_not_know_da_wae.cs to do even better things!
Lets create a configuration class. (You can place this one in the same file)

namespace TestMod1
{
    [MyModEntryPoint] //This tells the modloader this is the class that implements MyMod and is your main class
    class I_Do_not_know_da_wae : MyMod
    {
        public I_Do_not_know_da_wae() : base("{YOUR MOD NAME HERE}","{YOUR MOD DESCRIPTION HERE}","{YOUR VERSION HERE}")
        {
            //Only assign variables here. doing mod related things meight result in errors!
        }
        protected override void onLoad()
        {
            //Do shit here
            ModLoader.mainConsole.log("Hello world", "My Cool Log Tag");
        }

        protected override void onUnload()
        {
            //Not in use atm. will never be calld. dont worry
        }
    }

    class MaiIConfigU : IMyConfig //Oh! im new! Look @ Me!!!
    {
        private String hi;
        public override void SetupDefaults()
        {
            //This will be ran when the config is being created for the first time.
            //You can do cool coding tricks in here too
            this.hi = "Well im the default value";
            ModLoader.mainConsole.log("We can do more here then just assign values!", "I have a free will too tag!");
        }
    }
}