/* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: * Fabian 'x3n' Landau * Co-authors: * ... * */ #include "Actionpoint.h" #include "core/CoreIncludes.h" #include "core/XMLPort.h" namespace orxonox { RegisterClass(Actionpoint); Actionpoint::Actionpoint(Context* context) : StaticEntity(context) { RegisterObject(Actionpoint); } //usage: // // // , position irrelevant // , position irrelevant // , position relevant: makes ship fly to the position of Actionpoint // // //DivisionController will firstly fight enemy that it will find by name "enemyName", if finds nothing or when beats enemy, //it will protect ship that it will find by name "protectName", when it's dead or if it doesn't find the ship, //it will fly towards "12,34,56" //when it finishes all, it stays at that location. //At all the times it will check if there are enemies near DivisionController, if yes, it will fight them //another usage: // // // , position irrelevant // , position irrelevant // // //DivisionController will protect the first NewHumanController it finds, when it dies or if no controller found, //it will fight closest enemies one after another void Actionpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) { SUPER(Actionpoint, XMLPort, xmlelement, mode); XMLPortParam( Actionpoint, "action", setActionXML, getActionXML, xmlelement, mode ); XMLPortParam( Actionpoint, "protect", setProtectXML, getProtectXML, xmlelement, mode ); XMLPortParam( Actionpoint, "enemy", setEnemyXML, getEnemyXML, xmlelement, mode ); XMLPortParam( Actionpoint, "protectMe", setProtectMeXML, getProtectMeXML, xmlelement, mode ).defaultValues(false); XMLPortParam( Actionpoint, "fightAll", setFightAllXML, getFightAllXML, xmlelement, mode ).defaultValues(false); } void Actionpoint::setActionXML( std::string val) { this->actionName_ = getUppercase( val ); orxout(internal_error) << "action = " << this->actionName_ << endl; } std::string Actionpoint::getActionXML() { return this->actionName_; } void Actionpoint::setProtectXML( std::string val) { this->protectName_ = getUppercase( val ); } std::string Actionpoint::getProtectXML() { return this->protectName_; } void Actionpoint::setEnemyXML( std::string val) { this->enemyName_ = getUppercase( val ); } std::string Actionpoint::getEnemyXML() { return this->enemyName_; } void Actionpoint::setProtect( ControllableEntity* protect) { this->protect_ = protect; } ControllableEntity* Actionpoint::getProtect() { return this->protect_; } void Actionpoint::setEnemy( ControllableEntity* enemy) { this->enemy_ = enemy; } ControllableEntity* Actionpoint::getEnemy() { return this->enemy_; } void Actionpoint::setTargetPosition(const Vector3& target) { this->targetPosition_ = target; } Vector3 Actionpoint::getTargetPosition () { return this->targetPosition_; } }