18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 08:46:00 +01:00
Files
maszyna/vehicle/smoke.h
jerrrrycho d8f3875929 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.
2026-11-07 18:22:42 +01:00

32 lines
1.3 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
class TMoverParameters;
// the smoke of a vehicle's engine, let out by the smoke sources of its model (rendering/particles.h)
namespace smoke {
// what a smoke source spawns, before the engine of its vehicle is taken into account
struct spawn_rate {
float pending{0.f}; // particles left to spawn from the previous updates
float rate{0.f}; // particles per second
float fidelity{1.f}; // multiplier of the smoke settings
float limit{0.f}; // most particles the source can have
};
// number of particles the smoke source of a vehicle has to spawn after Timedelta seconds: the steady rate of the
// source, plus a share which grows with the work of its engine. a vehicle taken off the tracks (Ontracks false: gone through a portal, or waiting in the pool of the road
// traffic) puffs no more, the particles it already let out fade away as usual
// an engine the starter turns but which hasn't fired yet (TMoverParameters::dizel_FiringCountdown) lets out no smoke either
float vehicle_spawn_count(TMoverParameters const &Mover, bool Ontracks, spawn_rate const &Rate, double Timedelta);
} // namespace smoke