MonsterNests.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using UnityEngine;
  2. using GadgetCore.API;
  3. using GadgetCore.Util;
  4. namespace MonsterNests
  5. {
  6. [Gadget("MonsterNests")]
  7. public class MonsterNests : Gadget<MonsterNests>
  8. {
  9. public const string MOD_VERSION = "1.0"; // Set this to the version of your mod.
  10. public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
  11. protected override void LoadConfig()
  12. {
  13. Config.Load();
  14. string fileVersion = Config.ReadString("ConfigVersion", CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)");
  15. if (fileVersion != CONFIG_VERSION)
  16. {
  17. Config.Reset();
  18. Config.WriteString("ConfigVersion", CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)");
  19. }
  20. Config.Save();
  21. }
  22. public override string GetModDescription()
  23. {
  24. return "A mod that adds some monster nests.";
  25. }
  26. protected override void Initialize()
  27. {
  28. Logger.Log("Monster Nests v" + Info.Mod.Version);
  29. Core.logger = Logger;
  30. Texture2D textureBugspotBig = GadgetCoreAPI.LoadTexture2D("bugspotBig.png");
  31. Texture2D textureSpiderEgg = GadgetCoreAPI.LoadTexture2D("spiderEgg.png");
  32. Texture2D textureGoldenShroom = GadgetCoreAPI.LoadTexture2D("goldenShroom.png");
  33. Core.objectBugspotBig = new ObjectInfo(ObjectType.BUGSPOT, new Item(31, 1, 0, 0, 0, new int[3], new int[3]), 22, textureBugspotBig).Register("bugspotBig");
  34. Core.objectSpiderEgg = new ObjectInfo(ObjectType.ORE, new Item(3, 1, 0, 0, 0, new int[3], new int[3]), 22, textureSpiderEgg).Register("spiderEgg");
  35. Core.objectGoldenShroom = new ObjectInfo(ObjectType.PLANT, new Item(12, 1, 0, 0, 0, new int[3], new int[3]), 22, textureGoldenShroom).Register("goldenShroom");
  36. //PlanetInfo planetInfo = PlanetRegistry.Singleton[0];
  37. //planetInfo.AddWeightedWorldSpawn(objectBugspotBig, 10);
  38. //planetInfo.AddWeightedWorldSpawn(objectGoldenShroom, 10);
  39. /*
  40. GameObject enemy = GadgetCoreAPI.GetEntityResource("");
  41. new EntityInfo(EntityType.COMMON, objectSpaceOreBig.Object, new int[] { 0 }).Register("");
  42. */
  43. /*
  44. ((CraftMenuInfo)MenuRegistry.Singleton["Gadget Core:Crafter Menu"]).AddCraftPerformer(CraftMenuInfo.CreateSimpleCraftPerformer(
  45. Tuple.Create(new int[] { 11, 11, 11 }, new Item(11, 2, 0, 0, 0, new int[3], new int[3]), 2)
  46. ));
  47. */
  48. }
  49. }
  50. }