[10019] | 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 | * Noe Pedrazzini |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef _ShipPart_H__ |
---|
| 30 | #define _ShipPart_H__ |
---|
| 31 | |
---|
| 32 | #include "OrxonoxPrereqs.h" |
---|
| 33 | #include "Item.h" |
---|
| 34 | |
---|
| 35 | #include <string> |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | namespace orxonox // tolua_export |
---|
| 39 | { // tolua_export |
---|
| 40 | class _OrxonoxExport ShipPart // tolua_export |
---|
| 41 | : public Item |
---|
| 42 | { // tolua_export |
---|
| 43 | |
---|
| 44 | public: |
---|
| 45 | ShipPart(Context* context); |
---|
| 46 | virtual ~ShipPart(); |
---|
| 47 | |
---|
[10023] | 48 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
[10019] | 49 | |
---|
| 50 | virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator); |
---|
| 51 | |
---|
[10023] | 52 | virtual void death(); |
---|
| 53 | |
---|
[10019] | 54 | //virtual void attachTo(Pawn* newParent); |
---|
| 55 | //virtual void detach(); |
---|
| 56 | |
---|
| 57 | void addEntity(StaticEntity* entity); |
---|
| 58 | StaticEntity* getEntity(unsigned int index); |
---|
| 59 | bool hasEntity(StaticEntity* entity) const; |
---|
| 60 | |
---|
| 61 | void printEntities(); // FIXME: (noep) remove debug |
---|
| 62 | |
---|
| 63 | virtual void setDamageAbsorption(float value); |
---|
| 64 | inline float getDamageAbsorption() |
---|
| 65 | { return this->damageAbsorption_; } |
---|
| 66 | |
---|
[10023] | 67 | void setParent(ModularSpaceShip* ship); |
---|
| 68 | inline ModularSpaceShip* getParent() |
---|
| 69 | { return this->parent_; } |
---|
| 70 | |
---|
[10019] | 71 | virtual void setHealth(float health); |
---|
| 72 | inline void addHealth(float health) |
---|
| 73 | { this->setHealth(this->health_ + health); } |
---|
| 74 | inline void removeHealth(float health) |
---|
| 75 | { this->setHealth(this->health_ - health); } |
---|
| 76 | inline float getHealth() const |
---|
| 77 | { return this->health_; } |
---|
| 78 | |
---|
[10023] | 79 | inline void setMaxHealth(float maxhealth) |
---|
| 80 | { this->maxHealth_ = maxhealth; this->setHealth(this->health_); } |
---|
| 81 | inline float getMaxHealth() const |
---|
| 82 | { return this->maxHealth_; } |
---|
[10019] | 83 | |
---|
[10023] | 84 | inline void setInitialHealth(float initialhealth) |
---|
| 85 | { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); } |
---|
| 86 | inline float getInitialHealth() const |
---|
| 87 | { return this->initialHealth_; } |
---|
| 88 | |
---|
| 89 | |
---|
[10019] | 90 | // FIXME: (noep) Why doesn't this work? Works fine in Engine.h |
---|
| 91 | //void addToSpaceShip(ModularSpaceShip* ship); |
---|
| 92 | |
---|
| 93 | protected: |
---|
[10023] | 94 | ModularSpaceShip* parent_; |
---|
[10019] | 95 | unsigned int parentID_; // Object ID of the SpaceShip the Part is mounted on. |
---|
| 96 | |
---|
| 97 | float damageAbsorption_; |
---|
| 98 | float health_; |
---|
[10023] | 99 | float maxHealth_; |
---|
| 100 | float initialHealth_; |
---|
[10019] | 101 | |
---|
| 102 | private: |
---|
| 103 | std::vector<StaticEntity*> entityList_; // list of all entities which belong to this part |
---|
| 104 | |
---|
| 105 | }; // tolua_export |
---|
| 106 | } // tolua_export |
---|
| 107 | |
---|
| 108 | #endif /* _ShipPart_H__ */ |
---|