using GadgetCore.API; using GadgetCore.Util; using RecipeMenuCore.API; using Subworlds.Scripts; using System.Collections; using UnityEngine; namespace Subworlds { [Gadget("SubworldMeteoroid", LoadAfter: new string[] { "RecipeMenuCore", "SubworldCore" }, Dependencies: new string[] { "RecipeMenuCore", "SubworldCore" })] public partial class MeteroidGadget : 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 "Module that adds meteor fields to explore."; } protected override void Initialize() { Logger.Log("Subworlds v" + Info.Mod.Version); Core.logger = Logger; Texture2D texturePlanetIcon = GadgetCoreAPI.LoadTexture2D("Meteoroid/icon.png"); Texture2D texturePlanetPrevIcon = GadgetCoreAPI.LoadTexture2D("Meteoroid/button.png"); Texture2D texturePortalSign = GadgetCoreAPI.LoadTexture2D("Meteoroid/sign.png"); AudioClip audioShip = GadgetCoreAPI.LoadAudioClip("01_space.ogg"); Core.meteroidPlanet = new PlanetInfo(PlanetType.SPECIAL, "Subworld Meteoroid", new GadgetCore.Util.Tuple[] { new GadgetCore.Util.Tuple(1, 100) }, audioShip); var planet = Core.meteroidPlanet; planet.SetPortalInfo(texturePortalSign, texturePlanetPrevIcon, texturePlanetIcon); planet.OnGenerateWorld += MeteroidGenerator.GenarateTown; planet.OnGenerateTown += MeteroidGenerator.Genarate; planet.Register("SubworldMeteoroid"); planet.PortalUses = 0; // Create World Parts CreateBaseBlock("BaseBlockSmall", GadgetCoreAPI.LoadTexture2D("Meteoroid/meteor3.png"), 0.75f, 0.75f); CreateBaseBlock("BaseBlockNormal", GadgetCoreAPI.LoadTexture2D("Meteoroid/meteor1.png"), 1, 1); CreateBaseBlock("BaseBlockLarge", GadgetCoreAPI.LoadTexture2D("Meteoroid/meteor4.png"), 2, 2); CreateShipPart("MeteorBase", GadgetCoreAPI.LoadTexture2D("Meteoroid/meteorBaseFG.png"), GadgetCoreAPI.LoadTexture2D("Meteoroid/meteorBaseBG.png"), new int[][] { new int[] { 0, 10, 16, 1} , new int[] { 2, 7, 1, 3} , new int[] { 3, 6, 2, 1} , new int[] { 5, 5, 6, 1} , new int[] { 11, 6, 2, 1} , new int[] { 13, 7, 1, 3} }, new int[][] { new int[] { 5, 7, 0 } , new int[] { 10, 7, 0 } }, 16, 16); // Create Breakables CreateBrakableObject("SpaceOre1", GadgetCoreAPI.LoadTexture2D("Meteoroid/spaceOre.png"), itemId: 1); CreateBrakableObject("SpaceOre2", GadgetCoreAPI.LoadTexture2D("Meteoroid/spaceOreBig.png"), itemId: 1); CreateBrakableObject("BrokenMeteor", GadgetCoreAPI.LoadTexture2D("Meteoroid/brokenMeteor.png"), itemId: 1, large: true); // Create Enemies CreateJellyfishEnemy("Jelly", GadgetCoreAPI.LoadTexture2D("Meteoroid/jelly.png"), GadgetCoreAPI.LoadTexture2D("Meteoroid/jellyLegs.png")); } } }