Index: code/branches/modularships/src/orxonox/items/ShipPart.cc
===================================================================
--- code/branches/modularships/src/orxonox/items/ShipPart.cc	(revision 10019)
+++ code/branches/modularships/src/orxonox/items/ShipPart.cc	(revision 10023)
@@ -37,4 +37,5 @@
 #include "Item.h"
 #include "worldentities/pawns/Pawn.h"
+#include "worldentities/pawns/ModularSpaceShip.h"
 #include "gametypes/Gametype.h"
 #include "worldentities/StaticEntity.h"
@@ -56,4 +57,37 @@
     }
 
+    void ShipPart::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ShipPart, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ShipPart, "health", setHealth, getHealth, xmlelement, mode).defaultValues(100);
+        XMLPortParam(ShipPart, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
+        XMLPortParam(ShipPart, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
+
+        XMLPortParam(ShipPart, "damageabsorption", setDamageAbsorption, getDamageAbsorption, xmlelement, mode).defaultValues(0.5);
+
+        /*
+        XMLPortParam(ShipPart, "shieldhealth", setShieldHealth, getShieldHealth, xmlelement, mode).defaultValues(0);
+        XMLPortParam(ShipPart, "initialshieldhealth", setInitialShieldHealth, getInitialShieldHealth, xmlelement, mode).defaultValues(0);
+        XMLPortParam(ShipPart, "maxshieldhealth", setMaxShieldHealth, getMaxShieldHealth, xmlelement, mode).defaultValues(100);
+        XMLPortParam(ShipPart, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode).defaultValues(0);
+
+        XMLPortParam(ShipPart, "sShipPartparticlesource", setSShipPartParticleSource, getSShipPartParticleSource, xmlelement, mode);
+        XMLPortParam(ShipPart, "sShipPartparticleduration", setSShipPartParticleDuration, getSShipPartParticleDuration, xmlelement, mode).defaultValues(3.0f);
+        XMLPortParam(ShipPart, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7);
+
+        XMLPortParam(ShipPart, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
+        XMLPortParam(ShipPart, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
+
+        XMLPortParam(ShipPart, "explosionSound",  setExplosionSound,  getExplosionSound,  xmlelement, mode);
+
+        XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode );
+        */
+    }
+
+    void ShipPart::death()
+    {
+        this->parent_->removeShipPart(this);
+    }
 
     /**
@@ -112,4 +146,9 @@
     {
         this->damageAbsorption_ = value;
+    }
+
+    void ShipPart::setParent(ModularSpaceShip* ship)
+    {
+        this->parent_ = ship;
     }
 
@@ -152,4 +191,7 @@
             }
         }
+        if (this->health_ < 0)
+            this->death();
+        orxout() << "Health of ShipPart " << this->getName() << " is " << this->getHealth() << endl;
     }
 
Index: code/branches/modularships/src/orxonox/items/ShipPart.h
===================================================================
--- code/branches/modularships/src/orxonox/items/ShipPart.h	(revision 10019)
+++ code/branches/modularships/src/orxonox/items/ShipPart.h	(revision 10023)
@@ -46,7 +46,9 @@
             virtual ~ShipPart();
 
-            //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
             virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
+
+            virtual void death();
 
             //virtual void attachTo(Pawn* newParent);
@@ -63,4 +65,8 @@
                 { return this->damageAbsorption_; }
 
+            void setParent(ModularSpaceShip* ship);
+            inline ModularSpaceShip* getParent()
+                { return this->parent_; }
+
             virtual void setHealth(float health);
             inline void addHealth(float health)
@@ -71,4 +77,14 @@
                 { return this->health_; }
 
+            inline void setMaxHealth(float maxhealth)
+                { this->maxHealth_ = maxhealth; this->setHealth(this->health_); }
+            inline float getMaxHealth() const
+                { return this->maxHealth_; }
+
+            inline void setInitialHealth(float initialhealth)
+                { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); }
+            inline float getInitialHealth() const
+                { return this->initialHealth_; }
+
 
             // FIXME: (noep) Why doesn't this work? Works fine in Engine.h
@@ -76,9 +92,11 @@
 
         protected:
-            Pawn* parent_;
+            ModularSpaceShip* parent_;
             unsigned int parentID_; // Object ID of the SpaceShip the Part is mounted on.
 
             float damageAbsorption_;
             float health_;
+            float maxHealth_;
+            float initialHealth_;
 
         private:
