public static PLThruster CreateThruster(int Subtype, int level) { PLThruster InThruster; if (Subtype >= Instance.VanillaThrusterMaxType) { InThruster = new PLThruster(EThrusterType.MAX, level); int subtypeformodded = Subtype - Instance.VanillaThrusterMaxType; if (subtypeformodded <= Instance.ThrusterTypes.Count && subtypeformodded > -1) { ThrusterMod ThrusterType = Instance.ThrusterTypes[Subtype - Instance.VanillaThrusterMaxType]; InThruster.SubType = Subtype; InThruster.Name = ThrusterType.Name; InThruster.Desc = ThrusterType.Description; InThruster.m_IconTexture = ThrusterType.IconTexture; InThruster.m_MaxOutput = ThrusterType.MaxOutput; InThruster.m_BaseMaxPower = ThrusterType.MaxPowerUsage_Watts; InThruster.m_MarketPrice = ThrusterType.MarketPrice; InThruster.CargoVisualPrefabID = ThrusterType.CargoVisualID; InThruster.CanBeDroppedOnShipDeath = ThrusterType.CanBeDroppedOnShipDeath; InThruster.Experimental = ThrusterType.Experimental; InThruster.Unstable = ThrusterType.Unstable; InThruster.Contraband = ThrusterType.Contraband; InThruster.UpdateMaxPowerWatts(); InThruster.Price_LevelMultiplierExponent = ThrusterType.Price_LevelMultiplierExponent; } } else { InThruster = new PLThruster((EThrusterType)Subtype, level); } return(InThruster); }
ThrusterModManager() { VanillaThrusterMaxType = Enum.GetValues(typeof(EThrusterType)).Length; Logger.Info($"MaxTypeint = {VanillaThrusterMaxType - 1}"); foreach (PulsarMod mod in ModManager.Instance.GetAllMods()) { Assembly asm = mod.GetType().Assembly; Type ThrusterMod = typeof(ThrusterMod); foreach (Type t in asm.GetTypes()) { if (ThrusterMod.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract) { Logger.Info("Loading Thruster from assembly"); ThrusterMod ThrusterModHandler = (ThrusterMod)Activator.CreateInstance(t); if (GetThrusterIDFromName(ThrusterModHandler.Name) == -1) { ThrusterTypes.Add(ThrusterModHandler); Logger.Info($"Added Thruster: '{ThrusterModHandler.Name}' with ID '{GetThrusterIDFromName(ThrusterModHandler.Name)}'"); } else { Logger.Info($"Could not add Thruster from {mod.Name} with the duplicate name of '{ThrusterModHandler.Name}'"); } } } } }