Orxonox  0.0.5 Codename: Arcturus
ModularSpaceShip.h
Go to the documentation of this file.
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  * Noe Pedrazzini
26  *
27  */
28 
29 #ifndef _ModularSpaceShip_H__
30 #define _ModularSpaceShip_H__
31 
32 #include "OrxonoxPrereqs.h"
33 
34 #include <string>
35 #include <LinearMath/btVector3.h>
36 
37 #include "tools/Timer.h"
38 #include "util/Math.h"
39 #include "util/OrxAssert.h"
40 
41 #include "SpaceShip.h"
42 #include "items/ShipPart.h"
43 #include <map>
44 
45 namespace orxonox
46 {
47 
101  {
102  public:
103  ModularSpaceShip(Context* context);
104  virtual ~ModularSpaceShip();
105 
106  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
107 
108  void addPartEntityAssignment(StaticEntity* entity, ShipPart* part);
109  ShipPart* getPartOfEntity(StaticEntity* entity) const;
110 
111  virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = nullptr, const btCollisionShape* cs = nullptr);
112 
113  static void killShipPartStatic(std::string name);
114  void killShipPart(std::string name);
115 
116  void addShipPart(ShipPart* part);
117  ShipPart* getShipPart(unsigned int index);
118  ShipPart* getShipPartByName(std::string name);
119  bool hasShipPart(ShipPart* part) const;
120  void removeShipPart(ShipPart* part);
121 
122  inline void setRotationThrust(float val)
123  { this->rotationThrust_ = val; }
124  inline float getRotationThrust()
125  { return this->rotationThrust_; }
126 
127  virtual void updatePartAssignment();
128 
129  protected:
130 
131 
132  private:
133  void registerVariables();
134  std::vector<ShipPart*> partList_; // The list of all Parts mounted on this ModularSpaceShip.
135  std::map<StaticEntity*, ShipPart*> partMap_; // Map of Part-Entity-assignments
136  static std::map<StaticEntity*, ShipPart*>* partMap_s;
137 
138  };
139 }
140 
141 #endif /* _ModularSpaceShip_H__ */
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
The SpaceShip is the principal entity through which the player interacts with the game...
Definition: ModularSpaceShip.h:100
The StaticEntity is the simplest derivative of the orxonox::WorldEntity class.
Definition: StaticEntity.h:50
::std::string string
Definition: gtest-port.h:756
static std::map< StaticEntity *, ShipPart * > * partMap_s
Definition: ModularSpaceShip.h:136
Definition: ShipPart.h:41
std::map< StaticEntity *, ShipPart * > partMap_
Definition: ModularSpaceShip.h:135
void setRotationThrust(float val)
Definition: ModularSpaceShip.h:122
xmlelement
Definition: Super.h:519
The SpaceShip is the principal entity through which the player interacts with the game...
Definition: SpaceShip.h:90
Declaration and implementation of several math-functions, typedefs of some Ogre::Math classes to the ...
Declaration of the Timer class, used to call functions after a given time-interval.
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Mode
Definition: CorePrereqs.h:102
Shared library macros, enums, constants and forward declarations for the orxonox library ...
Definition: Context.h:45
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
std::vector< ShipPart * > partList_
Definition: ModularSpaceShip.h:134
float getRotationThrust()
Definition: ModularSpaceShip.h:124
Declaration of custom assertion facilities