Bring back hasler and door lock tweaks

This commit is contained in:
2025-01-07 14:13:54 +01:00
parent 290eacb49f
commit d3260b1e01
3 changed files with 19 additions and 8 deletions

View File

@@ -971,6 +971,7 @@ class TMoverParameters
std::array<basic_door, 2> instances; // door on the right and left side of the vehicle
// ld outputs
bool is_locked{false};
double doorLockSpeed = 10.0; // predkosc przy ktorej wyzwalana jest blokada drzwi
};
struct water_heater
@@ -1415,6 +1416,7 @@ class TMoverParameters
#endif
double MirrorMaxShift{90.0};
double MirrorVelClose{5.0};
double maxTachoSpeed = 0.0; // maksymalna predkosc na tarczce predkosciomierza analogowego
bool MirrorForbidden{false}; /*czy jest pozwolenie na otworzenie lusterek (przycisk)*/
bool ScndS = false; /*Czy jest bocznikowanie na szeregowej*/
bool SpeedCtrl = false; /*czy jest tempomat*/

View File

@@ -8615,10 +8615,7 @@ TMoverParameters::update_doors( double const Deltatime ) {
|| ( Doors.close_control == control_t::conductor )
|| ( Doors.close_control == control_t::mixed ) };
Doors.is_locked =
( true == Doors.has_lock )
&& ( true == Doors.lock_enabled )
&& ( Vel >= 10.0 );
Doors.is_locked = (true == Doors.has_lock) && (true == Doors.lock_enabled) && (Vel >= Doors.doorLockSpeed);
for( auto &door : Doors.instances ) {
// revoke permit if...
@@ -10319,6 +10316,7 @@ void TMoverParameters::LoadFIZ_Doors( std::string const &line ) {
extract_value( Doors.has_warning, "DoorClosureWarning", line, "" );
extract_value( Doors.has_autowarning, "DoorClosureWarningAuto", line, "" );
extract_value( Doors.has_lock, "DoorBlocked", line, "" );
extract_value(Doors.doorLockSpeed, "DoorLockSpeed", line, "");
{
auto const remotedoorcontrol {
@@ -10567,6 +10565,10 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
}
// mbrake
extract_value( MBrake, "ManualBrake", line, "" );
// maksymalna predkosc dostepna na tarczce predkosciomierza
extract_value(maxTachoSpeed, "MaxTachoSpeed", line, "");
// dynamicbrake
{
std::map<std::string, int> dynamicbrakes{

View File

@@ -7005,16 +7005,23 @@ bool TTrain::Update( double const Deltatime )
// McZapkie: predkosc wyswietlana na tachometrze brana jest z obrotow kol
auto const maxtacho { 3.0 };
double maxSpeed = mvControlled->Vmax * 1.05; // zachowanie starej logiki jak nie ma definicji max tarczki
if (mvOccupied->maxTachoSpeed != 0)
{
maxSpeed = mvOccupied->maxTachoSpeed;
}
fTachoVelocity = static_cast<float>(std::min(std::abs(11.31 * mvControlled->WheelDiameter * mvControlled->nrot), maxSpeed));
fTachoVelocity = static_cast<float>( std::min( std::abs(11.31 * mvControlled->WheelDiameter * mvControlled->nrot), mvControlled->Vmax * 1.05) );
{ // skacze osobna zmienna
float ff = simulation::Time.data().wSecond; // skacze co sekunde - pol sekundy
// pomiar, pol sekundy ustawienie
if (ff != fTachoTimer) // jesli w tej sekundzie nie zmienial
{
if (fTachoVelocity > 1) // jedzie
fTachoVelocityJump = fTachoVelocity + (2.0 - LocalRandom(3) + LocalRandom(3)) * 0.5;
else
fTachoVelocityJump = 0; // stoi
if (fTachoVelocity >= 5) // jedzie
fTachoVelocityJump = fTachoVelocity + (2.0 - LocalRandom(3) + LocalRandom(3)) * 0.5;
else if (fTachoVelocity < 5 && fTachoVelocity > 1)
fTachoVelocityJump = Random(0, 4); // tu ma sie bujac jak wariat i zatrzymac na jakiejs predkosci
// fTachoVelocityJump = 0; // stoi
fTachoTimer = ff; // juz zmienil
}
}