static void Postfix(PLReactor __instance) { int subtypeformodded = __instance.SubType - ReactorPluginManager.Instance.VanillaReactorMaxType; if (subtypeformodded > -1 && subtypeformodded < ReactorPluginManager.Instance.ReactorTypes.Count && __instance.ShipStats != null && __instance.ShipStats.ReactorTempMax != 0f) { ReactorPluginManager.Instance.ReactorTypes[subtypeformodded].Tick(__instance); } }
static void Postfix(PLReactor __instance, ref string __result) { int subtypeformodded = __instance.SubType - ReactorModManager.Instance.VanillaReactorMaxType; if (subtypeformodded > -1 && subtypeformodded < ReactorModManager.Instance.ReactorTypes.Count && __instance.ShipStats != null) { __result = ReactorModManager.Instance.ReactorTypes[subtypeformodded].GetStatLineRight(__instance); } }
public override string GetStatLineRight(PLShipComponent InComp) { PLReactor me = InComp as PLReactor; return(string.Concat(new string[] { (me.TempMax * me.LevelMultiplier(0.1f, 1f)).ToString("0"), " kP\n", me.EmergencyCooldownTime.ToString("0.0"), " sec\n", ((float)me.OriginalEnergyOutputMax * me.LevelMultiplier(0.1f, 1f)).ToString("0"), " MW" })); }
public static PLReactor CreateReactor(int Subtype, int level) { PLReactor InReactor; if (Subtype >= Instance.VanillaReactorMaxType) { InReactor = new PLReactor(EReactorType.E_REAC_ID_MAX, level); int subtypeformodded = Subtype - Instance.VanillaReactorMaxType; if (Global.DebugLogging) { Logger.Info($"Subtype for modded is {subtypeformodded}"); } if (subtypeformodded <= Instance.ReactorTypes.Count && subtypeformodded > -1) { if (Global.DebugLogging) { Logger.Info("Creating reactor from list info"); } ReactorPlugin ReactorType = Instance.ReactorTypes[Subtype - Instance.VanillaReactorMaxType]; InReactor.SubType = Subtype; InReactor.Name = ReactorType.Name; InReactor.Desc = ReactorType.Description; InReactor.GetType().GetField("m_IconTexture", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InReactor, ReactorType.IconTexture); InReactor.EnergyOutputMax = ReactorType.EnergyOutputMax; InReactor.EnergySignatureAmt = ReactorType.EnergySignatureAmount; InReactor.TempMax = ReactorType.MaxTemp; InReactor.EmergencyCooldownTime = ReactorType.EmergencyCooldownTime; InReactor.HeatOutput = ReactorType.HeatOutput; InReactor.GetType().GetField("m_MarketPrice", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InReactor, (ObscuredInt)ReactorType.MarketPrice); InReactor.CargoVisualPrefabID = ReactorType.CargoVisualID; InReactor.CanBeDroppedOnShipDeath = ReactorType.CanBeDroppedOnShipDeath; InReactor.Experimental = ReactorType.Experimental; InReactor.Unstable = ReactorType.Unstable; InReactor.Contraband = ReactorType.Contraband; InReactor.GetType().GetField("OriginalEnergyOutputMax", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InReactor, InReactor.EnergyOutputMax); InReactor.GetType().GetField("Price_LevelMultiplierExponent", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(InReactor, (ObscuredFloat)ReactorType.Price_LevelMultiplierExponent); } } else { InReactor = new PLReactor((EReactorType)Subtype, level); } return(InReactor); }
public static PLReactor CreateReactor(int Subtype, int level) { PLReactor InReactor; if (Subtype >= Instance.VanillaReactorMaxType) { InReactor = new PLReactor(EReactorType.E_REAC_ID_MAX, level); int subtypeformodded = Subtype - Instance.VanillaReactorMaxType; if (subtypeformodded <= Instance.ReactorTypes.Count && subtypeformodded > -1) { ReactorMod ReactorType = Instance.ReactorTypes[Subtype - Instance.VanillaReactorMaxType]; InReactor.SubType = Subtype; InReactor.Name = ReactorType.Name; InReactor.Desc = ReactorType.Description; InReactor.m_IconTexture = ReactorType.IconTexture; InReactor.EnergyOutputMax = ReactorType.EnergyOutputMax; InReactor.EnergySignatureAmt = ReactorType.EnergySignatureAmount; InReactor.TempMax = ReactorType.MaxTemp; InReactor.EmergencyCooldownTime = ReactorType.EmergencyCooldownTime; InReactor.HeatOutput = ReactorType.HeatOutput; InReactor.m_MarketPrice = ReactorType.MarketPrice; InReactor.CargoVisualPrefabID = ReactorType.CargoVisualID; InReactor.CanBeDroppedOnShipDeath = ReactorType.CanBeDroppedOnShipDeath; InReactor.Experimental = ReactorType.Experimental; InReactor.Unstable = ReactorType.Unstable; InReactor.Contraband = ReactorType.Contraband; InReactor.OriginalEnergyOutputMax = InReactor.EnergyOutputMax; InReactor.Price_LevelMultiplierExponent = ReactorType.Price_LevelMultiplierExponent; } } else { InReactor = new PLReactor((EReactorType)Subtype, level); } return(InReactor); }
public override void Tick(PLShipComponent InComp) { PLReactor ReactorInstance = InComp as PLReactor; ReactorInstance.EnergyOutputMax = EnergyOutputMax * (1 - Mathf.Clamp(ReactorInstance.ShipStats.ReactorTempCurrent / ReactorInstance.ShipStats.ReactorTempMax, .0f, .95f)); }