diff --git a/data/raw/keybindings.json b/data/raw/keybindings.json index 1ed0059e35e8c..8230af1f6bd95 100644 --- a/data/raw/keybindings.json +++ b/data/raw/keybindings.json @@ -2948,6 +2948,12 @@ "category": "DEFAULTMODE", "id": "toggle_crouch" }, + { + "type": "keybinding", + "name": "Toggle prone", + "category": "DEFAULTMODE", + "id": "toggle_prone" + }, { "type": "keybinding", "name": "Movement mode menu", diff --git a/src/action.cpp b/src/action.cpp index ce22a71664090..943ecb2727a6d 100644 --- a/src/action.cpp +++ b/src/action.cpp @@ -169,6 +169,8 @@ std::string action_ident( action_id act ) return "toggle_run"; case ACTION_TOGGLE_CROUCH: return "toggle_crouch"; + case ACTION_TOGGLE_PRONE: + return "toggle_prone"; case ACTION_OPEN_MOVEMENT: return "open_movement"; case ACTION_OPEN: @@ -777,6 +779,10 @@ action_id handle_action_menu() if( player_character.is_crouching() ) { action_weightings[ACTION_TOGGLE_CROUCH] = 300; } + // If we're already prone, make it simple to toggle prone to off. + if( player_character.is_prone() ) { + action_weightings[ACTION_TOGGLE_PRONE] = 300; + } map &here = get_map(); // Check if we're on a vehicle, if so, vehicle controls should be top. @@ -939,6 +945,7 @@ action_id handle_action_menu() REGISTER_ACTION( ACTION_RESET_MOVE ); REGISTER_ACTION( ACTION_TOGGLE_RUN ); REGISTER_ACTION( ACTION_TOGGLE_CROUCH ); + REGISTER_ACTION( ACTION_TOGGLE_PRONE ); REGISTER_ACTION( ACTION_OPEN_MOVEMENT ); REGISTER_ACTION( ACTION_FIRE ); REGISTER_ACTION( ACTION_RELOAD_ITEM ); diff --git a/src/game.cpp b/src/game.cpp index 68f52ff50e214..e77d1da8aea22 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2345,6 +2345,7 @@ input_context get_default_mode_input_context() ctxt.register_action( "reset_move" ); ctxt.register_action( "toggle_run" ); ctxt.register_action( "toggle_crouch" ); + ctxt.register_action( "toggle_prone" ); ctxt.register_action( "open_movement" ); ctxt.register_action( "open" ); ctxt.register_action( "close" ); diff --git a/src/sdltiles.cpp b/src/sdltiles.cpp index e77cbd7a9ae97..e72984146f148 100644 --- a/src/sdltiles.cpp +++ b/src/sdltiles.cpp @@ -2793,6 +2793,10 @@ static void CheckMessages() if( player_character.is_crouching() ) { actions.insert( ACTION_TOGGLE_CROUCH ); } + // If we're already prone, make it simple to toggle prone to off. + if( player_character.is_prone() ) { + actions.insert( ACTION_TOGGLE_PRONE ); + } // We're not already running or in combat, so remove cycle walk/run if( std::find( actions.begin(), actions.end(), ACTION_CYCLE_MOVE ) == actions.end() ) {