Browse Source

[ShipDecorations] [2.0.3.6] more stuff and ScrapYard.API

Zariteis 4 years ago
parent
commit
13319edae2

BIN
ShipDecorations/Assets/cHavyWindow.png


BIN
ShipDecorations/Assets/cHiveWall.png


BIN
ShipDecorations/Assets/cHiveWindow.png


BIN
ShipDecorations/Assets/cRailing.png


BIN
ShipDecorations/Assets/cStairs.png


BIN
ShipDecorations/Assets/cStairsR.png


BIN
ShipDecorations/Assets/cWindowScrapWall.png


BIN
ShipDecorations/Assets/cWindowScrapWall2.png


BIN
ShipDecorations/Assets/iHavyWindow.png


BIN
ShipDecorations/Assets/iHiveWall.png


BIN
ShipDecorations/Assets/iHiveWindow.png


BIN
ShipDecorations/Assets/iStairs.png


BIN
ShipDecorations/Assets/iStairsR.png


BIN
ShipDecorations/Assets/iWindowScrapWall.png


BIN
ShipDecorations/Assets/stand0.png


BIN
ShipDecorations/Assets/stand1.png


BIN
ShipDecorations/Assets/stand2.png


BIN
ShipDecorations/Assets/stand3.png


BIN
ShipDecorations/Assets/stand4.png


BIN
ShipDecorations/Assets/stand5.png


BIN
ShipDecorations/Assets/stand6.png


+ 2 - 0
ShipDecorations/DoorColliderScript.cs

@@ -16,6 +16,7 @@ namespace ShipDecorations
 
         gameObject.transform.parent.GetChild(0).gameObject.SetActive(false);
         gameObject.transform.parent.GetChild(1).gameObject.SetActive(true);
+        gameObject.GetComponent<BoxCollider>().size = new Vector3(1.55f, 1, 1);
         gameObject.GetComponent<AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/bloo"), Menuu.soundLevel / 10f);
       }
     }
@@ -30,6 +31,7 @@ namespace ShipDecorations
           inside = 0;
           gameObject.transform.parent.GetChild(0).gameObject.SetActive(true);
           gameObject.transform.parent.GetChild(1).gameObject.SetActive(false);
+          gameObject.GetComponent<BoxCollider>().size = new Vector3(1, 1, 1);
           gameObject.GetComponent<AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/bloo"), Menuu.soundLevel / 10f);
         }
       }

+ 94 - 2
ShipDecorations/ItemUtil.cs

@@ -18,7 +18,7 @@ namespace ShipDecorations
         mainTexture = texture2D
       };
 
-      ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", texture2D2, -1, default, null, null, null, null);
+      ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", texture2D2);
       itemInfo.Register(name);
       new TileInfo(TileType.NONSOLID, texture2D, gameObject, itemInfo).Register(name);
 
@@ -72,10 +72,102 @@ namespace ShipDecorations
 
       var script = doorTrigger.gameObject.AddComponent<DoorColliderScript>();
 
-      ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", texture2DItem, -1, default, null, null, null, null);
+      ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", texture2DItem);
       itemInfo.Register(name);
       new TileInfo(TileType.NONSOLID, texture2D, hostObject, itemInfo).Register(name);
 
