using UnityEngine; using GadgetCore.API; using UnityEngine.SceneManagement; using System.Reflection; using GadgetCore.API.ConfigMenu; using System; using ScrapYard.API; namespace ShipDecorations { [Gadget("ShipDecorations", LoadAfter: new string[] { "ScrapYard" }, Dependencies: new string[] { "ScrapYard" }, LoadPriority: 100)] public class ShipDecorations : Gadget { public const string MOD_VERSION = "1.0"; // 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. public override IGadgetConfigMenu GetConfigMenu() { return null; } protected override void LoadConfig() { Config.Reset(); Config.Save(); } public override string GetModDescription() { return "A mod that adds some more ship decorations."; } protected override void Initialize() { Logger.Log("Ship Decorations v" + Info.Mod.Version); Core.logger = Logger; QualitySettings.antiAliasing = 0; var lightsPlatform = new ShopPlatform("Decorations").Register(); lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableDecoItem("cBed.png", "iBed.png", "Bed"), 1000)); lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableDecoItem("cPlant0Plant.png", "iPlant0Plant.png", "Bush Plant"), 1000)); lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableDecoItem("cTree5Plant.png", "iTree5Plant.png", "Tree Plant"), 1000)); 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("cTitaniumWall.png", "iTitaniumWall.png", "Titaniu Wall"), 10)); ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cTitaniumWindow.png", "iTitaniumWindow.png", "Titaniu 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)); ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cStealWall.png", "iStealWall.png", "Steal Wall"), 10)); ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateWallItem("cStealWindow.png", "iStealWindow.png", "Steal Window"), 10)); ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateBlockItem("cStealBlock.png", "iStealBlock.png", "Steal Block"), 10)); lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableStairsItemL("cStairs.png", "iStairs.png", "Stairs [L]", "StairsL"), 10)); lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreatePlacableStairsItemR("cStairsR.png", "iStairsR.png", "Stairs [R]", "StairsR"), 10)); { // Part Engine Blue var asset = GadgetCoreAPI.LoadAssetBundle("engine"); var engine = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/engineBlue.prefab")); engine.name = "engineBlue"; engine.transform.localScale = new Vector3(2, 2, 2); GadgetCoreAPI.AddCustomResource("prop/ScrapYard/component/engineBlue", engine); } { // Part Engine Yellow var asset = GadgetCoreAPI.LoadAssetBundle("engine"); var engine = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/engineYellow.prefab")); engine.name = "engineYellow"; engine.transform.localScale = new Vector3(2, 2, 2); GadgetCoreAPI.AddCustomResource("prop/ScrapYard/component/engineYellow", engine); } { // Part Engine Red var asset = GadgetCoreAPI.LoadAssetBundle("engine"); var engine = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/engineRed.prefab")); engine.name = "engineRed"; engine.transform.localScale = new Vector3(2, 2, 2); GadgetCoreAPI.AddCustomResource("prop/ScrapYard/component/engineRed", engine); } { // Part Engine Green var asset = GadgetCoreAPI.LoadAssetBundle("engine"); var engine = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/engineGreen.prefab")); engine.name = "engineGreen"; engine.transform.localScale = new Vector3(2, 2, 2); GadgetCoreAPI.AddCustomResource("prop/ScrapYard/component/engineGreen", engine); } foreach (var e in ShopPlatform.DefaultBlocks.GetShopPlatformEntries()) { if (e.ItemID == 2400) { ShopPlatform.DefaultBlocks.RemoveShopPlatformEntry(e); } } ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateEngineItem("cBlueEngineBlock.png", "iBlueEngineBlock.png", "engineBlue", "Plasma Engine", "An engine for a ship.", "BlueEngineBlock"), 10)); ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateEngineItem("cYellowEngineBlock.png", "iYellowEngineBlock.png", "engineYellow", "Differential Engine", "An engine for a ship.", "YellowEngineBlock"), 10)); //ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateOverrideEngineItem("cRedEngineBlock.png", "iRedEngineBlock.png", "engineRed", "Combustion Engine", "An engine for a ship.", "RedEngineBlock"), 10)); ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(ItemUtil.CreateEngineItem("cGreenEngineBlock.png", "iGreenEngineBlock.png", "engineGreen", "Burst Engine", "An engine for a ship.", "GreenEngineBlock"), 10)); SceneManager.sceneLoaded += OnSceneLoaded; } internal static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (scene.buildIndex == 1) { try { var aa = GameObject.Find("Main Camera").GetComponent(); //aa.enabled = true; Component.DestroyImmediate(aa); //var bloom = GameObject.Find("Main Camera").GetComponent(); //Component.DestroyImmediate(bloom); var vig = GameObject.Find("Main Camera").GetComponent(); Component.DestroyImmediate(vig); var noise = GameObject.Find("Main Camera").GetComponent(); Component.DestroyImmediate(noise); var flare = GameObject.Find("Main Camera").GetComponent(); Component.DestroyImmediate(flare); //var camera = GameObject.Find("Main Camera").GetComponent(); //camera.transform.rotation = Quaternion.EulerAngles(0.2f,0.2f,0); //camera.useOcclusionCulling = false; //camera.orthographic = false; //camera.rect = new Rect(0, 0, 1, 1); //camera.fieldOfView = 33; //GameObject.Find("Main Camera").transform.localPosition = new Vector3(0, 0, -50); //for(int i = 0; i < GameObject.Find("Main Camera").transform.GetChildCount(); i++) //{ // GameObject.Find("Main Camera").transform.GetChild(i).transform.localPosition = new Vector3(0, 0, -60); //} } catch (Exception e) { Core.logger.LogConsole(e.Message); } } } } }