|
|
@@ -10,7 +10,7 @@ namespace ScrapYard
|
|
|
[Gadget("ScrapYard")]
|
|
|
public class ScrapYard : Gadget<ScrapYard>
|
|
|
{
|
|
|
- public const string MOD_VERSION = "1.2"; // Set this to the version of your mod.
|
|
|
+ public const string MOD_VERSION = "1.3"; // 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()
|
|
|
@@ -61,8 +61,6 @@ namespace ScrapYard
|
|
|
|
|
|
Texture2D textureScrapTrophy = GadgetCoreAPI.LoadTexture2D("iScrapTrophy.png");
|
|
|
|
|
|
- Logger.Log("Loaded Textures");
|
|
|
-
|
|
|
PlanetInfo scrapYardPlanet = new PlanetInfo(PlanetType.SPECIAL, "Scrap Yard", new GadgetCore.Util.Tuple<int, int>[] { new GadgetCore.Util.Tuple<int, int>(1, 100) });
|
|
|
scrapYardPlanet.SetPortalInfo(texturePortalSign, texturePlanetPrevIcon, texturePlanetIcon);
|
|
|
scrapYardPlanet.SetBackgroundInfo(textureParalex, textureParalex0, textureParalex1, textureParalex2, textureParalex3);
|
|
|
@@ -73,9 +71,12 @@ namespace ScrapYard
|
|
|
|
|
|
scrapYardPlanet.PortalUses = -1;
|
|
|
|
|
|
- Logger.Log("Created Planet");
|
|
|
|
|
|
- new ItemInfo(ItemType.GENERIC, "Scrap Trophy", "A rusty trophy.\nUsed for purchasing\nspecial items.", textureScrapTrophy).Register("Scrap Trophy");
|
|
|
+ ItemInfo item = new ItemInfo(ItemType.GENERIC, "Scrap Trophy", "A rusty trophy.\nUsed for purchasing\nspecial items.", textureScrapTrophy);
|
|
|
+ int itemID = ItemRegistry.Singleton.Register(item, "Scrap Trophy");
|
|
|
+ if (itemID == -1)
|
|
|
+ throw new System.Exception("Could not register item " + "Scrap Trophy");
|
|
|
+
|
|
|
|
|
|
{ // Scrap Yard Bulding
|
|
|
var scrapYardShopBuilding = Object.Instantiate((GameObject)Resources.Load("prop/2501"));
|
|
|
@@ -117,7 +118,11 @@ namespace ScrapYard
|
|
|
Component.DestroyImmediate(scrapYardMerchant.GetComponent<npcTurnScript>());
|
|
|
GadgetCoreAPI.AddCustomResource("prop/ScrapYard/scrapYardMerchant", scrapYardMerchant);
|
|
|
|
|
|
- TileInfo tile = new TileInfo(TileType.INTERACTIVE, null as Texture2D, new GameObject("scrapyardmerchant")).Register("scrapyardmerchant");
|
|
|
+ ItemInfo tileItem = new ItemInfo(ItemType.GENERIC, "scrapyardmerchant", "Degug item.", null as Texture2D).Register();
|
|
|
+ TileInfo tile = new TileInfo(TileType.INTERACTIVE, null as Texture2D, new GameObject("scrapyardmerchant"), tileItem);
|
|
|
+ int tileID = TileRegistry.Singleton.Register(tile, "scrapyardmerchant");
|
|
|
+ if (tileID == -1)
|
|
|
+ throw new System.Exception("Could not register Tile " + "scrapyardmerchant");
|
|
|
tile.OnInteract += OnInteractMerchant;
|
|
|
}
|
|
|
|
|
|
@@ -247,12 +252,14 @@ namespace ScrapYard
|
|
|
mainTexture = GadgetCoreAPI.LoadTexture2D("scrapYardStandInfo.png")
|
|
|
};
|
|
|
|
|
|
- TileInfo tile = new TileInfo(TileType.INTERACTIVE, null as Texture2D, new GameObject("scrapyardstand")).Register("scrapyardstand");
|
|
|
+ ItemInfo tileItem = new ItemInfo(ItemType.GENERIC, "scrapyardstand", "Degug item.", null as Texture2D).Register();
|
|
|
+ TileInfo tile = new TileInfo(TileType.INTERACTIVE, null as Texture2D, new GameObject("scrapyardstand"), tileItem);
|
|
|
+ int tileID = TileRegistry.Singleton.Register(tile, "scrapyardstand");
|
|
|
+ if (tileID == -1)
|
|
|
+ throw new System.Exception("Could not register Tile " + "scrapyardstand");
|
|
|
tile.OnInteract += OnInteractStand;
|
|
|
}
|
|
|
|
|
|
- Logger.Log("Created Prefabes");
|
|
|
-
|
|
|
// Setting up default shop platforms
|
|
|
new ShopPlatform("Default Objects", ShopPlatformSpacingType.Near).Register();
|
|
|
new ShopPlatform("Default Blocks", ShopPlatformSpacingType.Near).Register();
|
|
|
@@ -279,11 +286,8 @@ namespace ScrapYard
|
|
|
|
|
|
ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(2200, 50));
|
|
|
|
|
|
- Logger.Log("Added Default Objects to the Planet");
|
|
|
-
|
|
|
SceneManager.sceneLoaded += OnSceneLoaded;
|
|
|
|
|
|
- Logger.Log("Added Scene Hook");
|
|
|
}
|
|
|
|
|
|
internal static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
|
|
@@ -293,7 +297,6 @@ namespace ScrapYard
|
|
|
try
|
|
|
{
|
|
|
var storageMenu = GameObject.Find("Ship").transform.Find("SHIPPLACES").transform.Find("mech").localPosition = new Vector3(-130f, -5.23f, 0.6f);
|
|
|
- Core.logger.Log("Moved the Mech");
|
|
|
}
|
|
|
catch (System.Exception e) { Core.logger.LogError(e.Message); }
|
|
|
}
|
|
|
@@ -304,15 +307,12 @@ namespace ScrapYard
|
|
|
|
|
|
private IEnumerator OnInteractStand()
|
|
|
{
|
|
|
- Core.logger.Log("Start Interaction Stand");
|
|
|
try
|
|
|
{
|
|
|
PlayerScript.curInteractObj.SendMessage("Request");
|
|
|
- Core.logger.Log("Requested Item");
|
|
|
canInteractField.SetValue(InstanceTracker.PlayerScript, true);
|
|
|
interactingField.SetValue(InstanceTracker.PlayerScript, false);
|
|
|
InstanceTracker.PlayerScript.w.SetActive(true);
|
|
|
- Core.logger.Log("Finished Interaction Stand");
|
|
|
}
|
|
|
catch(System.Exception e)
|
|
|
{
|