+      Texture2D tex = new Texture2D(2, 2, TextureFormat.ARGB32, false, true);
+
+      return itemInfo.GetID();
+    }
+
+    public static int CreateWallItem(string tileImgPath, string itemImgPath, string name)
+    {
+
+      Texture2D textureTile = GadgetCoreAPI.LoadTexture2D(tileImgPath);
+      Texture2D textureItem = GadgetCoreAPI.LoadTexture2D(itemImgPath);
+
+      ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", textureItem);
+      itemInfo.Register(name);
+      new TileInfo(TileType.WALL, textureTile, null, itemInfo).Register(name);
+
+      return itemInfo.GetID();
+    }
+
+    public static int CreateBlockItem(string tileImgPath, string itemImgPath, string name)
+    {
+
+      Texture2D textureTile = GadgetCoreAPI.LoadTexture2D(tileImgPath);
+      Texture2D textureItem = GadgetCoreAPI.LoadTexture2D(itemImgPath);
+
+      ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", textureItem);
+      itemInfo.Register(name);
+      new TileInfo(TileType.SOLID, textureTile, null, itemInfo).Register(name);
+
+      return itemInfo.GetID();
+    }
+
+    public static int CreatePlacableStairsItemL(string tileImgPath, string itemImgPath, string name)
+    {
+
+      Texture2D texture2DTile = GadgetCoreAPI.LoadTexture2D(tileImgPath);
+      Texture2D texture2DItem = GadgetCoreAPI.LoadTexture2D(itemImgPath);
+
+      GameObject gameObject = Object.Instantiate<GameObject>((GameObject)Resources.Load("prop/2501"));
+      Renderer renderer = gameObject.GetComponentInChildren<Renderer>();
+      renderer.material = new Material(Shader.Find("Transparent/Diffuse"))
+      {
+        mainTexture = texture2DTile
+      };
+
+      for (int i = 0; i < 14; i++)
+      {
+        GameObject colliderObject = new GameObject();
+        colliderObject.transform.localScale = new Vector3(4f, 4f, 5);
+        colliderObject.transform.localPosition = new Vector3(10f, -0.22f, 0);
+        colliderObject.transform.SetParent(gameObject.transform);
+        colliderObject.layer = 0;
+        BoxCollider doorTrigger = colliderObject.AddComponent<BoxCollider>();
+        doorTrigger.size = new Vector3(Mathf.Sqrt(2f), 0.2f, 1);
+        doorTrigger.transform.rotation = Quaternion.Euler(0, 0, -45);
+      }
+
+      ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", texture2DItem);
+      itemInfo.Register(name);
+      new TileInfo(TileType.NONSOLID, texture2DTile, gameObject, itemInfo).Register(name);
+
+      return itemInfo.GetID();
+    }
+
+    public static int CreatePlacableStairsItemR(string tileImgPath, string itemImgPath, string name)
+    {
+
+      Texture2D texture2DTile = GadgetCoreAPI.LoadTexture2D(tileImgPath);
+      Texture2D texture2DItem = GadgetCoreAPI.LoadTexture2D(itemImgPath);
+
+      GameObject gameObject = Object.Instantiate<GameObject>((GameObject)Resources.Load("prop/2501"));
+      Renderer renderer = gameObject.GetComponentInChildren<Renderer>();
+      renderer.material = new Material(Shader.Find("Transparent/Diffuse"))
+      {
+        mainTexture = texture2DTile
+      };
+
+      for (int i = 0; i < 14; i++)
+      {
+        GameObject colliderObject = new GameObject();
+        colliderObject.transform.localScale = new Vector3(4f, 4f, 5);
+        colliderObject.transform.localPosition = new Vector3(10f, -0.22f, 0);
+        colliderObject.transform.SetParent(gameObject.transform);
+        colliderObject.layer = 0;
+        BoxCollider doorTrigger = colliderObject.AddComponent<BoxCollider>();
+        doorTrigger.size = new Vector3(Mathf.Sqrt(2f), 0.2f, 1);
+        doorTrigger.transform.rotation = Quaternion.Euler(0, 0, 45);
+      }
+
+      ItemInfo itemInfo = new ItemInfo(ItemType.GENERIC, name, "", texture2DItem);
+      itemInfo.Register(name);
+      new TileInfo(TileType.NONSOLID, texture2DTile, gameObject, itemInfo).Register(name);
+
       return itemInfo.GetID();
     }
   }

+ 10 - 1
ShipDecorations/ShipDecorations.cs

@@ -8,7 +8,7 @@ using ScrapYard.API;
 
 namespace ShipDecorations
 {
-  [Gadget("ShipDecorations", LoadAfter: new string[] { "ScrapYard" }, Dependencies: new string[] { "ScrapYard" })]
+  [Gadget("ShipDecorations", LoadAfter: new string[] { "ScrapYard" }, Dependencies: new string[] { "ScrapYard" }, LoadPriority: 100)]
   public class ShipDecorations : Gadget<ShipDecorations>
   {
     public const string MOD_VERSION = "1.0"; // Set this to the version of your mod.
@@ -35,6 +35,15 @@ namespace ShipDecorations
       lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableDecoItem("cTreantHeadPlant.png", "iTreantHeadPlant.png", "Treant Plant"), 2, 1, ItemRegistry.GetItemIDByRegistryName("ScrapYard:Scrap Trophy")));
       lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableSlideDoorItem("cDoor.png", "cDoorOpen.png", "iDoor.png", "Door"), 1000));
 
+      ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cWindowScrapWall.png", "iWindowScrapWall.png", "Scrap Wall Window"), 10));
+      ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cWindowScrapWall.png", "iWindowScrapWall.png", "Strong Wall"), 10));
+      ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cHavyWindow.png", "iHavyWindow.png", "Strong Window"), 10));
+      ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cHiveWall.png", "iHiveWall.png", "Hive Wall"), 10));
+      ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cHiveWindow.png", "iHiveWindow.png", "Hive Window"), 10));
+
+      lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableStairsItemL("cStairs.png", "iStairs.png", "Stairs"), 10));
+      lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableStairsItemR("cStairsR.png", "iStairsR.png", "Stairs Right"), 10));
+
     }
   }
 }

+ 39 - 0
ShipDecorations/ShipDecorations.csproj

@@ -133,6 +133,15 @@
     <None Update="Assets\charBG.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Update="Assets\cHavyWindow.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cHiveWall.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cHiveWindow.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Update="Assets\cOrangeLamp.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
@@ -145,6 +154,12 @@
     <None Update="Assets\cPurpleLamp.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Update="Assets\cStairs.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cStairsR.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Update="Assets\cTreantHeadPlant.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
@@ -154,6 +169,12 @@
     <None Update="Assets\cWhiteLamp.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Update="Assets\cWindowScrapWall.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cWindowScrapWall2.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Update="Assets\cYellowLamp.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
@@ -181,6 +202,15 @@
     <None Update="Assets\iGreenLamp.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Update="Assets\iHavyWindow.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iHiveWall.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iHiveWindow.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Update="Assets\iOrangeLamp.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
@@ -193,6 +223,12 @@
     <None Update="Assets\iPurpleLamp.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Update="Assets\iStairs.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iStairsR.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Update="Assets\iTreantHeadPlant.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
@@ -205,6 +241,9 @@
     <None Update="Assets\iWhiteLamp.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Update="Assets\iWindowScrapWall.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <None Update="Assets\iYellowLamp.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>