cursors and attack orders only work on visible units

This commit is contained in:
devZoGok
2024-09-15 14:21:24 +03:00
parent dea5cf6e49
commit fff48459fe
3 changed files with 4 additions and 3 deletions
+3 -1
View File
@@ -225,6 +225,8 @@ namespace battleship{
}
bool ActiveGameState::isGameObjSelectable(GameObject *obj, bool useDragBox){
if(!obj->getModel()->isVisible()) return false;
Node *hitboxNode = obj->getHitbox();
Box *hitbox = (Box*)hitboxNode->getMesh(0);
@@ -332,7 +334,7 @@ namespace battleship{
vector<Unit*> selUnits = mainPlayer->getSelectedUnits();
for (Unit *u : units) {
Node *model = u->getNode();
Node *model = u->getModel();
if (u->getPlayer() == mainPlayer){
if(!u->getLosLightNode()) u->initLosLight();
-1
View File
@@ -146,7 +146,6 @@ namespace battleship{
inline int getNumGarrisonSlots(){return garrisonSlots.size();}
inline const std::vector<GarrisonSlot>& getGarrisonSlots(){return garrisonSlots;}
inline float getLineOfSight() {return lineOfSight;}
inline vb01::Model* getNode() {return model;}
inline UnitType getType() {return type;}
inline UnitClass getUnitClass() {return unitClass;}
inline void takeDamage(int damage) {health -= damage;}
+1 -1
View File
@@ -35,7 +35,7 @@ namespace battleship{
void Vehicle::update(){
Unit::update();
model->setVisible(!garrisonable);
if(garrisonable) model->setVisible(false);
}
void Vehicle::halt(){