mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
binds to choose between unit states
This commit is contained in:
@@ -36,6 +36,9 @@ mappings = {
|
||||
{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 = 48, trigger = 84, action = true, bindType = 0, inOptions = false},
|
||||
{bind = 49, trigger = 89, action = true, bindType = 0, inOptions = false},
|
||||
{bind = 50, trigger = 85, 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},
|
||||
|
||||
@@ -323,6 +323,12 @@ namespace battleship{
|
||||
}
|
||||
}
|
||||
|
||||
void ActiveGameState::enableUnitState(Unit::State state){
|
||||
vector<Unit*> selectedUnits = mainPlayer->getSelectedUnits();
|
||||
|
||||
for(Unit *unit : selectedUnits)
|
||||
unit->setState(state);
|
||||
}
|
||||
|
||||
void ActiveGameState::onAction(int bind, bool isPressed) {
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
@@ -416,6 +422,15 @@ namespace battleship{
|
||||
}
|
||||
|
||||
break;
|
||||
case Bind::ENABLE_CHASE_STATE:
|
||||
enableUnitState(Unit::State::CHASE);
|
||||
break;
|
||||
case Bind::ENABLE_STAND_GROUND_STATE:
|
||||
enableUnitState(Unit::State::STAND_GROUND);
|
||||
break;
|
||||
case Bind::ENABLE_HOLD_FIRE_STATE:
|
||||
enableUnitState(Unit::State::HOLD_FIRE);
|
||||
break;
|
||||
case Bind::DESELECT:
|
||||
if(ufCtr->isPlacingFrames()) ufCtr->setRotatingFrames(isPressed);
|
||||
if (!isPressed) deselectUnits();
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace battleship{
|
||||
void castRayToTerrain();
|
||||
void issueOrder(Order::TYPE, std::vector<Order::Target>, bool);
|
||||
bool isInLineOfSight(vb01::Vector3, float, Unit*);
|
||||
void enableUnitState(Unit::State);
|
||||
inline bool canSelectHoveredOnGameObj(){return gameObjHoveredOn && gameObjHoveredOn->isSelectable() && gameObjHoveredOn->getPlayer() == mainPlayer;}
|
||||
|
||||
GuiAppState *guiState;
|
||||
|
||||
@@ -50,7 +50,10 @@ namespace battleship{
|
||||
CREATE_WATERBODY,
|
||||
GENERATE_WEIGHTS,
|
||||
TOGGLE_CELL_MARKERS,
|
||||
EJECT_GARRISON
|
||||
EJECT_GARRISON,
|
||||
ENABLE_CHASE_STATE,
|
||||
ENABLE_STAND_GROUND_STATE,
|
||||
ENABLE_HOLD_FIRE_STATE
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef MAP_LISTBOX_H
|
||||
#define MAP_LISTBOX_H
|
||||
|
||||
#include <listbox.h>
|
||||
|
||||
namespace battleship{
|
||||
class MapListbox : public vb01Gui::Listbox{
|
||||
public:
|
||||
MapListbox(vb01::Vector2, vb01::Vector2, std::vector<std::string>&, int, std::string, bool);
|
||||
private:
|
||||
void onClose();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user