Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds engine controls to electronic controls & tweaks portable generator #2633

Merged
merged 6 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/json/vehicles/utility.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
{ "x": 1, "y": 0, "part": "frame_cover" },
{ "x": 1, "y": 0, "part": "tank_small", "fuel": "gasoline" },
{ "x": 1, "y": 0, "part": "stowboard_vertical" },
{ "x": 1, "y": 0, "part": "controls" },
{ "x": 1, "y": 0, "part": "controls_electronic" },
{ "x": 1, "y": 0, "parts": [ "wheel_mount_light", "wheel_small" ] }
],
"items": [
Expand Down
16 changes: 16 additions & 0 deletions src/vehicle_use.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,22 @@ void vehicle::control_electronics()

set_electronics_menu_options( options, actions );

if( has_part( "ENGINE" ) ) {
options.emplace_back( engine_on ? _( "Turn off the engine" ) : _( "Turn on the engine" ),
keybind( "TOGGLE_ENGINE" ) );
actions.push_back( [&] {
if( engine_on )
{
engine_on = false;
stop_engines();
} else
{
start_engines();
valid_option = false;
}
refresh();
} );
}
uilist menu;
menu.text = _( "Electronics controls" );
menu.entries = options;
Expand Down