18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 20:24:59 +01:00

feat: bistable hold coil lever of the line breaker (eu07/maszyna#364)

main_off_bt declared with "type: toggle" in the cab's .mmd is now the
line breaker's hold coil lever of the ET22 and EP09: it stays where it is
put. Off, it opens the line breaker and keeps it from closing (also
cancelling a closing armed by a held main_on_bt); back on, it only feeds
the coil again. The single keyboard key puts the lever back on before
closing, and a line breaker closed by the AI or through the control
cable puts the lever back on to match.

TGauge now remembers whether type: was given, since every control
defaults to toggle. Without type: on main_off_bt (all vehicles today)
nothing changes.

Data (SVN, not part of this commit): add "type: toggle" to main_off_bt:
in dynamic/pkp/et22_v3/*.mmd and dynamic/pkp/ep09_v1, ep09_v2/*.mmd.
Older exes ignore it.
This commit is contained in:
jerrrrycho
2026-11-07 18:10:59 +01:00
parent 939e42b611
commit d7c66fa7bc
5 changed files with 112 additions and 2 deletions

View File

@@ -58,6 +58,9 @@ public:
// returns offset of submodel associated with the button from the model centre
glm::vec3 model_offset() const;
TGaugeType type() const;
// whether the definition of the control declared its type, rather than left it at the default
bool type_declared() const {
return m_typedeclared; }
inline
bool is_push() const {
return ( static_cast<int>( type() ) & static_cast<int>( TGaugeType::push ) ) != 0; }
@@ -87,6 +90,7 @@ private:
// members
TGaugeAnimation m_animation { TGaugeAnimation::gt_Unknown }; // typ ruchu
TGaugeType m_type { TGaugeType::toggle }; // switch type
bool m_typedeclared { false }; // the type was given with type: in the definition
float m_friction { 0.f }; // hamowanie przy zliżaniu się do zadanej wartości
float m_targetvalue { 0.f }; // wartość docelowa
float m_value { 0.f }; // wartość obecna