18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 17:54:58 +01:00

fix(gfx): diesel smoke only once the engine fires, not while the starter turns (eu07/maszyna#523)

The smoke of a diesel came out at full strength the moment its ignition
set Mains and started the spin up, together with the ignition sound, whose
first part is the starter cranking the engine.

The ignition now starts a countdown of the new optional .fiz parameter
SmokeDelay (Engine section of DieselEngine and DieselElectric vehicles,
seconds, default 2.0, 0 restores the old behaviour); the smoke source of
the vehicle spawns nothing until it runs out. Engines already running, or
switched on another way, smoke as before. No SVN data change is needed;
vehicle authors may tune SmokeDelay to the cranking part of their
ignition: sample.
This commit is contained in:
jerrrrycho
2026-11-07 18:22:42 +01:00
parent 939e42b611
commit d8f3875929
5 changed files with 81 additions and 1 deletions

View File

@@ -2171,6 +2171,10 @@ class TMoverParameters
bool dizel_startup{false}; // engine startup procedure request indicator
bool dizel_ignition{false}; // engine ignition request indicator
bool dizel_spinup{false}; // engine spin up to idle speed flag
// the starter turns the engine a while before it fires: smoke comes out only after SmokeDelay (the Engine section of the .fiz,
// seconds from the start of the spin up) has passed. 0 lets it out as soon as the starter turns, as before eu07/maszyna#523
double dizel_SmokeDelay{2.0};
double dizel_FiringCountdown{0.0}; // seconds left until the engine being started fires, 0 once it runs on its own
double dizel_engagedeltaomega = 0.0; /*roznica predkosci katowych tarcz sprzegla*/
double dizel_n_old = 0.0; /*poredkosc na potrzeby obliczen sprzegiel*/
double dizel_Torque = 0.0; /*aktualny moment obrotowy silnika spalinowego*/

View File

@@ -7843,6 +7843,9 @@ bool TMoverParameters::dizel_Update(double dt)
WaterHeaterCheck(dt);
OilPumpCheck(dt);
FuelPumpCheck(dt);
// the engine being started fires once the starter has turned it a while; one stopped meanwhile starts over
dizel_FiringCountdown = (Mains ? std::max(0.0, dizel_FiringCountdown - dt) : 0.0);
if (true == dizel_startup && true == dizel_StartupCheck())
{
dizel_ignition = true;
@@ -7857,6 +7860,7 @@ bool TMoverParameters::dizel_Update(double dt)
LastSwitchingTime = 0;
Mains = true;
dizel_spinup = true;
dizel_FiringCountdown = dizel_SmokeDelay;
enrot = std::max(enrot,
0.35 * ( // TODO: dac zaleznie od temperatury i baterii
EngineType == TEngineType::DieselEngine ? dizel_nmin : DElist[0].RPM / 60.0));
@@ -11365,6 +11369,9 @@ void TMoverParameters::LoadFIZ_Engine(std::string const &Input)
// oil pump
extract_value(OilPump.pressure_minimum, "OilMinPressure", Input, "");
extract_value(OilPump.pressure_maximum, "OilMaxPressure", Input, "");
// the time the starter turns the engine before it fires and smokes (eu07/maszyna#523)
extract_value(dizel_SmokeDelay, "SmokeDelay", Input, "");
dizel_SmokeDelay = std::max(0.0, dizel_SmokeDelay);
// engine cooling factore
extract_value(dizel_heat.kw, "HeatKW", Input, "");
extract_value(dizel_heat.kv, "HeatKV", Input, "");