ScrapYard.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using UnityEngine;
  2. using GadgetCore.API;
  3. namespace ScrapYard
  4. {
  5. [Gadget("ScrapYard")]
  6. public class ScrapYard : Gadget<ScrapYard>
  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. Config.Save();
  20. }
  21. public override string GetModDescription()
  22. {
  23. return "A mod that adds a scryp yard planet.";
  24. }
  25. protected override void Initialize()
  26. {
  27. Logger.Log("ScrapYard v" + Info.Mod.Version);
  28. Core.logger = Logger;
  29. Texture2D texturePlanetIcon = GadgetCoreAPI.LoadTexture2D("planetScrapYard.png", false);
  30. Texture2D texturePlanetPrevIcon = GadgetCoreAPI.LoadTexture2D("planetScrapYardPrev.png", false);
  31. Texture2D texturePortalSign = GadgetCoreAPI.LoadTexture2D("signScrapYard.png", false);
  32. Texture2D textureBG= GadgetCoreAPI.LoadTexture2D("bgScrapYard.png", false);
  33. Texture2D textureParalex0 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg0.png", false);
  34. Texture2D textureParalex1 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg1.png", false);
  35. Texture2D textureParalex2 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg2.png", false);
  36. Texture2D textureParalex3 = GadgetCoreAPI.LoadTexture2D("bScrapYardbg3.png", false);
  37. Texture2D textureEntrance = GadgetCoreAPI.LoadTexture2D("entranceScrapYard.png", false);
  38. Texture2D textureSmallSide = GadgetCoreAPI.LoadTexture2D("sideSmallScrapYard.png", false);
  39. Texture2D textureBigSide = GadgetCoreAPI.LoadTexture2D("sideBigScrapYard.png", false);
  40. Texture2D textureMid0 = GadgetCoreAPI.LoadTexture2D("midScrapYardChunk0.png", false);
  41. Texture2D textureMid1 = GadgetCoreAPI.LoadTexture2D("midScrapYardChunk1.png", false);
  42. PlanetInfo scrapYardPlanet = new PlanetInfo(PlanetType.NORMAL, "Scrap Yard", new GadgetCore.Util.Tuple<int, int>[] { new GadgetCore.Util.Tuple<int, int>(1, 100) });
  43. scrapYardPlanet.SetPortalInfo(texturePortalSign, texturePlanetPrevIcon, texturePlanetIcon);
  44. scrapYardPlanet.SetBackgroundInfo(textureBG, textureParalex0, textureParalex1, textureParalex2, textureParalex3);
  45. scrapYardPlanet.SetTerrainInfo(textureEntrance, textureBG, textureMid0, textureMid1, textureBigSide, textureSmallSide);
  46. scrapYardPlanet.Register("Scrap Yard");
  47. //PlanetRegistry.SetVanillaExitPortalWeight(0, scrapYardPlanet.GetID(), 1000);
  48. }
  49. }
  50. }