public static PLHull CreateHull(int Subtype, int level) { PLHull InHull; if (Subtype >= Instance.VanillaHullMaxType) { InHull = new PLHull(EHullType.E_MAX, level); int subtypeformodded = Subtype - Instance.VanillaHullMaxType; if (subtypeformodded <= Instance.HullTypes.Count && subtypeformodded > -1) { HullMod HullType = Instance.HullTypes[Subtype - Instance.VanillaHullMaxType]; InHull.SubType = Subtype; InHull.Name = HullType.Name; InHull.Desc = HullType.Description; InHull.m_IconTexture = HullType.IconTexture; InHull.Max = HullType.HullMax; InHull.Armor = HullType.Armor; InHull.Defense = HullType.Defense; InHull.m_MarketPrice = HullType.MarketPrice; InHull.CargoVisualPrefabID = HullType.CargoVisualID; InHull.CanBeDroppedOnShipDeath = HullType.CanBeDroppedOnShipDeath; InHull.Experimental = HullType.Experimental; InHull.Unstable = HullType.Unstable; InHull.Contraband = HullType.Contraband; InHull.Price_LevelMultiplierExponent = HullType.Price_LevelMultiplierExponent; InHull.Max *= 2f; InHull.Current = InHull.Max; } } else { InHull = new PLHull((EHullType)Subtype, level); } return(InHull); }
HullModManager() { VanillaHullMaxType = Enum.GetValues(typeof(EHullType)).Length; Logger.Info($"MaxTypeint = {VanillaHullMaxType - 1}"); foreach (PulsarMod mod in ModManager.Instance.GetAllMods()) { Assembly asm = mod.GetType().Assembly; Type HullMod = typeof(HullMod); foreach (Type t in asm.GetTypes()) { if (HullMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract) { Logger.Info("Loading Hull from assembly"); HullMod HullModHandler = (HullMod)Activator.CreateInstance(t); if (GetHullIDFromName(HullModHandler.Name) == -1) { HullTypes.Add(HullModHandler); Logger.Info($"Added Hull: '{HullModHandler.Name}' with ID '{GetHullIDFromName(HullModHandler.Name)}'"); } else { Logger.Info($"Could not add Hull from {mod.Name} with the duplicate name of '{HullModHandler.Name}'"); } } } } }