From 1bbf4dc40eb6bdd7fbf7c752277518a5ff260a3e Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sat, 9 Dec 2023 12:21:18 +0200 Subject: [PATCH] key mapping to eject units --- Assets/Scripts/Core/options.lua | 1 + activeGameState.cpp | 5 +++-- binds.h | 3 ++- defConfigs.h | 4 ++-- player.cpp | 2 ++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Core/options.lua b/Assets/Scripts/Core/options.lua index 6aacf1a..a6165ec 100644 --- a/Assets/Scripts/Core/options.lua +++ b/Assets/Scripts/Core/options.lua @@ -35,6 +35,7 @@ mappings = { {bind = 31, trigger = 57, action = true, bindType = 0, inOptions = true}, {bind = 32, trigger = 66, action = true, bindType = 0, inOptions = true}, {bind = 33, trigger = 256, action = true, bindType = 0, inOptions = true}, + {bind = 47, trigger = 69, action = true, bindType = 0, inOptions = false}, {bind = 7, trigger = 312, action = false, bindType = 2, inOptions = false}, {bind = 8, trigger = 313, action = false, bindType = 2, inOptions = false}, diff --git a/activeGameState.cpp b/activeGameState.cpp index 591f7b4..8d28ff6 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -273,8 +273,6 @@ namespace battleship{ //TODO fix ejectable unit selection with multiple transports selected void ActiveGameState::issueOrder(Order::TYPE type, vector targets, bool addOrder) { - if(targets.empty()) return; - Vector3 destDir = (selectingDestOrient ? GameObjectFrameController::getSingleton()->getGameObjectFrame(0).getDirVec() : Vector3::VEC_ZERO); mainPlayer->issueOrder(type, destDir, targets, addOrder); this->targets.clear(); @@ -397,6 +395,9 @@ namespace battleship{ if(ufCtr->isPlacingFrames()) ufCtr->setRotatingFrames(isPressed); if (!isPressed) deselectUnits(); break; + case Bind::EJECT_GARRISON: + if(isPressed) issueOrder(Order::TYPE::EJECT, vector{}, shiftPressed); + break; case Bind::TOGGLE_SUB: break; case Bind::ZOOM_IN: diff --git a/binds.h b/binds.h index f7cfa26..ec5ef1b 100644 --- a/binds.h +++ b/binds.h @@ -49,7 +49,8 @@ namespace battleship{ ENABLE_Z_AXIS, CREATE_WATERBODY, GENERATE_WEIGHTS, - TOGGLE_CELL_MARKERS + TOGGLE_CELL_MARKERS, + EJECT_GARRISON }; } diff --git a/defConfigs.h b/defConfigs.h index e0e5f57..ee1c10d 100755 --- a/defConfigs.h +++ b/defConfigs.h @@ -26,9 +26,9 @@ namespace battleship{ const static int numAppStates = 4; const static int numStaticBinds[numAppStates]{6, 0, 5, 19}; - const static int numConfBinds[numAppStates]{0, 1, 22, 0}; + const static int numConfBinds[numAppStates]{0, 1, 23, 0}; const static int maxStaticBinds = 19; - const static int maxConfBinds = 22; + const static int maxConfBinds = 23; const static int numScripts = 5; const static std::string scriptPathBase = "Scripts/"; diff --git a/player.cpp b/player.cpp index 6de183a..d9dfb17 100755 --- a/player.cpp +++ b/player.cpp @@ -56,6 +56,8 @@ namespace battleship{ } void Player::issueOrder(Order::TYPE type, Vector3 destDir, vector targets, bool append){ + if(type != Order::TYPE::EJECT && targets.empty()) return; + vector selectedUnits = getSelectedUnits(); if(type == Order::TYPE::EJECT){