using GadgetCore.API; using UnityEngine; namespace Subworlds { [Gadget("SubworldShip", LoadAfter: new string[] { "RecipeMenuCore", "SubworldCore" }, Dependencies: new string[] { "RecipeMenuCore", "SubworldCore" })] public partial class SubworldsGadget : Gadget { protected override void LoadConfig() { Config.Load(); string fileVersion = Config.ReadString("ConfigVersion", CoreGadget.CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)"); if (fileVersion != CoreGadget.CONFIG_VERSION) { Config.Reset(); Config.WriteString("ConfigVersion", CoreGadget.CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)"); } Config.Save(); } public override string GetModDescription() { return "A mod that adds ships that can be reaided."; } protected override void Initialize() { Logger.Log("Subworlds v" + Info.Mod.Version); Core.logger = Logger; Texture2D texturePlanetIcon = GadgetCoreAPI.LoadTexture2D("Ship/icon.png"); Texture2D texturePlanetPrevIcon = GadgetCoreAPI.LoadTexture2D("Ship/button.png"); Texture2D texturePortalSign = GadgetCoreAPI.LoadTexture2D("Ship/sign.png"); AudioClip audioShip = GadgetCoreAPI.LoadAudioClip("01_space.ogg"); Core.shipPlanet = new PlanetInfo(PlanetType.SPECIAL, "Subworld Ship", new GadgetCore.Util.Tuple[] { new GadgetCore.Util.Tuple(1, 100) }, audioShip); var planet = Core.shipPlanet; planet.SetPortalInfo(texturePortalSign, texturePlanetPrevIcon, texturePlanetIcon); planet.OnGenerateWorld += ShipGenerator.GenarateTown; planet.OnGenerateTown += ShipGenerator.Genarate; planet.Register("SubworldShip"); planet.PortalUses = -1; // Create World Parts CreateShipPart("ShipAEntrance", GadgetCoreAPI.LoadTexture2D("Ship/shipAEntranceFG.png"), GadgetCoreAPI.LoadTexture2D("Ship/shipAEntranceBG.png"), new int[][] { new int[] { 11, 5, 5, 1} , new int[] { 11, 5, 1, 6} , new int[] { 11, 10, 5, 1} }, new int[][] { }, 16, 16); CreateShipPart("ShipAMain", GadgetCoreAPI.LoadTexture2D("Ship/shipAMainFG.png"), GadgetCoreAPI.LoadTexture2D("Ship/shipAMainBG.png"), new int[][] { new int[] { 0, 0, 32, 1} , new int[] { 0, 15, 32, 1} , new int[] { 0, 0, 1, 6} , new int[] { 31, 0, 1, 6} , new int[] { 0, 10, 1, 6} , new int[] { 31, 10, 1, 6} , new int[] { 3, 5, 4, 1} , new int[] { 9, 5, 4, 1} , new int[] { 19, 5, 4, 1} , new int[] { 25, 5, 4, 1} , new int[] { 3, 10, 4, 1} , new int[] { 9, 10, 4, 1} , new int[] { 19, 10, 4, 1} , new int[] { 25, 10, 4, 1} }, new int[][] { new int[] { 3, 7, 0 } , new int[] { 6, 7, 1 } , new int[] { 25, 7, 1 } , new int[] { 28, 7, 0 } }); CreateShipPart("ShipAExit", GadgetCoreAPI.LoadTexture2D("Ship/shipAExitFG.png"), GadgetCoreAPI.LoadTexture2D("Ship/shipAExitBG.png"), new int[][] { new int[] { 0, 5, 10, 1} , new int[] { 0, 10, 13, 1} , new int[] { 10, 6, 2, 1} , new int[] { 12, 7, 1, 4} }, new int[][] { new int[] { 5, 7, 0 } }, 16, 16); CreateShipPart("ShuttleMain", GadgetCoreAPI.LoadTexture2D("Ship/shuttleMainFG.png"), GadgetCoreAPI.LoadTexture2D("Ship/shuttleMainBG.png"), new int[][] { new int[] { 3, 5, 10, 1} , new int[] { 3, 10, 11, 1} , new int[] { 3, 5, 1, 5} , new int[] { 13, 6, 1, 1} , new int[] { 14, 7, 1, 3} }, new int[][] { new int[] { 5, 7, 0 } }, 16, 16); // Create Decorations CreateObject("BrokenTeleporter", GadgetCoreAPI.LoadTexture2D("Ship/brokenTeleporter.png"), true); CreateBrakableObject("BrokenPirate1", GadgetCoreAPI.LoadTexture2D("Ship/brokenPirate1.png"), true); CreateBrakableObject("BrokenPirate2", GadgetCoreAPI.LoadTexture2D("Ship/brokenPirate2.png"), true); CreateBrakableObject("BrokenPirate3", GadgetCoreAPI.LoadTexture2D("Ship/brokenPirate3.png"), true); CreateBrakableObject("BrokenPirate4", GadgetCoreAPI.LoadTexture2D("Ship/brokenPirate4.png"), true); CreateBrakableObject("BrokenPirate5", GadgetCoreAPI.LoadTexture2D("Ship/brokenPirate5.png"), true); CreateBrakableObject("BrokenPirate6", GadgetCoreAPI.LoadTexture2D("Ship/brokenPirate6.png"), true); CreateBrakableObject("BrokenCrates1", GadgetCoreAPI.LoadTexture2D("Ship/brokenCrates1.png")); CreateBrakableObject("BrokenCrates2", GadgetCoreAPI.LoadTexture2D("Ship/brokenCrates2.png")); CreateBrakableObject("BrokenCrates3", GadgetCoreAPI.LoadTexture2D("Ship/brokenCrates3.png")); CreateBrakableObject("BrokenCrates4", GadgetCoreAPI.LoadTexture2D("Ship/brokenCrates4.png")); CreateBrakableObject("BrokenItemMod", GadgetCoreAPI.LoadTexture2D("Ship/brokenItemMod.png")); CreateBrakableObject("BrokenChest", GadgetCoreAPI.LoadTexture2D("Ship/brokenChest.png")); // Create Enemies CreateSliverEnemy("BrokenSliver", GadgetCoreAPI.LoadTexture2D("Ship/brokenSliverHead.png"), GadgetCoreAPI.LoadTexture2D("Ship/brokenSliverBody.png"), GadgetCoreAPI.LoadTexture2D("Ship/brokenSliverTail.png")); CreateDroidEnemy("BrokenDroid", GadgetCoreAPI.LoadTexture2D("Ship/droid.png")); // Create Hazards CreateLaserHazard("LaserHazard", GadgetCoreAPI.LoadTexture2D("Ship/brokenLaser.png")); CreateOldChest("OldChest", GadgetCoreAPI.LoadTexture2D("Ship/oldChest.png")); } } }