mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
(commands) Add alarmchainenable and alarmchaindisable commands
This commit is contained in:
34
Train.cpp
34
Train.cpp
@@ -246,6 +246,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
||||
{ user_command::manualbrakeincrease, &TTrain::OnCommand_manualbrakeincrease },
|
||||
{ user_command::manualbrakedecrease, &TTrain::OnCommand_manualbrakedecrease },
|
||||
{ user_command::alarmchaintoggle, &TTrain::OnCommand_alarmchaintoggle },
|
||||
{ user_command::alarmchainenable, &TTrain::OnCommand_alarmchainenable},
|
||||
{ user_command::alarmchaindisable, &TTrain::OnCommand_alarmchaindisable},
|
||||
{ user_command::wheelspinbrakeactivate, &TTrain::OnCommand_wheelspinbrakeactivate },
|
||||
{ user_command::sandboxactivate, &TTrain::OnCommand_sandboxactivate },
|
||||
{ user_command::autosandboxtoggle, &TTrain::OnCommand_autosandboxtoggle },
|
||||
@@ -1822,20 +1824,36 @@ void TTrain::OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Comm
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
|
||||
if( false == Train->mvOccupied->AlarmChainFlag ) {
|
||||
// pull
|
||||
Train->mvOccupied->AlarmChainSwitch( true );
|
||||
// visual feedback
|
||||
Train->ggAlarmChain.UpdateValue( 1.0 );
|
||||
OnCommand_alarmchainenable(Train, Command);
|
||||
}
|
||||
else {
|
||||
// release
|
||||
Train->mvOccupied->AlarmChainSwitch( false );
|
||||
// visual feedback
|
||||
Train->ggAlarmChain.UpdateValue( 0.0 );
|
||||
OnCommand_alarmchaindisable(Train, Command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_alarmchainenable(TTrain *Train, command_data const &Command)
|
||||
{
|
||||
if (Command.action == GLFW_PRESS) {
|
||||
|
||||
// pull
|
||||
Train->mvOccupied->AlarmChainSwitch(true);
|
||||
// visual feedback
|
||||
Train->ggAlarmChain.UpdateValue(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TTrain::OnCommand_alarmchaindisable(TTrain *Train, command_data const &Command) {
|
||||
if (Command.action == GLFW_PRESS) {
|
||||
|
||||
// release
|
||||
Train->mvOccupied->AlarmChainSwitch(false);
|
||||
// visual feedback
|
||||
Train->ggAlarmChain.UpdateValue(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
||||
|
||||
2
Train.h
2
Train.h
@@ -265,6 +265,8 @@ class TTrain {
|
||||
static void OnCommand_manualbrakeincrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_manualbrakedecrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_alarmchainenable(TTrain *Train, command_data const &Command);
|
||||
static void OnCommand_alarmchaindisable(TTrain *Train, command_data const &Command);
|
||||
static void OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_sandboxactivate( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_autosandboxtoggle(TTrain *Train, command_data const &Command);
|
||||
|
||||
@@ -62,6 +62,8 @@ commanddescription_sequence Commands_descriptions = {
|
||||
{ "manualbrakeincrease", command_target::vehicle, command_mode::oneoff },
|
||||
{ "manualbrakedecrease", command_target::vehicle, command_mode::oneoff },
|
||||
{ "alarmchaintoggle", command_target::vehicle, command_mode::oneoff },
|
||||
{ "alarmchainenable", command_target::vehicle, command_mode::oneoff},
|
||||
{ "alarmchaindisable", command_target::vehicle, command_mode::oneoff},
|
||||
{ "wheelspinbrakeactivate", command_target::vehicle, command_mode::oneoff },
|
||||
{ "sandboxactivate", command_target::vehicle, command_mode::oneoff },
|
||||
{ "autosandboxtoggle", command_target::vehicle, command_mode::oneoff },
|
||||
|
||||
@@ -55,6 +55,8 @@ enum class user_command {
|
||||
manualbrakeincrease,
|
||||
manualbrakedecrease,
|
||||
alarmchaintoggle,
|
||||
alarmchainenable,
|
||||
alarmchaindisable,
|
||||
wheelspinbrakeactivate,
|
||||
sandboxactivate,
|
||||
autosandboxtoggle,
|
||||
|
||||
@@ -64,6 +64,8 @@ driverkeyboard_input::default_bindings() {
|
||||
{ user_command::manualbrakeincrease, GLFW_KEY_KP_1 | keymodifier::control },
|
||||
{ user_command::manualbrakedecrease, GLFW_KEY_KP_7 | keymodifier::control },
|
||||
{ user_command::alarmchaintoggle, GLFW_KEY_B | keymodifier::shift | keymodifier::control },
|
||||
// alarmchainenable,
|
||||
// alarmchaindisable,
|
||||
{ user_command::wheelspinbrakeactivate, GLFW_KEY_KP_ENTER },
|
||||
{ user_command::sandboxactivate, GLFW_KEY_S | keymodifier::shift },
|
||||
// autosandboxtoggle,
|
||||
|
||||
@@ -550,6 +550,12 @@ drivermouse_input::default_bindings() {
|
||||
{ "alarmchain:", {
|
||||
user_command::alarmchaintoggle,
|
||||
user_command::none } },
|
||||
{ "alarmchainon:", {
|
||||
user_command::alarmchainenable,
|
||||
user_command::none} },
|
||||
{ "alarmchainoff:", {
|
||||
user_command::alarmchainenable,
|
||||
user_command::none} },
|
||||
{ "brakeprofile_sw:", {
|
||||
user_command::brakeactingspeedincrease,
|
||||
user_command::brakeactingspeeddecrease } },
|
||||
|
||||
@@ -434,6 +434,12 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
|
||||
{ "alarmchain:", {
|
||||
user_command::alarmchaintoggle,
|
||||
user_command::none } },
|
||||
{ "alarmchainon:", {
|
||||
user_command::alarmchainenable,
|
||||
user_command::none} },
|
||||
{ "alarmchainoff:", {
|
||||
user_command::alarmchainenable,
|
||||
user_command::none} },
|
||||
{ "brakeprofile_sw:", {
|
||||
user_command::brakeactingspeedincrease,
|
||||
user_command::brakeactingspeeddecrease } },
|
||||
@@ -942,4 +948,3 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
|
||||
};
|
||||
|
||||
bool vr_openvr::backend_register = vr_interface_factory::get_instance()->register_backend("openvr", vr_openvr::create_func);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user