ShipDecorations.cs 6.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using UnityEngine;
  2. using GadgetCore.API;
  3. using UnityEngine.SceneManagement;
  4. using System.Reflection;
  5. using GadgetCore.API.ConfigMenu;
  6. using System;
  7. using ScrapYard.API;
  8. namespace ShipDecorations
  9. {
  10. [Gadget("ShipDecorations", LoadAfter: new string[] { "ScrapYard" }, Dependencies: new string[] { "ScrapYard" }, LoadPriority: 100)]
  11. public class ShipDecorations : Gadget<ShipDecorations>
  12. {
  13. public const string MOD_VERSION = "1.0"; // Set this to the version of your mod.
  14. public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
  15. public override IGadgetConfigMenu GetConfigMenu() { return null; }
  16. protected override void LoadConfig() { Config.Reset(); Config.Save(); }
  17. public override string GetModDescription()
  18. {
  19. return "A mod that adds some more ship decorations.";
  20. }
  21. protected override void Initialize()
  22. {
  23. Logger.Log("Ship Decorations v" + Info.Mod.Version);
  24. Core.logger = Logger;
  25. var lightsPlatform = new ShopPlatform("Decorations").Register();
  26. lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableDecoItem("cBed.png", "iBed.png", "Bed"), 1000));
  27. lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableDecoItem("cPlant0Plant.png", "iPlant0Plant.png", "Bush Plant"), 1000));
  28. lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableDecoItem("cTree5Plant.png", "iTree5Plant.png", "Tree Plant"), 1000));
  29. lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableDecoItem("cTreantHeadPlant.png", "iTreantHeadPlant.png", "Treant Plant"), 2, 1, ItemRegistry.GetItemIDByRegistryName("ScrapYard:Scrap Trophy")));
  30. lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableSlideDoorItem("cDoor.png", "cDoorOpen.png", "iDoor.png", "Door"), 1000));
  31. ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cWindowScrapWall.png", "iWindowScrapWall.png", "Scrap Wall Window"), 10));
  32. ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cTitaniumWall.png", "iTitaniumWall.png", "Titaniu Wall"), 10));
  33. ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cTitaniumWindow.png", "iTitaniumWindow.png", "Titaniu Window"), 10));
  34. ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cHiveWall.png", "iHiveWall.png", "Hive Wall"), 10));
  35. ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cHiveWindow.png", "iHiveWindow.png", "Hive Window"), 10));
  36. ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cStealWall.png", "iStealWall.png", "Steal Wall"), 10));
  37. ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cStealWindow.png", "iStealWindow.png", "Steal Window"), 10));
  38. ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateBlockItem("cStealBlock.png", "iStealBlock.png", "Steal Block"), 10));
  39. lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableStairsItemL("cStairs.png", "iStairs.png", "Stairs [L]", "StairsL"), 10));
  40. lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableStairsItemR("cStairsR.png", "iStairsR.png", "Stairs [R]", "StairsR"), 10));
  41. { // Part Engine Blue
  42. var asset = GadgetCoreAPI.LoadAssetBundle("engine");
  43. var engine = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/engineBlue.prefab"));
  44. engine.name = "engineBlue";
  45. engine.transform.localScale = new Vector3(2, 2, 2);
  46. GadgetCoreAPI.AddCustomResource("prop/ScrapYard/component/engineBlue", engine);
  47. }
  48. { // Part Engine Yellow
  49. var asset = GadgetCoreAPI.LoadAssetBundle("engine");
  50. var engine = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/engineYellow.prefab"));
  51. engine.name = "engineYellow";
  52. engine.transform.localScale = new Vector3(2, 2, 2);
  53. GadgetCoreAPI.AddCustomResource("prop/ScrapYard/component/engineYellow", engine);
  54. }
  55. { // Part Engine Red
  56. var asset = GadgetCoreAPI.LoadAssetBundle("engine");
  57. var engine = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/engineRed.prefab"));
  58. engine.name = "engineRed";
  59. engine.transform.localScale = new Vector3(2, 2, 2);
  60. GadgetCoreAPI.AddCustomResource("prop/ScrapYard/component/engineRed", engine);
  61. }
  62. { // Part Engine Green
  63. var asset = GadgetCoreAPI.LoadAssetBundle("engine");
  64. var engine = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/engineGreen.prefab"));
  65. engine.name = "engineGreen";
  66. engine.transform.localScale = new Vector3(2, 2, 2);
  67. GadgetCoreAPI.AddCustomResource("prop/ScrapYard/component/engineGreen", engine);
  68. }
  69. foreach (var e in ShopPlatform.DefaultObjects.GetShopPlatformEntries())
  70. {
  71. if (e.ItemID == 2400)
  72. {
  73. ShopPlatform.DefaultBlocks.RemoveShopPlatformEntry(e);
  74. }
  75. }
  76. ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateEngineItem("cBlueEngineBlock.png", "iBlueEngineBlock.png", "engineBlue", "Plasma Engine", "An engine for a ship.", "BlueEngineBlock"), 10));
  77. ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateEngineItem("cYellowEngineBlock.png", "iYellowEngineBlock.png", "engineYellow", "Differential Engine", "An engine for a ship.", "YellowEngineBlock"), 10));
  78. ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateOverrideEngineItem("cRedEngineBlock.png", "iRedEngineBlock.png", "engineRed", "Combustion Engine", "An engine for a ship.", "RedEngineBlock"), 10));
  79. ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateEngineItem("cGreenEngineBlock.png", "iGreenEngineBlock.png", "engineGreen", "Burst Engine", "An engine for a ship.", "GreenEngineBlock"), 10));
  80. }
  81. }
  82. }