public static PLManeuverThruster CreateManeuverThruster(int Subtype, int level) { PLManeuverThruster InManeuverThruster; if (Subtype >= Instance.VanillaManeuverThrusterMaxType) { InManeuverThruster = new PLManeuverThruster(EManeuverThrusterType.E_MAX, level); int subtypeformodded = Subtype - Instance.VanillaManeuverThrusterMaxType; if (subtypeformodded <= Instance.ManeuverThrusterTypes.Count && subtypeformodded > -1) { ManeuverThrusterMod ManeuverThrusterType = Instance.ManeuverThrusterTypes[Subtype - Instance.VanillaManeuverThrusterMaxType]; InManeuverThruster.SubType = Subtype; InManeuverThruster.Name = ManeuverThrusterType.Name; InManeuverThruster.Desc = ManeuverThrusterType.Description; InManeuverThruster.m_IconTexture = ManeuverThrusterType.IconTexture; InManeuverThruster.m_MaxOutput = ManeuverThrusterType.MaxOutput; InManeuverThruster.m_BaseMaxPower = ManeuverThrusterType.MaxPowerUsage_Watts; InManeuverThruster.m_MarketPrice = ManeuverThrusterType.MarketPrice; InManeuverThruster.CargoVisualPrefabID = ManeuverThrusterType.CargoVisualID; InManeuverThruster.CanBeDroppedOnShipDeath = ManeuverThrusterType.CanBeDroppedOnShipDeath; InManeuverThruster.Experimental = ManeuverThrusterType.Experimental; InManeuverThruster.Unstable = ManeuverThrusterType.Unstable; InManeuverThruster.Contraband = ManeuverThrusterType.Contraband; InManeuverThruster.UpdateMaxPowerWatts(); InManeuverThruster.Price_LevelMultiplierExponent = ManeuverThrusterType.Price_LevelMultiplierExponent; } } else { InManeuverThruster = new PLManeuverThruster((EManeuverThrusterType)Subtype, level); } return(InManeuverThruster); }
ManeuverThrusterModManager() { VanillaManeuverThrusterMaxType = Enum.GetValues(typeof(EManeuverThrusterType)).Length; Logger.Info($"MaxTypeint = {VanillaManeuverThrusterMaxType - 1}"); foreach (PulsarMod mod in ModManager.Instance.GetAllMods()) { Assembly asm = mod.GetType().Assembly; Type ManeuverThrusterMod = typeof(ManeuverThrusterMod); foreach (Type t in asm.GetTypes()) { if (ManeuverThrusterMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract) { Logger.Info("Loading ManeuverThruster from assembly"); ManeuverThrusterMod ManeuverThrusterModHandler = (ManeuverThrusterMod)Activator.CreateInstance(t); if (GetManeuverThrusterIDFromName(ManeuverThrusterModHandler.Name) == -1) { ManeuverThrusterTypes.Add(ManeuverThrusterModHandler); Logger.Info($"Added ManeuverThruster: '{ManeuverThrusterModHandler.Name}' with ID '{GetManeuverThrusterIDFromName(ManeuverThrusterModHandler.Name)}'"); } else { Logger.Info($"Could not add ManeuverThruster from {mod.Name} with the duplicate name of '{ManeuverThrusterModHandler.Name}'"); } } } } }