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 | * Fabian 'x3n' Landau |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _Pawn_H__ |
---|
30 | #define _Pawn_H__ |
---|
31 | |
---|
32 | #include "OrxonoxPrereqs.h" |
---|
33 | |
---|
34 | #include <string> |
---|
35 | #include "interfaces/PickupCarrier.h" |
---|
36 | #include "interfaces/RadarViewable.h" |
---|
37 | #include "worldentities/ControllableEntity.h" |
---|
38 | |
---|
39 | namespace orxonox // tolua_export |
---|
40 | { // tolua_export |
---|
41 | class _OrxonoxExport Pawn // tolua_export |
---|
42 | : public ControllableEntity, public RadarViewable, public PickupCarrier |
---|
43 | { // tolua_export |
---|
44 | friend class WeaponSystem; |
---|
45 | |
---|
46 | public: |
---|
47 | Pawn(BaseObject* creator); |
---|
48 | virtual ~Pawn(); |
---|
49 | |
---|
50 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
51 | virtual void tick(float dt); |
---|
52 | |
---|
53 | inline bool isAlive() const |
---|
54 | { return this->bAlive_; } |
---|
55 | |
---|
56 | ///////////////////////////////// me |
---|
57 | virtual void setReloadRate(float reloadrate); |
---|
58 | inline float getReloadRate() const |
---|
59 | { return this->reloadRate_; } |
---|
60 | |
---|
61 | inline void addShieldHealth(float amount) |
---|
62 | { this->setShieldHealth(this->shieldHealth_ + amount); } |
---|
63 | |
---|
64 | inline bool hasShield() |
---|
65 | { return (this->getShieldHealth() > 0); } |
---|
66 | |
---|
67 | virtual void setReloadWaitTime(float reloadwaittime); |
---|
68 | inline float getReloadWaitTime() const |
---|
69 | { return this->reloadWaitTime_; } |
---|
70 | |
---|
71 | inline void resetReloadCountdown() |
---|
72 | { this->reloadWaitCountdown_ = 0; } |
---|
73 | |
---|
74 | inline void startReloadCountdown() |
---|
75 | { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } //in projectile.cc einbauen!!!!!!1111!!111! |
---|
76 | |
---|
77 | virtual void decreaseReloadCountdownTime(float dt); |
---|
78 | |
---|
79 | virtual void setMaxShieldHealth(float maxshieldhealth); |
---|
80 | inline float getMaxShieldHealth() const |
---|
81 | { return this->maxShieldHealth_; } |
---|
82 | |
---|
83 | inline void setInitialShieldHealth(float initialshieldhealth) |
---|
84 | { this->initialShieldHealth_ = initialshieldhealth; this->setShieldHealth(initialshieldhealth); } |
---|
85 | inline float getInitialShieldHealth() const |
---|
86 | { return this->initialShieldHealth_; } |
---|
87 | |
---|
88 | inline void restoreInitialShieldHealth() |
---|
89 | { this->setShieldHealth(this->initialShieldHealth_); } |
---|
90 | inline void restoreMaxShieldHealth() |
---|
91 | { this->setShieldHealth(this->maxShieldHealth_); } |
---|
92 | |
---|
93 | |
---|
94 | ///////////////////////////////// end me |
---|
95 | |
---|
96 | virtual void setHealth(float health); |
---|
97 | inline void addHealth(float health) |
---|
98 | { this->setHealth(this->health_ + health); } |
---|
99 | inline void removeHealth(float health) |
---|
100 | { this->setHealth(this->health_ - health); } |
---|
101 | inline float getHealth() const |
---|
102 | { return this->health_; } |
---|
103 | |
---|
104 | inline void setMaxHealth(float maxhealth) |
---|
105 | { this->maxHealth_ = maxhealth; this->setHealth(this->health_); } |
---|
106 | inline float getMaxHealth() const |
---|
107 | { return this->maxHealth_; } |
---|
108 | |
---|
109 | inline void setInitialHealth(float initialhealth) |
---|
110 | { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); } |
---|
111 | inline float getInitialHealth() const |
---|
112 | { return this->initialHealth_; } |
---|
113 | |
---|
114 | virtual void setShieldHealth(float shieldHealth); |
---|
115 | |
---|
116 | inline float getShieldHealth() |
---|
117 | { return this->shieldHealth_; } |
---|
118 | |
---|
119 | inline void setShieldAbsorption(float shieldAbsorption) |
---|
120 | { this->shieldAbsorption_ = shieldAbsorption; } |
---|
121 | inline float getShieldAbsorption() |
---|
122 | { return this->shieldAbsorption_; } |
---|
123 | |
---|
124 | inline ControllableEntity* getLastHitOriginator() const |
---|
125 | { return this->lastHitOriginator_; } |
---|
126 | |
---|
127 | virtual void hit(Pawn* originator, const Vector3& force, float damage); |
---|
128 | virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage); |
---|
129 | /////////me |
---|
130 | virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage); |
---|
131 | virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage); |
---|
132 | ////////end me |
---|
133 | virtual void kill(); |
---|
134 | |
---|
135 | virtual void fired(unsigned int firemode); |
---|
136 | virtual void reload(); |
---|
137 | virtual void postSpawn(); |
---|
138 | |
---|
139 | void addWeaponSlot(WeaponSlot * wSlot); |
---|
140 | WeaponSlot * getWeaponSlot(unsigned int index) const; |
---|
141 | void addWeaponSet(WeaponSet * wSet); |
---|
142 | WeaponSet * getWeaponSet(unsigned int index) const; |
---|
143 | void addWeaponPack(WeaponPack * wPack); |
---|
144 | void addWeaponPackXML(WeaponPack * wPack); |
---|
145 | WeaponPack * getWeaponPack(unsigned int index) const; |
---|
146 | |
---|
147 | virtual void addedWeaponPack(WeaponPack* wPack) {} |
---|
148 | |
---|
149 | inline const WorldEntity* getWorldEntity() const |
---|
150 | { return const_cast<Pawn*>(this); } |
---|
151 | |
---|
152 | inline void setSpawnParticleSource(const std::string& source) |
---|
153 | { this->spawnparticlesource_ = source; } |
---|
154 | inline const std::string& getSpawnParticleSource() const |
---|
155 | { return this->spawnparticlesource_; } |
---|
156 | |
---|
157 | inline void setSpawnParticleDuration(float duration) |
---|
158 | { this->spawnparticleduration_ = duration; } |
---|
159 | inline float getSpawnParticleDuration() const |
---|
160 | { return this->spawnparticleduration_; } |
---|
161 | |
---|
162 | inline void setExplosionChunks(unsigned int chunks) |
---|
163 | { this->numexplosionchunks_ = chunks; } |
---|
164 | inline unsigned int getExplosionChunks() const |
---|
165 | { return this->numexplosionchunks_; } |
---|
166 | |
---|
167 | virtual void startLocalHumanControl(); |
---|
168 | |
---|
169 | void setAimPosition( Vector3 position ) |
---|
170 | { this->aimPosition_ = position; } |
---|
171 | Vector3 getAimPosition() |
---|
172 | { return this->aimPosition_; } |
---|
173 | |
---|
174 | virtual const Vector3& getCarrierPosition(void) const |
---|
175 | { return this->getWorldPosition(); }; |
---|
176 | |
---|
177 | protected: |
---|
178 | virtual void preDestroy(); |
---|
179 | |
---|
180 | virtual void setPlayer(PlayerInfo* player); |
---|
181 | virtual void removePlayer(); |
---|
182 | |
---|
183 | virtual void death(); |
---|
184 | virtual void goWithStyle(); |
---|
185 | virtual void deatheffect(); |
---|
186 | virtual void spawneffect(); |
---|
187 | |
---|
188 | virtual void damage(float damage, Pawn* originator = 0); |
---|
189 | //////////me |
---|
190 | virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator); |
---|
191 | /////////end me |
---|
192 | |
---|
193 | bool bAlive_; |
---|
194 | |
---|
195 | virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const |
---|
196 | { return new std::vector<PickupCarrier*>(); } |
---|
197 | virtual PickupCarrier* getCarrierParent(void) const |
---|
198 | { return NULL; } |
---|
199 | |
---|
200 | /////////////////////////// me |
---|
201 | float reloadRate_; |
---|
202 | float reloadWaitTime_; |
---|
203 | float reloadWaitCountdown_; |
---|
204 | |
---|
205 | float maxShieldHealth_; |
---|
206 | float initialShieldHealth_; |
---|
207 | |
---|
208 | ////////////////////////// end me |
---|
209 | |
---|
210 | float health_; |
---|
211 | float maxHealth_; |
---|
212 | float initialHealth_; |
---|
213 | float shieldHealth_; |
---|
214 | float shieldAbsorption_; // Has to be between 0 and 1 |
---|
215 | |
---|
216 | WeakPtr<Pawn> lastHitOriginator_; |
---|
217 | |
---|
218 | WeaponSystem* weaponSystem_; |
---|
219 | bool bReload_; |
---|
220 | |
---|
221 | std::string spawnparticlesource_; |
---|
222 | float spawnparticleduration_; |
---|
223 | unsigned int numexplosionchunks_; |
---|
224 | |
---|
225 | private: |
---|
226 | void registerVariables(); |
---|
227 | inline void setWeaponSystem(WeaponSystem* weaponsystem) |
---|
228 | { this->weaponSystem_ = weaponsystem; } |
---|
229 | |
---|
230 | Vector3 aimPosition_; |
---|
231 | }; // tolua_export |
---|
232 | } // tolua_export |
---|
233 | |
---|
234 | #endif /* _Pawn_H__ */ |
---|