// ReSharper disable once InconsistentNaming static void Postfix(SteamLocoSimulation __instance) { if (Main.Enabled) { Main.Stoker.SimulateTick(__instance); } }
static void Postfix(SteamLocoSimulation __instance, float deltaTime) { if (__instance.temperature.value >= 100.0f && (__instance.boilerWater.value > 0.01f && __instance.boilerPressure.value < __instance.boilerPressure.max * 0.999f)) { var waterRemoved = 0.200000002980232f * __instance.temperature.value * deltaTime * 0.5f; __instance.boilerWater.AddNextValue(waterRemoved); } }
static void Postfix(SteamLocoSimulation __instance, float deltaTime) { if (__instance.fireOn.value > 0.01f && __instance.coalbox.value > 0.01f) { __instance.coalbox.AddNextValue(__instance.coalConsumptionRate * deltaTime * 0.666f); } if (__instance.fireOn.value > 0.99f && __instance.coalbox.value > 0.01f) { __instance.temperature.AddNextValue((650.0f * (__instance.coalbox.value / 350.0f) - __instance.temperature.value / 16.0f) * deltaTime * -0.3f); } }
public void SimulateTick(SteamLocoSimulation locoSim) { if (_turningOff) { // reset injector to 0 locoSim.injector.SetNextValue(0f); locoSim.injector.SetValue(0f); _turningOff = false; } if (_mode == StokerMode.Off || locoSim == null || locoSim.fireOn.value <= 0.01f) { return; } float steamPressure = locoSim.boilerPressure.value; float coalLevel = locoSim.coalbox.value; float waterLevel = locoSim.boilerWater.value; if ( coalLevel == 0 && // For some reason, these values are populated with real data only steamPressure == 0 && // once every 3 ticks. If they're these values above, waterLevel == 14400 // one of those magical skipped ticks. Do nothing. ) { return; } // add coal if level is too low // only add a shovel every n seconds if (coalLevel < _coalTarget && _timeTilNextShovel <= 0) { locoSim.AddCoalChunk(); _timeTilNextShovel = ShovelWaitTime; } var injectorSetting = CalculateInjectorSetting(waterLevel); locoSim.injector.SetNextValue(injectorSetting); locoSim.injector.SetValue(injectorSetting); }
static void Postfix(SteamLocoSimulation __instance) { // Target values for water, coal, steam // const float steamTarget = 9; // Not used right now but who knows, maybe I'll automate everything const float waterTarget = 15000; const float coalTarget = 54; // Max deviations. Larger numbers will mean more fluctuation in the boiler. const float waterDiff = 750; float steamPressure = __instance.boilerPressure.value; float coalLevel = __instance.coalbox.value; float waterLevel = __instance.boilerWater.value; if ( coalLevel == 0 && // For some reason, these values are populated with real data only steamPressure == 0 && // once every 3 ticks. If they're the values above, then this is waterLevel == 14400 // one of those magical skipped ticks. Do nothing. ) { return; } // Keep coal topped up if (coalLevel <= coalTarget) { __instance.AddCoalChunk(); } // Make sure the boiler has water in it if (Math.Abs(waterLevel - waterTarget) > waterDiff) { float newValue = (waterLevel < waterTarget) ? 1.0f : 0.0f; __instance.injector.SetValue(newValue); } }
static bool Prefix(SteamLocoSimulation __instance) { cutoffProvider.SetValue(__instance.GetComponent <TrainCar>(), __instance.cutoff.value); return(true); }
public static bool Prefix(SteamLocoSimulation __instance) { cutoffProvider.SetValue(TrainCar.Resolve(__instance.gameObject), __instance.cutoff.value); return(true); }
static void Postfix(SteamLocoSimulation __instance) { __instance.maxCoalConsumptionRate *= 0.333f; }
static void Prefix(SteamLocoSimulation __instance) { __instance.speed = new SimComponent("Speed", 0.0f, 150f, 1f, 0.0f); }