[Orxonox-commit 5356] r10019 - in code/branches/modularships: data/levels/templates src/orxonox src/orxonox/items src/orxonox/worldentities/pawns
noep at orxonox.net
noep at orxonox.net
Thu Apr 3 15:45:50 CEST 2014
Author: noep
Date: 2014-04-03 15:45:50 +0200 (Thu, 03 Apr 2014)
New Revision: 10019
Added:
code/branches/modularships/src/orxonox/items/ShipPart.cc
code/branches/modularships/src/orxonox/items/ShipPart.h
Removed:
code/branches/modularships/src/orxonox/ShipPart.cc
code/branches/modularships/src/orxonox/ShipPart.h
Modified:
code/branches/modularships/data/levels/templates/HeavyCruiser.oxt
code/branches/modularships/src/orxonox/CMakeLists.txt
code/branches/modularships/src/orxonox/items/CMakeLists.txt
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
Log:
Continued working on ShipPart and ModularSpaceShip implementation
Modified: code/branches/modularships/data/levels/templates/HeavyCruiser.oxt
===================================================================
--- code/branches/modularships/data/levels/templates/HeavyCruiser.oxt 2014-04-03 12:57:05 UTC (rev 10018)
+++ code/branches/modularships/data/levels/templates/HeavyCruiser.oxt 2014-04-03 13:45:50 UTC (rev 10019)
@@ -50,8 +50,8 @@
</engines>
<parts>
- <ShipPart name="part0" />
- <ShipPart name="part1" />
+ <ShipPart name="frontL" />
+ <ShipPart name="frontR" />
</parts>
<attached>
Modified: code/branches/modularships/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/modularships/src/orxonox/CMakeLists.txt 2014-04-03 12:57:05 UTC (rev 10018)
+++ code/branches/modularships/src/orxonox/CMakeLists.txt 2014-04-03 13:45:50 UTC (rev 10019)
@@ -31,7 +31,6 @@
PawnManager.cc
PlayerManager.cc
Radar.cc
- ShipPart.cc
# Test.cc
BUILD_UNIT SceneBuildUnit.cc
Deleted: code/branches/modularships/src/orxonox/ShipPart.cc
===================================================================
--- code/branches/modularships/src/orxonox/ShipPart.cc 2014-04-03 12:57:05 UTC (rev 10018)
+++ code/branches/modularships/src/orxonox/ShipPart.cc 2014-04-03 13:45:50 UTC (rev 10019)
@@ -1,149 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Noe Pedrazzini
- * Co-authors:
- * ...
- *
- */
-
-#include "ShipPart.h"
-
-#include <algorithm>
-
-#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "core/XMLPort.h"
-#include "network/NetworkFunction.h"
-#include "items/Item.h"
-#include "worldentities/pawns/Pawn.h"
-#include "gametypes/Gametype.h"
-#include "worldentities/pawns/ModularSpaceShip.h"
-
-
-namespace orxonox
-{
- RegisterClass(ShipPart);
-
- ShipPart::ShipPart(Context* context)
- : Item(context)
- {
- RegisterObject(ShipPart);
- }
-
- ShipPart::~ShipPart()
- {
-
- }
-
-
- /**
- @brief
- Add a StaticEntity to the ShipPart.
- @param engine
- A pointer to the StaticEntity to be added.
- */
- void ShipPart::addEntity(StaticEntity* entity)
- {
- OrxAssert(entity != NULL, "The Entity cannot be NULL.");
- this->entityList_.push_back(entity);
- //part->addToSpaceShip(this); //FIXME: (noep) add
- }
-
- /**
- @brief
- Get the i-th StaticEntity of the ShipPart.
- @return
- Returns a pointer to the i-the StaticEntity. NULL if there is no StaticEntity with that index.
- */
- StaticEntity* ShipPart::getEntity(unsigned int index)
- {
- if(this->entityList_.size() >= index)
- return NULL;
- else
- return this->entityList_[index];
- }
-
- void ShipPart::setDamageAbsorption(float value)
- {
- this->damageAbsorption_ = value;
- }
-
- /**
- @brief
- Sets the health of the ShipPart.
- */
- void ShipPart::setHealth(float health)
- {
- this->health_ = health;
- }
-
- /**
- @brief
- Handles a received hit.
- */
- void ShipPart::handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator)
- {
- if (parent_->getGametype() && parent_->getGametype()->allowPawnDamage(parent_, originator))
- {
- if (shielddamage >= parent_->getShieldHealth())
- {
- parent_->setShieldHealth(0);
- this->setHealth(this->health_ - (healthdamage + damage) * this->damageAbsorption_);
- parent_->setHealth(parent_->getHealth() - (healthdamage + damage) * (1 - this->damageAbsorption_));
- }
- else
- {
- parent_->setShieldHealth(parent_->getShieldHealth() - shielddamage);
-
- // remove remaining shieldAbsorpton-Part of damage from shield
- shielddamage = damage * parent_->getShieldAbsorption();
- shielddamage = std::min(parent_->getShieldHealth(),shielddamage);
- parent_->setShieldHealth(parent_->getShieldHealth() - shielddamage);
-
- // set remaining damage to health
- this->setHealth(this->health_ - ((damage - shielddamage) - healthdamage) * this->damageAbsorption_);
- parent_->setHealth(parent_->getHealth() - ((damage - shielddamage) - healthdamage) * (1- this->damageAbsorption_));
- }
- }
- }
-
-
- /**
- @brief
- Adds the ShipPart to the input SpaceShip.
- @param ship
- A pointer to the SpaceShip to which the ShipPart is added.
- */
- /*void ShipPart::addToSpaceShip(ModularSpaceShip* ship)
- {
- this->parent_ = ship;
-
- if (ship)
- {
- this->parentID_ = ship->getObjectID();
- if (!ship->hasShipPart(this))
- ship->addShipPart(this);
- }
- }*/
-
-}
Deleted: code/branches/modularships/src/orxonox/ShipPart.h
===================================================================
--- code/branches/modularships/src/orxonox/ShipPart.h 2014-04-03 12:57:05 UTC (rev 10018)
+++ code/branches/modularships/src/orxonox/ShipPart.h 2014-04-03 13:45:50 UTC (rev 10019)
@@ -1,86 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Noe Pedrazzini
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _ShipPart_H__
-#define _ShipPart_H__
-
-#include "OrxonoxPrereqs.h"
-#include "items/Item.h"
-
-#include <string>
-
-
-namespace orxonox // tolua_export
-{ // tolua_export
- class _OrxonoxExport ShipPart // tolua_export
- : public Item
- { // tolua_export
-
- public:
- ShipPart(Context* context);
- virtual ~ShipPart();
-
- //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
-
- //virtual void attachTo(Pawn* newParent);
- //virtual void detach();
-
- void addEntity(StaticEntity* entity);
- StaticEntity* getEntity(unsigned int index);
-
- virtual void setDamageAbsorption(float value);
- inline float getDamageAbsorption()
- { return this->damageAbsorption_; }
-
- virtual void setHealth(float health);
- inline void addHealth(float health)
- { this->setHealth(this->health_ + health); }
- inline void removeHealth(float health)
- { this->setHealth(this->health_ - health); }
- inline float getHealth() const
- { return this->health_; }
-
- // FIXME: (noep) Why doesn't this work? Works fine in Engine.h
- //void addToSpaceShip(ModularSpaceShip* ship);
-
- protected:
- Pawn* parent_;
- unsigned int parentID_; // Object ID of the SpaceShip the Part is mounted on.
-
- float damageAbsorption_;
- float health_;
-
- private:
- std::vector<StaticEntity*> entityList_; // list of all entities which belong to this part
-
- }; // tolua_export
-} // tolua_export
-
-#endif /* _ShipPart_H__ */
Modified: code/branches/modularships/src/orxonox/items/CMakeLists.txt
===================================================================
--- code/branches/modularships/src/orxonox/items/CMakeLists.txt 2014-04-03 12:57:05 UTC (rev 10018)
+++ code/branches/modularships/src/orxonox/items/CMakeLists.txt 2014-04-03 13:45:50 UTC (rev 10019)
@@ -2,4 +2,5 @@
Item.cc
Engine.cc
MultiStateEngine.cc
+ ShipPart.cc
)
Added: code/branches/modularships/src/orxonox/items/ShipPart.cc
===================================================================
--- code/branches/modularships/src/orxonox/items/ShipPart.cc (rev 0)
+++ code/branches/modularships/src/orxonox/items/ShipPart.cc 2014-04-03 13:45:50 UTC (rev 10019)
@@ -0,0 +1,175 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Noe Pedrazzini
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "ShipPart.h"
+
+#include <algorithm>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "network/NetworkFunction.h"
+#include "Item.h"
+#include "worldentities/pawns/Pawn.h"
+#include "gametypes/Gametype.h"
+#include "worldentities/StaticEntity.h"
+
+
+namespace orxonox
+{
+ RegisterClass(ShipPart);
+
+ ShipPart::ShipPart(Context* context)
+ : Item(context)
+ {
+ RegisterObject(ShipPart);
+ }
+
+ ShipPart::~ShipPart()
+ {
+
+ }
+
+
+ /**
+ @brief
+ Add a StaticEntity to the ShipPart.
+ @param engine
+ A pointer to the StaticEntity to be added.
+ */
+ void ShipPart::addEntity(StaticEntity* entity)
+ {
+ OrxAssert(entity != NULL, "The Entity cannot be NULL.");
+ this->entityList_.push_back(entity);
+ //part->addToSpaceShip(this); //FIXME: (noep) add
+ }
+
+ /**
+ @brief
+ Get the i-th StaticEntity of the ShipPart.
+ @return
+ Returns a pointer to the i-the StaticEntity. NULL if there is no StaticEntity with that index.
+ */
+ StaticEntity* ShipPart::getEntity(unsigned int index)
+ {
+ if(this->entityList_.size() >= index)
+ return NULL;
+ else
+ return this->entityList_[index];
+ }
+
+ /**
+ @brief
+ Check whether the ShipPart has a particular Entity.
+ @param engine
+ A pointer to the Entity to be checked.
+ */
+ bool ShipPart::hasEntity(StaticEntity* entity) const
+ {
+ for(unsigned int i = 0; i < this->entityList_.size(); i++)
+ {
+ if(this->entityList_[i] == entity)
+ return true;
+ }
+ return false;
+ }
+
+ void ShipPart::printEntities()
+ {
+ orxout() << "ShipPart " << this->getName() << " has the following entities assigned:" << endl;
+ for(unsigned int j = 0; j < this->entityList_.size(); j++)
+ {
+ orxout() << " " << this->entityList_[j]->getName() << endl;
+ }
+ }
+
+ void ShipPart::setDamageAbsorption(float value)
+ {
+ this->damageAbsorption_ = value;
+ }
+
+ /**
+ @brief
+ Sets the health of the ShipPart.
+ */
+ void ShipPart::setHealth(float health)
+ {
+ this->health_ = health;
+ }
+
+ /**
+ @brief
+ Handles a received hit.
+ */
+ void ShipPart::handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator)
+ {
+ orxout() << "ShipPart " <<this->getName() << " is handling a hit!" << endl;
+ if (parent_->getGametype() && parent_->getGametype()->allowPawnDamage(parent_, originator))
+ {
+ if (shielddamage >= parent_->getShieldHealth())
+ {
+ parent_->setShieldHealth(0);
+ this->setHealth(this->health_ - (healthdamage + damage) * this->damageAbsorption_);
+ parent_->setHealth(parent_->getHealth() - (healthdamage + damage) * (1 - this->damageAbsorption_));
+ }
+ else
+ {
+ parent_->setShieldHealth(parent_->getShieldHealth() - shielddamage);
+
+ // remove remaining shieldAbsorpton-Part of damage from shield
+ shielddamage = damage * parent_->getShieldAbsorption();
+ shielddamage = std::min(parent_->getShieldHealth(),shielddamage);
+ parent_->setShieldHealth(parent_->getShieldHealth() - shielddamage);
+
+ // set remaining damage to health
+ this->setHealth(this->health_ - ((damage - shielddamage) - healthdamage) * this->damageAbsorption_);
+ parent_->setHealth(parent_->getHealth() - ((damage - shielddamage) - healthdamage) * (1- this->damageAbsorption_));
+ }
+ }
+ }
+
+
+ /**
+ @brief
+ Adds the ShipPart to the input SpaceShip.
+ @param ship
+ A pointer to the SpaceShip to which the ShipPart is added.
+ */
+ /*void ShipPart::addToSpaceShip(ModularSpaceShip* ship)
+ {
+ this->parent_ = ship;
+
+ if (ship)
+ {
+ this->parentID_ = ship->getObjectID();
+ if (!ship->hasShipPart(this))
+ ship->addShipPart(this);
+ }
+ }*/
+
+}
Added: code/branches/modularships/src/orxonox/items/ShipPart.h
===================================================================
--- code/branches/modularships/src/orxonox/items/ShipPart.h (rev 0)
+++ code/branches/modularships/src/orxonox/items/ShipPart.h 2014-04-03 13:45:50 UTC (rev 10019)
@@ -0,0 +1,90 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Noe Pedrazzini
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ShipPart_H__
+#define _ShipPart_H__
+
+#include "OrxonoxPrereqs.h"
+#include "Item.h"
+
+#include <string>
+
+
+namespace orxonox // tolua_export
+{ // tolua_export
+ class _OrxonoxExport ShipPart // tolua_export
+ : public Item
+ { // tolua_export
+
+ public:
+ ShipPart(Context* context);
+ virtual ~ShipPart();
+
+ //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
+
+ //virtual void attachTo(Pawn* newParent);
+ //virtual void detach();
+
+ void addEntity(StaticEntity* entity);
+ StaticEntity* getEntity(unsigned int index);
+ bool hasEntity(StaticEntity* entity) const;
+
+ void printEntities(); // FIXME: (noep) remove debug
+
+ virtual void setDamageAbsorption(float value);
+ inline float getDamageAbsorption()
+ { return this->damageAbsorption_; }
+
+ virtual void setHealth(float health);
+ inline void addHealth(float health)
+ { this->setHealth(this->health_ + health); }
+ inline void removeHealth(float health)
+ { this->setHealth(this->health_ - health); }
+ inline float getHealth() const
+ { return this->health_; }
+
+
+ // FIXME: (noep) Why doesn't this work? Works fine in Engine.h
+ //void addToSpaceShip(ModularSpaceShip* ship);
+
+ protected:
+ Pawn* parent_;
+ unsigned int parentID_; // Object ID of the SpaceShip the Part is mounted on.
+
+ float damageAbsorption_;
+ float health_;
+
+ private:
+ std::vector<StaticEntity*> entityList_; // list of all entities which belong to this part
+
+ }; // tolua_export
+} // tolua_export
+
+#endif /* _ShipPart_H__ */
Modified: code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc 2014-04-03 12:57:05 UTC (rev 10018)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc 2014-04-03 13:45:50 UTC (rev 10019)
@@ -37,7 +37,9 @@
#include "util/Math.h"
#include "gametypes/Gametype.h"
-#include "ShipPart.h"
+#include "items/ShipPart.h"
+#include "worldentities/StaticEntity.h"
+#include <BulletCollision/CollisionShapes/btCollisionShape.h>
@@ -74,24 +76,99 @@
void ModularSpaceShip::updatePartAssignment()
{
+ // iterate through all attached objects
+ for (unsigned int i=0; i < 100; i++)
+ {
+ if (this->getAttachedObject(i) == NULL)
+ break;
+ // iterate through all attached parts
+ for(unsigned int j = 0; j < this->partList_.size(); j++)
+ {
+ // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done).
+ if((this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
+ {
+ this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
+ orxout() << "A matching part-entity-pair with name " << this->partList_[j]->getName() << " was found!" << endl;
+ this->partList_[j]->printEntities(); // FIXME: (noep) remove debug
+ }
+ }
+ }
+ }
+ void ModularSpaceShip::attach(WorldEntity* object)
+ {
+ SpaceShip::attach(object);
+ this->updatePartAssignment();
}
+ void ModularSpaceShip::addPartEntityAssignment(StaticEntity* entity, ShipPart* part)
+ {
+ if (!entity || !part)
+ return;
+
+ if (this->partMap_.find(entity) != this->partMap_.end())
+ {
+ orxout(internal_warning) << "Assigning an Entity to multiple parts is not yet supported." << endl;
+ return;
+ }
+
+ this->partMap_[entity] = part;
+ orxout() << "New entity-part assignment created!" << endl;
+ }
+
+ /**
+ @brief
+ Get the ShipPart an attached entity belongs to.
+ @param entity
+ The entity to be searched.
+ @return
+ Returns a pointer to the ShipPart the entity belongs to.
+ */
+ ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const
+ {
+ for (std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)
+ {
+ if (it->first == entity)
+ return it->second;
+ }
+ return NULL;
+ }
+
//FIXME: (noep) finish
// void ModularSpaceShip::attach
void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
{
orxout() << "Mdamage(): Collision detected on " << this->getRadarName() << ", btCS*: " << cs << endl;
- orxout() << "Attached parts:" << endl;
+ orxout() << "UserPtr of said collisionShape: " << cs->getUserPointer() << endl;
+
+ // List all attached Objects
+ orxout() << " " << this->getName() << " has the following Objects attached:" << endl;
+ for (int i=0; i<10; i++)
+ {
+ if (this->getAttachedObject(i)==NULL)
+ break;
+ orxout() << " " << i << ": " << this->getAttachedObject(i) << " (" << this->getAttachedObject(i)->getName() << ")";
+ orxout() << endl;
+ }
+
+ orxout() << " Attached ShipParts:" << endl;
for(unsigned int i=0; i < this->partList_.size(); i++)
{
orxout() << " " << i << ": " << this->partList_[i] << " (" << this->partList_[i]->getName() << ")" << endl;
}
- int collisionShapeIndex = this->isMyCollisionShape(cs);
- orxout() << collisionShapeIndex << endl;
+ //int collisionShapeIndex = this->isMyCollisionShape(cs);
+ //orxout() << collisionShapeIndex << endl;
+ orxout() << "ShipPart of Entity " << cs->getUserPointer() << ": " << this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) << endl;
+
+ if (this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)
+ this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator);
+ //else
+ // SpaceShip::damage(damage, healthdamage, shielddamage, originator, cs);
+
+ /*
// Applies multiplier given by the DamageBoost Pickup.
if (originator)
damage *= originator->getDamageMultiplier();
@@ -117,7 +194,7 @@
}
this->lastHitOriginator_ = originator;
- }
+ }*/
}
/**
Modified: code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h 2014-04-03 12:57:05 UTC (rev 10018)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h 2014-04-03 13:45:50 UTC (rev 10019)
@@ -39,7 +39,8 @@
#include "util/OrxAssert.h"
#include "SpaceShip.h"
-#include "ShipPart.h"
+#include "items/ShipPart.h"
+#include <map>
namespace orxonox
{
@@ -93,6 +94,11 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void attach(WorldEntity* object);
+
+ void addPartEntityAssignment(StaticEntity* entity, ShipPart* part);
+ ShipPart* getPartOfEntity(StaticEntity* entity) const;
+
virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
void addShipPart(ShipPart* part);
@@ -107,6 +113,7 @@
private:
void registerVariables();
std::vector<ShipPart*> partList_; // The list of all Parts mounted on this ModularSpaceShip.
+ std::map<StaticEntity*, ShipPart*> partMap_;
};
}
Modified: code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h 2014-04-03 12:57:05 UTC (rev 10018)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h 2014-04-03 13:45:50 UTC (rev 10019)
@@ -229,8 +229,8 @@
unsigned int numexplosionchunks_;
virtual int isMyCollisionShape(const btCollisionShape* cs);
- void printBtChildShapes(btCompoundShape* cs, int indent, int subshape);
- void printSpaces(int num);
+ void printBtChildShapes(btCompoundShape* cs, int indent, int subshape); // FIXME: (noep) remove debug
+ void printSpaces(int num); // FIXME: (noep) remove debug
int entityOfCollisionShape(const btCollisionShape* cs);
private:
More information about the Orxonox-commit
mailing list