TemplateGadgetMod.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using UnityEngine;
  2. using GadgetCore.API;
  3. namespace TemplateGadgetMod
  4. {
  5. [Gadget("Template Gadget Mod")]
  6. public class TemplateGadgetMod : Gadget<TemplateGadgetMod>
  7. {
  8. public const string MOD_VERSION = "1.0"; // Set this to the version of your mod.
  9. public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
  10. protected override void LoadConfig()
  11. {
  12. Config.Load();
  13. string fileVersion = Config.ReadString("ConfigVersion", CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)");
  14. if (fileVersion != CONFIG_VERSION)
  15. {
  16. Config.Reset();
  17. Config.WriteString("ConfigVersion", CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)");
  18. }
  19. // Do stuff with `Config`
  20. Config.Save();
  21. }
  22. public override string GetModDescription()
  23. {
  24. return "This is a template description."; // TODO: Change this
  25. }
  26. protected override void Initialize()
  27. {
  28. Logger.Log("TemplateGadgetMod v" + Info.Mod.Version);
  29. // TODO: Do stuff like registering items
  30. }
  31. }
  32. }