|
|
@@ -11,7 +11,7 @@ namespace ScrapYard
|
|
|
[Gadget("ScrapYard", RequiredOnClients: true, GadgetVersionSpecificity: VersionSpecificity.NONBREAKING)]
|
|
|
public class ScrapYard : Gadget<ScrapYard>
|
|
|
{
|
|
|
- public const string MOD_VERSION = "1.6.1"; // Set this to the version of your mod.
|
|
|
+ public const string MOD_VERSION = "1.7.1"; // Set this to the version of your mod.
|
|
|
public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
|
|
|
|
|
|
protected override void LoadConfig()
|
|
|
@@ -46,9 +46,9 @@ namespace ScrapYard
|
|
|
if (itemID == -1)
|
|
|
throw new System.Exception("Could not register item " + "Scrap Trophy");
|
|
|
|
|
|
+ var assetStand = GadgetCoreAPI.LoadAssetBundle("scrapyardstand");
|
|
|
{ // Shop Stand
|
|
|
- var asset = GadgetCoreAPI.LoadAssetBundle("scrapyardstand");
|
|
|
- scrapYardStand = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/scrapyardstand.prefab"));
|
|
|
+ scrapYardStand = UnityEngine.Object.Instantiate((GameObject)assetStand.LoadAsset("assets/resources/scrapyardstand.prefab"));
|
|
|
scrapYardStand.SetActive(false);
|
|
|
scrapYardStand.AddComponent<ScrapYardShopStandScript>();
|
|
|
scrapYardStand.name = "scrapyardstand";
|
|
|
@@ -73,6 +73,32 @@ namespace ScrapYard
|
|
|
tile.OnInteract += OnInteractStand;
|
|
|
}
|
|
|
|
|
|
+ { // Shop Stand Chip
|
|
|
+ var scrapYardStand = UnityEngine.Object.Instantiate((GameObject)assetStand.LoadAsset("assets/resources/scrapyardstand.prefab"));
|
|
|
+ scrapYardStand.SetActive(false);
|
|
|
+ scrapYardStand.AddComponent<ScrapYardShopStandChipScript>();
|
|
|
+ scrapYardStand.name = "scrapyardstandchip";
|
|
|
+
|
|
|
+ scrapYardStand.transform.GetChild(0).GetComponent<Renderer>().material = new Material(Shader.Find("Unlit/Transparent"))
|
|
|
+ {
|
|
|
+ mainTexture = GadgetCoreAPI.LoadTexture2D("scrapYardStandChip.png")
|
|
|
+ };
|
|
|
+
|
|
|
+ scrapYardStand.transform.GetChild(2).GetComponent<Renderer>().material = new Material(Shader.Find("Unlit/Transparent"))
|
|
|
+ {
|
|
|
+ mainTexture = GadgetCoreAPI.LoadTexture2D("scrapYardStandInfo.png")
|
|
|
+ };
|
|
|
+
|
|
|
+ GadgetCoreAPI.AddCustomResource("prop/ScrapYard/standchip", scrapYardStand);
|
|
|
+
|
|
|
+ ItemInfo tileItem = new ItemInfo(ItemType.GENERIC, "scrapyardstandchip", "Degug item.", null as Texture2D).Register();
|
|
|
+ TileInfo tile = new TileInfo(TileType.INTERACTIVE, null as Texture2D, new GameObject("scrapyardstandchip"), tileItem);
|
|
|
+ int tileID = TileRegistry.Singleton.Register(tile, "scrapyardstandchip");
|
|
|
+ if (tileID == -1)
|
|
|
+ throw new System.Exception("Could not register Tile " + "scrapyardstandchip");
|
|
|
+ tile.OnInteract += OnInteractStand;
|
|
|
+ }
|
|
|
+
|
|
|
ShopPlatform.Reset();
|
|
|
|
|
|
// Setting up default shop platforms
|
|
|
@@ -125,14 +151,30 @@ namespace ScrapYard
|
|
|
for (int i = 0; i < System.Math.Min(objects.Count, 3); i++)
|
|
|
{
|
|
|
var entry = objects[i];
|
|
|
- var stand = (GameObject)Network.Instantiate((GameObject)Resources.Load("prop/ScrapYard/stand"), new Vector3(-250f + 4 * i, -5.99f - 2 + 0.5f, 0.19f), Quaternion.identity, 0);
|
|
|
- stand.GetComponent<ScrapYardShopStandScript>().StartCallSet(entry.ItemID, entry.Price, entry.Quantity, entry.CurrencyItemID);
|
|
|
+ if (entry.EntryType == ShopPlatformEntryType.Item)
|
|
|
+ {
|
|
|
+ var stand = (GameObject)Network.Instantiate((GameObject)Resources.Load("prop/ScrapYard/stand"), new Vector3(-250f + 4 * i, -5.99f - 2 + 0.5f, 0.19f), Quaternion.identity, 0);
|
|
|
+ stand.GetComponent<ScrapYardShopStandScript>().StartCallSet(entry.Id, entry.Price, entry.Quantity, entry.CurrencyItemID);
|
|
|
+ }
|
|
|
+ else if (entry.EntryType == ShopPlatformEntryType.Chip)
|
|
|
+ {
|
|
|
+ var stand = (GameObject)Network.Instantiate((GameObject)Resources.Load("prop/ScrapYard/standchip"), new Vector3(-250f + 4 * i, -5.99f - 2 + 0.5f, 0.19f), Quaternion.identity, 0);
|
|
|
+ stand.GetComponent<ScrapYardShopStandChipScript>().StartCallSet(entry.Id, entry.Price, entry.CurrencyItemID);
|
|
|
+ }
|
|
|
}
|
|
|
for (int i = 0; i < System.Math.Min(blocks.Count, 5); i++)
|
|
|
{
|
|
|
var entry = blocks[i];
|
|
|
- var stand = (GameObject)Network.Instantiate((GameObject)Resources.Load("prop/ScrapYard/stand"), new Vector3(-250f + 4 * 7 + 4 * i, -5.99f + 6 + 0.5f, 0.19f), Quaternion.identity, 0);
|
|
|
- stand.GetComponent<ScrapYardShopStandScript>().StartCallSet(entry.ItemID, entry.Price, entry.Quantity, entry.CurrencyItemID);
|
|
|
+ if (entry.EntryType == ShopPlatformEntryType.Item)
|
|
|
+ {
|
|
|
+ var stand = (GameObject)Network.Instantiate((GameObject)Resources.Load("prop/ScrapYard/stand"), new Vector3(-250f + 4 * 7 + 4 * i, -5.99f + 6 + 0.5f, 0.19f), Quaternion.identity, 0);
|
|
|
+ stand.GetComponent<ScrapYardShopStandScript>().StartCallSet(entry.Id, entry.Price, entry.Quantity, entry.CurrencyItemID);
|
|
|
+ }
|
|
|
+ else if (entry.EntryType == ShopPlatformEntryType.Chip)
|
|
|
+ {
|
|
|
+ var stand = (GameObject)Network.Instantiate((GameObject)Resources.Load("prop/ScrapYard/standchip"), new Vector3(-250f + 4 * 7 + 4 * i, -5.99f + 6 + 0.5f, 0.19f), Quaternion.identity, 0);
|
|
|
+ stand.GetComponent<ScrapYardShopStandChipScript>().StartCallSet(entry.Id, entry.Price, entry.CurrencyItemID);
|
|
|
+ }
|
|
|
}
|
|
|
if (objects.Count > 3 || blocks.Count > 5)
|
|
|
Core.logger.LogWarning("There are more stands than can be added to your ship. U should use the non Lite version of Scrap Yard");
|