void CTAAirMoveType::SlowUpdate(void) { if(aircraftState!=AIRCRAFT_LANDED && owner->unitDef->maxFuel>0) owner->currentFuel = max(0.f, owner->currentFuel - (16.f/GAME_SPEED)); if(!reservedPad && aircraftState==AIRCRAFT_FLYING && owner->health<owner->maxHealth*repairBelowHealth){ CAirBaseHandler::LandingPad* lp=airBaseHandler->FindAirBase(owner,8000,owner->unitDef->minAirBasePower); if(lp){ AddDeathDependence(lp); reservedPad=lp; padStatus=0; oldGoalPos=goalPos; } } UpdateMoveRate(); //Update LOS stuff int newmapSquare=ground->GetSquare(owner->pos); if(newmapSquare!=owner->mapSquare){ owner->mapSquare=newmapSquare; float oldlh=owner->losHeight; float h=owner->pos.y-ground->GetApproximateHeight(owner->pos.x,owner->pos.z); owner->losHeight=h+5; loshandler->MoveUnit(owner,false); if(owner->hasRadarCapacity) radarhandler->MoveUnit(owner); owner->losHeight=oldlh; } qf->MovedUnit(owner); owner->isUnderWater=owner->pos.y+owner->model->height<0; }
void CTAAirMoveType::SlowUpdate() { UpdateFuel(); if (!reservedPad && aircraftState == AIRCRAFT_FLYING && owner->health < owner->maxHealth * repairBelowHealth) { CAirBaseHandler::LandingPad* lp = airBaseHandler->FindAirBase(owner, owner->unitDef->minAirBasePower); if (lp) { AddDeathDependence(lp); reservedPad = lp; padStatus = 0; oldGoalPos = goalPos; } } UpdateMoveRate(); // note: NOT AAirMoveType::SlowUpdate AMoveType::SlowUpdate(); }
void CHoverAirMoveType::SlowUpdate() { UpdateFuel(); // HoverAirMoveType aircraft are controlled by AirCAI's, // but only MobileCAI's reserve pads so we need to do // this for ourselves if (reservedPad == NULL && aircraftState == AIRCRAFT_FLYING && WantsRepair()) { CAirBaseHandler::LandingPad* lp = airBaseHandler->FindAirBase(owner, owner->unitDef->minAirBasePower, true); if (lp != NULL) { AAirMoveType::ReservePad(lp); } } UpdateMoveRate(); // note: NOT AAirMoveType::SlowUpdate AMoveType::SlowUpdate(); }
void CHoverAirMoveType::SlowUpdate() { UpdateMoveRate(); // note: NOT AAirMoveType::SlowUpdate AMoveType::SlowUpdate(); }