First.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using UnityEngine;
  2. using GadgetCore.API;
  3. namespace First
  4. {
  5. [Gadget("First")]
  6. public class First : Gadget<First>
  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 new description."; // TODO: Change this
  25. }
  26. protected override void Initialize()
  27. {
  28. Logger.Log("First v" + Info.Mod.Version);
  29. Material copy = new Material((Material)Resources.Load("mat/planet0"));
  30. copy.mainTexture = GadgetCoreAPI.LoadTexture2D("charBG.png");
  31. GadgetCoreAPI.AddCustomResource("mat/planet0", copy);
  32. //int id = ItemUtil.CreateDefaultItem("iCore.png", "Water Core");
  33. //Core.itemID = id;
  34. Core.itemWaterCoreId = ItemUtil.CreateDefaultItem("iWaterCore.png", "Water Core");
  35. Core.itemAirCoreId = ItemUtil.CreateDefaultItem("iAirCore.png", "Air Core");
  36. Core.itemFireCoreId = ItemUtil.CreateDefaultItem("iFireCore.png", "Fire Core");
  37. Core.itemEarthCoreId = ItemUtil.CreateDefaultItem("iEarthCore.png", "Earth Core");
  38. //Core.itemGreenLampId = ItemUtil.CreatePlacableItem("cGreenLamp.png", "iGreenLamp.png", 2401, "Green Lamp", "Green Lamp Object", "Green Lamp");
  39. Core.itemGreenLampId = ItemUtil.CreatePlacableLightItem("cGreenLamp.png", "iGreenLamp.png", "Green Light", new Color(0.1f, 0.6f, 0, 1));
  40. Core.itemYellowLampId = ItemUtil.CreatePlacableLightItem("cYellowLamp.png", "iYellowLamp.png", "Yellow Light", new Color(0.9f, 0.75f, 0, 1));
  41. Core.itemOrangeLampId = ItemUtil.CreatePlacableLightItem("cOrangeLamp.png", "iOrangeLamp.png", "Orange Light", new Color(0.7f, 0.15f, 0, 1));
  42. Core.itemPurpleLampId = ItemUtil.CreatePlacableLightItem("cPurpleLamp.png", "iPurpleLamp.png", "Purple Light", new Color(0.5f, 0, 0.6f, 1));
  43. Core.itemWhiteLampId = ItemUtil.CreatePlacableLightItem("cWhiteLamp.png", "iWhiteLamp.png", "White Light", new Color(0.8f, 0.8f, 0.8f, 1));
  44. Core.itemID = ItemUtil.CreatePlacableItem("cPlatform.png", "iPlatform.png", 2501, "Platform", "Platform Object", "Platform");
  45. PlanetInfo scrapYardPlanetInfo = new PlanetInfo(PlanetType.SPECIAL, "Scrap Yard", new GadgetCore.Util.Tuple<int, int>[0]).Register("Scrap Yard");
  46. PlanetRegistry.SetVanillaExitPortalWeight(0, scrapYardPlanetInfo.GetID(), 1000);
  47. }
  48. }
  49. }