/**\brief Updates the AI controlled ship by first calling the Lua function * and then calling Ship::Update() */ void AI::Update( lua_State *L ) { //Update enemies int t; if(enemies.size()>0){ t=ChooseTarget( L ); if(t!=-1){ target=t; RegisterTarget( L, t ); } } if( !this->IsDisabled() ) { this->Decide( L ); } // Now act like a normal ship this->Ship::Update( L ); }
//MI added function for movement int TaskForceClass::DetectOnMove (void) { if (!Engaged() && !(GetUnitMoved()%5)) return 0; return ChooseTarget(); }