Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.h @ 7015

Last change on this file since 7015 was 6998, checked in by dafrick, 14 years ago

Merged pickup branch into presentation3 branch.
Seems to be working just fine so not much changes at all. (Except for some representations that had the parameters 'name' instead of 'pickupName' and 'description' instead of 'pickupDescription').

  • Property svn:eol-style set to native
File size: 6.2 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            void registerVariables();
53
54            inline bool isAlive() const
55                { return this->bAlive_; }
56
57            virtual void setHealth(float health);
58            inline void addHealth(float health)
59                { this->setHealth(this->health_ + health); }
60            inline void removeHealth(float health)
61                { this->setHealth(this->health_ - health); }
62            inline float getHealth() const
63                { return this->health_; }
64
65            inline void setMaxHealth(float maxhealth)
66                { this->maxHealth_ = maxhealth; this->setHealth(this->health_); }
67            inline float getMaxHealth() const
68                { return this->maxHealth_; }
69
70            inline void setInitialHealth(float initialhealth)
71                { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); }
72            inline float getInitialHealth() const
73                { return this->initialHealth_; }
74
75            inline void setShieldHealth(float shieldHealth)
76            { this->shieldHealth_ = shieldHealth; }
77            inline float getShieldHealth()
78            { return this->shieldHealth_; }
79           
80            inline void setShieldAbsorption(float shieldAbsorption)
81            { this->shieldAbsorption_ = shieldAbsorption; }
82            inline float getShieldAbsorption()
83            { return this->shieldAbsorption_; }
84
85            inline ControllableEntity* getLastHitOriginator() const
86                { return this->lastHitOriginator_; }
87
88            virtual void hit(Pawn* originator, const Vector3& force, float damage);
89            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
90            virtual void kill();
91
92            virtual void fired(unsigned int firemode);
93            virtual void reload();
94            virtual void postSpawn();
95
96            void addWeaponSlot(WeaponSlot * wSlot);
97            WeaponSlot * getWeaponSlot(unsigned int index) const;
98            void addWeaponSet(WeaponSet * wSet);
99            WeaponSet * getWeaponSet(unsigned int index) const;
100            void addWeaponPack(WeaponPack * wPack);
101            void addWeaponPackXML(WeaponPack * wPack);
102            WeaponPack * getWeaponPack(unsigned int index) const;
103
104            inline const WorldEntity* getWorldEntity() const
105                { return const_cast<Pawn*>(this); }
106
107            inline void setSpawnParticleSource(const std::string& source)
108                { this->spawnparticlesource_ = source; }
109            inline const std::string& getSpawnParticleSource() const
110                { return this->spawnparticlesource_; }
111
112            inline void setSpawnParticleDuration(float duration)
113                { this->spawnparticleduration_ = duration; }
114            inline float getSpawnParticleDuration() const
115                { return this->spawnparticleduration_; }
116
117            inline void setExplosionChunks(unsigned int chunks)
118                { this->numexplosionchunks_ = chunks; }
119            inline unsigned int getExplosionChunks() const
120                { return this->numexplosionchunks_; }
121
122            virtual void startLocalHumanControl();
123
124            void setAimPosition( Vector3 position )
125                { this->aimPosition_ = position; }
126            Vector3 getAimPosition()
127                { return this->aimPosition_; }
128               
129            virtual const Vector3& getCarrierPosition(void)
130                { return this->getWorldPosition(); };
131
132        protected:
133            virtual void setPlayer(PlayerInfo* player);
134            virtual void removePlayer();
135
136            virtual void death();
137            virtual void goWithStyle();
138            virtual void deatheffect();
139            virtual void spawneffect();
140
141            virtual void damage(float damage, Pawn* originator = 0);
142
143            bool bAlive_;
144
145            virtual std::vector<PickupCarrier*>* getCarrierChildren(void)
146                { return new std::vector<PickupCarrier*>(); }
147            virtual PickupCarrier* getCarrierParent(void)
148                { return NULL; }
149
150            float health_;
151            float maxHealth_;
152            float initialHealth_;
153            float shieldHealth_;
154            float shieldAbsorption_; // Has to be between 0 and 1
155
156            Pawn* lastHitOriginator_;
157
158            WeaponSystem* weaponSystem_;
159            bool bReload_;
160
161            std::string spawnparticlesource_;
162            float spawnparticleduration_;
163            unsigned int numexplosionchunks_;
164
165        private:
166            inline void setWeaponSystem(WeaponSystem* weaponsystem)
167                { this->weaponSystem_ = weaponsystem; }
168
169            Vector3 aimPosition_;
170    }; // tolua_export
171} // tolua_export
172
173#endif /* _Pawn_H__ */
Note: See TracBrowser for help on using the repository browser.