private float GetCraftTime() { if (CraftData.GetCraftTime(TechType.Seamoth, out float result)) { return(result); } return(0f); }
public TankType(TechType tank, float baseO2capacity, Sprite sprite = null, bool bUnlockAtStart = false, float speedModifier = 1f) { Logger.Log(Logger.Level.Debug, $"Registering tank TechType.{tank.AsString()}"); if (sprite != null) { this.sprite = sprite; } else { this.sprite = SpriteManager.Get(tank); } string tankName = Language.main.Get(tank); this.BaseO2Capacity = baseO2capacity; this.speedModifier = speedModifier; if (Main.config.bManualRefill) { //new TankCraftHelper(tank).Patch(); this.refillTechType = TechTypeHandler.AddTechType((tank.AsString(false) + "Refill"), tankName + " Refill", "Refilled " + tankName, false); KnownTechHandler.SetAnalysisTechEntry(tank, new TechType[] { this.refillTechType }); SpriteHandler.RegisterSprite(this.refillTechType, this.sprite); var techData = new RecipeData() { craftAmount = 0, Ingredients = new List <Ingredient>() { new Ingredient(tank, 1) } }; techData.LinkedItems.Add(tank); CraftDataHandler.SetTechData(this.refillTechType, techData); CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, this.refillTechType, new string[] { "Personal", "TankRefill" }); #if SUBNAUTICA_STABLE if (CraftData.GetCraftTime(tank, out float craftTime)) #elif BELOWZERO if (TechData.GetCraftTime(tank, out float craftTime)) #endif { Logger.Log(Logger.Level.Debug, $"Setting crafting time of {craftTime} for TechType.{this.refillTechType.AsString()}"); CraftDataHandler.SetCraftingTime(this.refillTechType, craftTime); } else { Logger.Log(Logger.Level.Debug, $"Couldn't find crafting time for TechType.{tank}"); } if (!Main.bannedTech.Contains(this.refillTechType)) { Main.bannedTech.Add(this.refillTechType); } if (bUnlockAtStart) { KnownTechHandler.UnlockOnStart(this.refillTechType); } } else { this.refillTechType = TechType.None; } }
public static void Patch() { bundle = AssetBundle.LoadFromFile(Path.Combine(Environment.CurrentDirectory, "QMods/5H-4RK Submersible/shark")); sharkTech = TechTypeHandler.AddTechType("Shark", "5H-4RK Submersible", "An ancient alien vessel designed to mimic local fauna"); SpriteHandler.RegisterSprite(sharkTech, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/Shark_Icon.png"); SharkPrefab prefab = new SharkPrefab("Shark", "WorldEntities/Vehicles/Shark", sharkTech); PrefabHandler.RegisterPrefab(prefab); TechType ingotTech; if (!TechTypeHandler.TryGetModdedTechType("PrecursorIngot", out ingotTech)) { throw new Exception("SHARK TRIED LOADING BUT PRECURSOR FABRICATOR NOT FOUND"); } TechData data = new TechData(); data.craftAmount = 1; data.Ingredients = new List <Ingredient>() { new Ingredient(TechType.AdvancedWiringKit, 1), new Ingredient(TechType.Magnetite, 3), new Ingredient(TechType.PrecursorKey_Purple, 1), new Ingredient(TechType.PrecursorIonCrystal, 1), new Ingredient(ingotTech, 3) }; CraftTreeHandler.AddCraftingNode(CraftTree.Type.Constructor, sharkTech, "Vehicles"); CraftDataHandler.SetTechData(sharkTech, data); CraftData.GetCraftTime(TechType.Seamoth, out float time); CraftDataHandler.SetCraftingTime(sharkTech, time); SpriteHandler.RegisterSprite(SpriteManager.Group.Pings, "SharkPing", Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/SharkPing_Icon.png"); HarmonyInstance harm = HarmonyInstance.Create("Kylinator25.SharkSub"); harm.PatchAll(Assembly.GetExecutingAssembly()); Shark.laserTechType = TechTypeHandler.AddTechType("SharkLaserCannon", "5H-4RK Ranged Combat Module", "Equips the vessel with mid to long range combat capabilities."); CraftDataHandler.SetEquipmentType(Shark.laserTechType, (EquipmentType)sharkTech); CraftDataHandler.SetQuickSlotType(Shark.laserTechType, QuickSlotType.Passive); PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkLaserCannon", "WorldEntities/Upgrades/SharkLaserCannon", Shark.laserTechType)); Shark.ramTechType = TechTypeHandler.AddTechType("SharkBatteringRam", "5H-4RK Momentum-Based Combat Module", "Equips the vessel with hardlight blades to lacerate prey at high velocity"); CraftDataHandler.SetEquipmentType(Shark.ramTechType, (EquipmentType)sharkTech); CraftDataHandler.SetQuickSlotType(Shark.ramTechType, QuickSlotType.Passive); PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkBatteringRam", "WorldEntities/Upgrades/SharkBatteringRam", Shark.ramTechType)); Shark.visionTechType = TechTypeHandler.AddTechType("SharkVision", "5H-4RK Precursor Vision Module", "Allows the vessel's pilot to visualise potential targets through obstructive media"); CraftDataHandler.SetEquipmentType(Shark.visionTechType, (EquipmentType)sharkTech); CraftDataHandler.SetQuickSlotType(Shark.visionTechType, QuickSlotType.Selectable); SpriteHandler.RegisterSprite(Shark.visionTechType, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/SharkVision_Icon.png"); PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkVision", "WorldEntities/Upgrades/SharkVision", Shark.visionTechType)); Shark.shieldTechType = TechTypeHandler.AddTechType("SharkShield", "5H-4RK External Defense Module", "Projects a light energy shield around the submersible, which must recharge once depleted"); CraftDataHandler.SetEquipmentType(Shark.shieldTechType, (EquipmentType)sharkTech); CraftDataHandler.SetQuickSlotType(Shark.shieldTechType, QuickSlotType.Selectable); PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkShield", "WorldEntities/Upgrades/SharkShield", Shark.shieldTechType)); Shark.blinkTechType = TechTypeHandler.AddTechType("SharkBlink", "5H-4RK Warp Evasion Module", "Uses warper technology to rapidly move the submersible in any direction"); CraftDataHandler.SetEquipmentType(Shark.blinkTechType, (EquipmentType)sharkTech); CraftDataHandler.SetQuickSlotType(Shark.blinkTechType, QuickSlotType.Selectable); SpriteHandler.RegisterSprite(Shark.blinkTechType, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/SharkBlink_Icon.png"); PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkBlink", "WorldEntities/Upgrades/SharkBlink", Shark.blinkTechType)); Shark.drillTechType = TechTypeHandler.AddTechType("SharkDrill", "5H-4RK Resource Acquisition Module", "Uses a steady beam of focused light to collect resources"); CraftDataHandler.SetEquipmentType(Shark.drillTechType, (EquipmentType)sharkTech); CraftDataHandler.SetQuickSlotType(Shark.drillTechType, QuickSlotType.Selectable); SpriteHandler.RegisterSprite(Shark.drillTechType, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/SharkDrill_Icon.png"); PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkDrill", "WorldEntities/Upgrades/SharkDrill", Shark.drillTechType)); Shark.internalBattery = TechTypeHandler.AddTechType("SharkBattery_Internal", "battery baybee", "you shouldn't be holding this item"); PrefabHandler.RegisterPrefab(new SharkBatteryPrefab("SharkBattery_Internal", "WorldEntities/Batteris/SharkBattery", Shark.internalBattery)); Shark.depletedIonCube = TechTypeHandler.AddTechType("IonCubeEmpty", "Depleted Ion Cube", "This Ion Cube has gone dark, depleted of energy"); SpriteHandler.RegisterSprite(Shark.depletedIonCube, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/DepletedCrystal_Icon.png"); PrefabHandler.RegisterPrefab(new DepletedCrystalPrefab("IonCubeEmpty", "WorldEntites/Doodads/EmptyIonCube", Shark.depletedIonCube)); Shark.ionFragment = TechTypeHandler.AddTechType("IonFragment", "Ion Cube Fragment", "A chunk of a depleted ion cube, suitable for advanced electronics fabrication"); TechData fragmentData = new TechData(); fragmentData.craftAmount = 3; fragmentData.Ingredients = new List <Ingredient>() { new Ingredient(Shark.depletedIonCube, 1), }; CraftDataHandler.SetTechData(Shark.ionFragment, fragmentData); Shark.sharkEngine = TechTypeHandler.AddTechType("SharkEngine", "5H-4RK Engine", "This converter is specially designed to convert energy from Ion Cubes directly into underwater thrust"); Shark.sharkComputer = TechTypeHandler.AddTechType("SharkComputer", "5H-4RK Internal Computer Systems", "This alien processor seems to be built to " + "manage several submersible-related subroutines"); Shark.sharkHull = TechTypeHandler.AddTechType("SharkHull", "5H-4RK Hull Plating", "Alien metal that is designed to be very slightly flexible and " + "lightweight, to allow for maneuverability while maintaining integrity under extreme pressure"); seeThroughMat = bundle.LoadAsset <Material>("Assets/Materials/Shark/wallvision.mat"); }