Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h @ 8184

Last change on this file since 8184 was 8184, checked in by simonmie, 13 years ago

Added maxShieldHealth

  • Property svn:eol-style set to native
File size: 7.5 KB
Line 
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
39namespace 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///////////////////////////////// end me
84
85            virtual void setHealth(float health);
86            inline void addHealth(float health)
87                { this->setHealth(this->health_ + health); }
88            inline void removeHealth(float health)
89                { this->setHealth(this->health_ - health); }
90            inline float getHealth() const
91                { return this->health_; }
92
93            inline void setMaxHealth(float maxhealth)
94                { this->maxHealth_ = maxhealth; this->setHealth(this->health_); }
95            inline float getMaxHealth() const
96                { return this->maxHealth_; }
97
98            inline void setInitialHealth(float initialhealth)
99                { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); }
100            inline float getInitialHealth() const
101                { return this->initialHealth_; }
102
103            virtual void setShieldHealth(float shieldHealth);
104
105            inline float getShieldHealth()
106            { return this->shieldHealth_; }
107
108            inline void setShieldAbsorption(float shieldAbsorption)
109            { this->shieldAbsorption_ = shieldAbsorption; }
110            inline float getShieldAbsorption()
111            { return this->shieldAbsorption_; }
112
113            inline ControllableEntity* getLastHitOriginator() const
114                { return this->lastHitOriginator_; }
115
116            virtual void hit(Pawn* originator, const Vector3& force, float damage);
117            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
118            virtual void kill();
119
120            virtual void fired(unsigned int firemode);
121            virtual void reload();
122            virtual void postSpawn();
123
124            void addWeaponSlot(WeaponSlot * wSlot);
125            WeaponSlot * getWeaponSlot(unsigned int index) const;
126            void addWeaponSet(WeaponSet * wSet);
127            WeaponSet * getWeaponSet(unsigned int index) const;
128            void addWeaponPack(WeaponPack * wPack);
129            void addWeaponPackXML(WeaponPack * wPack);
130            WeaponPack * getWeaponPack(unsigned int index) const;
131
132            virtual void addedWeaponPack(WeaponPack* wPack) {}
133
134            inline const WorldEntity* getWorldEntity() const
135                { return const_cast<Pawn*>(this); }
136
137            inline void setSpawnParticleSource(const std::string& source)
138                { this->spawnparticlesource_ = source; }
139            inline const std::string& getSpawnParticleSource() const
140                { return this->spawnparticlesource_; }
141
142            inline void setSpawnParticleDuration(float duration)
143                { this->spawnparticleduration_ = duration; }
144            inline float getSpawnParticleDuration() const
145                { return this->spawnparticleduration_; }
146
147            inline void setExplosionChunks(unsigned int chunks)
148                { this->numexplosionchunks_ = chunks; }
149            inline unsigned int getExplosionChunks() const
150                { return this->numexplosionchunks_; }
151
152            virtual void startLocalHumanControl();
153
154            void setAimPosition( Vector3 position )
155                { this->aimPosition_ = position; }
156            Vector3 getAimPosition()
157                { return this->aimPosition_; }
158
159            virtual const Vector3& getCarrierPosition(void) const
160                { return this->getWorldPosition(); };
161
162        protected:
163            virtual void preDestroy();
164
165            virtual void setPlayer(PlayerInfo* player);
166            virtual void removePlayer();
167
168            virtual void death();
169            virtual void goWithStyle();
170            virtual void deatheffect();
171            virtual void spawneffect();
172
173            virtual void damage(float damage, Pawn* originator = 0);
174
175            bool bAlive_;
176
177            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
178                { return new std::vector<PickupCarrier*>(); }
179            virtual PickupCarrier* getCarrierParent(void) const
180                { return NULL; }
181
182/////////////////////////// me
183            float reloadRate_;
184            float reloadWaitTime_;
185            float reloadWaitCountdown_;
186
187            float maxShieldHealth_;
188
189////////////////////////// end me
190
191            float health_;
192            float maxHealth_;
193            float initialHealth_;
194            float shieldHealth_;
195            float shieldAbsorption_; // Has to be between 0 and 1
196
197            WeakPtr<Pawn> lastHitOriginator_;
198
199            WeaponSystem* weaponSystem_;
200            bool bReload_;
201
202            std::string spawnparticlesource_;
203            float spawnparticleduration_;
204            unsigned int numexplosionchunks_;
205
206        private:
207            void registerVariables();
208            inline void setWeaponSystem(WeaponSystem* weaponsystem)
209                { this->weaponSystem_ = weaponsystem; }
210
211            Vector3 aimPosition_;
212    }; // tolua_export
213} // tolua_export
214
215#endif /* _Pawn_H__ */
Note: See TracBrowser for help on using the repository browser.