1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Gani Aliguzhinov |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #include "core/CoreIncludes.h" |
---|
30 | #include "Actionpoint.h" |
---|
31 | |
---|
32 | namespace orxonox |
---|
33 | { |
---|
34 | RegisterClass(Actionpoint); |
---|
35 | |
---|
36 | Actionpoint::Actionpoint(Context* context) : StaticEntity(context) |
---|
37 | { |
---|
38 | RegisterObject(Actionpoint); |
---|
39 | |
---|
40 | this->actionName_ = ""; |
---|
41 | this->name_ = ""; |
---|
42 | |
---|
43 | this->bLoopStart_ = false; |
---|
44 | this->bLoopEnd_ = false; |
---|
45 | this->bProtectMe_ = false; |
---|
46 | } |
---|
47 | |
---|
48 | void Actionpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
49 | { |
---|
50 | SUPER(Actionpoint, XMLPort, xmlelement, mode); |
---|
51 | |
---|
52 | XMLPortParam(Actionpoint, "action", setActionXML, getActionXML, xmlelement, mode); |
---|
53 | XMLPortParam(Actionpoint, "protect", setProtectXML, getProtectXML, xmlelement, mode); |
---|
54 | XMLPortParam(Actionpoint, "attack", setAttackXML, getAttackXML, xmlelement, mode); |
---|
55 | XMLPortParam(Actionpoint, "protectMe", setProtectMeXML, getProtectMeXML, xmlelement, mode).defaultValues(false); |
---|
56 | XMLPortParam(Actionpoint, "loopStart", setLoopStart, getLoopStart, xmlelement, mode).defaultValues(false); |
---|
57 | XMLPortParam(Actionpoint, "loopEnd", setLoopEnd, getLoopEnd, xmlelement, mode).defaultValues(false); |
---|
58 | } |
---|
59 | /** |
---|
60 | @brief |
---|
61 | action is ATTACK -> returns name of object to attack |
---|
62 | action is PROTECT -> returns name of object to protect |
---|
63 | if asked to protect human, returns a special string. |
---|
64 | @return |
---|
65 | name of an object to interact with. |
---|
66 | @note |
---|
67 | never use more than one of following arguments for XMLPort: |
---|
68 | attack, protect, protectMe or |
---|
69 | loopStart and loopEnd. |
---|
70 | */ |
---|
71 | std::string Actionpoint::getName() const |
---|
72 | { |
---|
73 | if (this->name_ != "") |
---|
74 | { |
---|
75 | return this->name_; |
---|
76 | } |
---|
77 | else if (this->bProtectMe_) |
---|
78 | { |
---|
79 | return "reservedKeyword:human"; |
---|
80 | } |
---|
81 | else |
---|
82 | { |
---|
83 | return ""; |
---|
84 | } |
---|
85 | } |
---|
86 | } |
---|