Index: branches/vs-enhencements/src/lib/graphics/importer/bsp/bsp_manager.cc
===================================================================
--- branches/vs-enhencements/src/lib/graphics/importer/bsp/bsp_manager.cc	(revision 10669)
+++ branches/vs-enhencements/src/lib/graphics/importer/bsp/bsp_manager.cc	(revision 10670)
@@ -173,5 +173,5 @@
   // erase alreadyVisible
   for(int i = 0; i < this->bspFile->numFaces; i++) this->alreadyVisible[i] = false;
-  float tmp = 0;
+//   float tmp = 0;
   //this->opal.clear();
   //this->trasparent.clear();
@@ -186,5 +186,5 @@
 
   this->viewDir=    State::getCamera()->getAbsDirX();
-  float d = (cam.x*viewDir.x + cam.y*viewDir.y + cam.z * viewDir.z);
+//   float d = (cam.x*viewDir.x + cam.y*viewDir.y + cam.z * viewDir.z);
 
   BspTreeNode*  ActLeaf = this->getLeaf(this->bspFile->root, &ship);
@@ -254,5 +254,5 @@
 
     for(int i = 0; i <  this->bspFile->numLeafs   ; ++i ) {
-      leaf& camLeaf =  (this->bspFile->leaves)[ActLeaf->leafIndex] ;
+//       leaf& camLeaf =  (this->bspFile->leaves)[ActLeaf->leafIndex] ;
       leaf& curLeaf =  (this->bspFile->leaves)[i] ;
       int& cluster =  curLeaf.cluster;
Index: branches/vs-enhencements/src/util/hud.cc
===================================================================
--- branches/vs-enhencements/src/util/hud.cc	(revision 10669)
+++ branches/vs-enhencements/src/util/hud.cc	(revision 10670)
@@ -138,5 +138,5 @@
 }
 
-void Hud::setShiledWidget(OrxGui::GLGuiWidget* widget)
+void Hud::setShieldWidget(OrxGui::GLGuiWidget* widget)
 {
   /*
Index: branches/vs-enhencements/src/util/hud.h
===================================================================
--- branches/vs-enhencements/src/util/hud.h	(revision 10669)
+++ branches/vs-enhencements/src/util/hud.h	(revision 10670)
@@ -39,5 +39,5 @@
   void setBackGround();
   void setEnergyWidget(OrxGui::GLGuiWidget* widget);
-  void setShiledWidget(OrxGui::GLGuiWidget* widget);
+  void setShieldWidget(OrxGui::GLGuiWidget* widget);
   void setArmorWidget(OrxGui::GLGuiWidget* widget);
   inline OrxGui::GLGuiWidget* getEnergyWidget() {return this->energyWidget;};
Index: branches/vs-enhencements/src/world_entities/playable.h
===================================================================
--- branches/vs-enhencements/src/world_entities/playable.h	(revision 10669)
+++ branches/vs-enhencements/src/world_entities/playable.h	(revision 10670)
@@ -32,5 +32,5 @@
   typedef enum {
     Vertical         =  1,       //!< Vertical (seen from left or right/move in x-z)
-    Horizontal       =  2,       //!< Horizontal (seet from the top/move in x-y)
+    Horizontal       =  2,       //!< Horizontal (seen from the top/move in x-y)
     FromBehind       =  4,       //!< Seen from behind (move in z-y)
     Full3D           =  8,       //!< Full featured 3D-mode. (move in all directions x-y-z)
Index: branches/vs-enhencements/src/world_entities/projectiles/swarm_projectile.cc
===================================================================
--- branches/vs-enhencements/src/world_entities/projectiles/swarm_projectile.cc	(revision 10669)
+++ branches/vs-enhencements/src/world_entities/projectiles/swarm_projectile.cc	(revision 10670)
@@ -204,7 +204,7 @@
 /** old  guiding function*/
 
-  float projectileVelocity = this->getVelocity().len();
+  static float projectileVelocity = this->getVelocity().len();
   if (target != NULL){
-    Vector estTargetDir = (this->target->getAbsCoor() - this->getAbsCoor()).getNormalized();
+    static Vector estTargetDir = (this->target->getAbsCoor() - this->getAbsCoor()).getNormalized();
     this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * time );
   }
Index: branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc
===================================================================
--- branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc	(revision 10669)
+++ branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc	(revision 10670)
@@ -161,12 +161,12 @@
   this->secWeaponMan.setSlotCount(6);
 
-  this->weaponMan.createWeaponSlot(0, 3.006, 1.028, .155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->weaponMan.createWeaponSlot(1, 3.006, 1.028, -.155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->weaponMan.createWeaponSlot(2, 4.03, .063, .876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->weaponMan.createWeaponSlot(3, 4.03, -.063, -.876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->weaponMan.createWeaponSlot(4, 1.431, -.612, 2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->weaponMan.createWeaponSlot(5, 1.431, -.612, -2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->weaponMan.createWeaponSlot(6, 1.431, -.612, 3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->weaponMan.createWeaponSlot(7, 1.431, -.612, -3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(0, 3.270, 1.028, .155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(1, 3.270, 1.028, -.155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(2, 4.385, .063, .876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(3, 4.385, -.063, -.876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(4, 1.635, -.612, 2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(5, 1.536, -.612, -2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(6, 1.536, -.612, 3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(7, 1.536, -.612, -3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
 
 
@@ -212,8 +212,8 @@
 
 
-  setEnergyShare(.3,.3,.4);
-  setShield(100, 100, .2, 2);
-  setArmor(100, 100);
-  setElectronic(50, 50, .7, 3.0);
+//   loadEnergyShare(.3,.3,.4);
+//   loadShield(80, 100, .2, 2);
+//   loadHealth(100, 100, 0);
+//   loadElectronic(40, 50, .7, 3.0);
 
 //   this->loadModel("models/spaceships/fighter_redesign9.obj");
@@ -232,6 +232,6 @@
 
 
-  this->electronicWidget = NULL;
-  this->shieldWidget = NULL;
+//   this->electronicWidget = NULL;
+//   this->shieldWidget = NULL;
 
   //add events to the eventlist
@@ -290,5 +290,10 @@
 
 
-  this->toList(OM_GROUP_00);
+//   this->toList(OM_GROUP_00);
+
+  if ( this->hasPlayer() ){
+    State::getPlayer()->hud().setShieldWidget(this->getShieldWidget());
+    State::getPlayer()->hud().setEnergyWidget(this->getElectronicWidget());
+  }
 }
 
@@ -313,13 +318,13 @@
   LoadParam(root, "setReactor", this, SpaceShip, setReactor)
   .describe("set reactor output");
-  LoadParam(root, "setShield", this, SpaceShip, setShield)
+  LoadParam(root, "loadShield", this, WorldEntity, loadShield)
   .describe("set shield parameters: current strenght , max strenght, threshhold value (0..1), regeneration rate");
-  LoadParam(root, "setArmor", this, SpaceShip, setArmor)
+  LoadParam(root, "loadHealth", this, WorldEntity, loadHealth)
   .describe("set armor/health parameters: current strenght , max strenght");
-  LoadParam(root, "setElectronic", this, SpaceShip, setElectronic)
+  LoadParam(root, "loadElectronic", this, WorldEntity, loadElectronic)
   .describe("set electronics parameters: current strenght , max strenght, threshhold value (0..1), regeneration rate");
   LoadParam(root, "setEngine", this, SpaceShip, setEngine)
   .describe("set base speed");
-  LoadParam(root, "setEnergyShare", this, SpaceShip, setEnergyShare)
+  LoadParam(root, "loadEnergyShare", this, SpaceShip, loadEnergyShare)
   .describe("set energy partitioning: shield, weapons, engine (sum should be 1)");
   LoadParam(root, "setWeapon", this, SpaceShip, setWeapon)
@@ -352,11 +357,7 @@
   bForward = bBackward = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = bFire = bSecFire = false;
 
-
-//   this->armorCur = this->armorMax;
-  this->setHealth(this->getHealthMax());
-  this->shieldCur = this->shieldMax;
-  this->shieldActive = true;
-  this->electronicCur = this->electronicMax;
-//   this->updateHealth();
+  this->resetHealth();
+  this->resetShield();
+  this->resetElectronic();
   this->velocity = Vector(0.0, 0.0, 0.0);
 }
@@ -664,65 +665,11 @@
   PRINTF(5)("ship hit for (%f,%f) \n",pDamage,eDamage);
 
-  if( this->shieldActive) {
-    if( this->shieldCur > pDamage) {
-      this->shieldCur = this->shieldCur - pDamage;
-    }
-    else { // shield <= pDamage
-      this->shieldCur -=pDamage;
-      this->shieldActive = false; //shield collapses
-      pDamage += this->shieldCur;
-      if( !this->shieldActive) {
-        this->decreaseHealth( pDamage / 2); // remaining damages hits armor at half rate
-        this->electronicCur -= eDamage;
-      }
-    }
-  }
-  else {
-    this->decreaseHealth(pDamage);
-    this->electronicCur = this->electronicCur - eDamage;
-  }
-  if( this->getHealth() <= 0) { /* FIXME implement shipcrash*/ }
+  static float tmp = this->decreaseShield(pDamage);
+  if( tmp > 0)
+  if ( this->decreaseHealth(tmp / 2) )
     this->destroy(this);
 
-  updateElectronicWidget();
-  updateShieldWidget();
-
-//   this->setHealth( this->armorCur);
-}
-
-
-void SpaceShip::regen(float time){
-  static float tmp, armorCur, armorMax;
-  if (armorCur != armorMax || this->armorRegen != 0){
-    tmp = armorCur + armorRegen * time;
-    if ( tmp > armorMax)
-      armorCur = armorMax;
-    else
-      armorCur = tmp;
-  }
-  if (this->shieldCur != this->shieldMax || this->shieldRegen != 0){
-    tmp =  this->shieldCur + (this->shieldRegen + this->reactorOutput * this->shieldEnergyShare) * time;
-    if( tmp > shieldMax)
-      this->shieldCur = this->shieldMax;
-    else
-      this->shieldCur = tmp;
-    this->shieldActive = ( this->shieldActive || this->shieldCur > shieldTH);
-
-    updateShieldWidget();
-  }
-
-  this->setHealth( this->shieldCur);      // FIXME currently just to test share system
-
-  if (this->electronicCur != this->electronicMax || this->electronicRegen != 0){
-    tmp = this->electronicCur + this->electronicRegen * time;
-    if ( tmp > electronicMax)
-      this->electronicCur = this->electronicMax;
-    else
-      this->electronicCur = tmp;
-
-    updateElectronicWidget();
-  }
-
-}
+}
+
 
 
@@ -733,14 +680,23 @@
 void SpaceShip::weaponRegen(float time)
 {
-  float energy  = ( this->reactorOutput * this->weaponEnergyShare + this->weaponEnergyRegen) * time;
+  float energy = ( this->reactorOutput * this->weaponEnergyShare + this->weaponEnergyRegen) * time ;
   Weapon* weapon;
-  for( unsigned int i=0; i < this->weaponMan.getSlotCount(); i++)
-  {
+  int weaponCount = 0;
+  for( unsigned int i=0; i < this->weaponMan.getSlotCount(); i++) {
     weapon = this->weaponMan.getWeapon(i);
-    if( weapon != NULL && weapon->isActive())
-    {
+    if( weapon != NULL && weapon->isActive()) {
+      weaponCount++;
+    }
+  }
+
+  if (weaponCount == 0)
+    return;
+  energy *= ( this->weaponMan.getSlotCount() / (float)weaponCount );
+
+  for( unsigned int i=0; i < this->weaponMan.getSlotCount(); i++) {
+    weapon = this->weaponMan.getWeapon(i);
+    if( weapon != NULL && weapon->isActive()) {
       weapon->increaseEnergy( energy);
     }
-
   }
   // weaponMan.increaseAmmunition( weapon, energy);
@@ -748,6 +704,5 @@
 
 
-void SpaceShip::enterPlaymode(Playable::Playmode playmode)
-{
+void SpaceShip::enterPlaymode(Playable::Playmode playmode){
   switch(playmode)
   {
@@ -810,5 +765,5 @@
       break;
 
-    
+
     case Playable::Vertical:
     {
@@ -832,5 +787,5 @@
         //this->setCameraMode(Camera::ViewNormal);
         State::getCamera()->setEventHandling(false);
-        
+
         PRINTF(0)("\n\n\n\n\n\n\n\nSETCAMERA %x\n\n\n\n\n\n\n", State::getCamera());
         State::getCamera()->setViewMode(Camera::ViewNormal);
@@ -838,6 +793,5 @@
         State::getCamera()->setParent(this);
 
-        
-        
+
         registerEvent(KeyMapper::PEV_VIEW0);
         registerEvent(KeyMapper::PEV_VIEW1);
@@ -848,8 +802,8 @@
 
         State::getCamera()->setParentMode(PNODE_ALL);
-      
+
       break;
     }
-      
+
     default:
       PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName());
@@ -1020,5 +974,5 @@
       }
       ActionBox * box = entityTrack->getActionBox();
-      
+
       this->travelVelocity = Vector(0, 0, 0);
       float ssss = 50;
@@ -1039,5 +993,5 @@
         this->travelVelocity += Vector( 0, 0, ssss );
       }
-      
+
       Vector ds = this->travelVelocity*dt;
       Vector newPos = this->getRelCoor() + ds;
@@ -1092,43 +1046,43 @@
 }
 
-void SpaceShip::updateElectronicWidget()
-{
-  if (this->electronicWidget != NULL)
-  { //if it exists already: update it
-     this->electronicWidget->setMaximum(this->electronicMax);
-     this->electronicWidget->setValue(this->electronicCur);
-  }
-  else
-  { //create the widget
-    this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical();
-    this->electronicWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1));
-    //this->electronicWidget->setDisplayedName("Electronics:");
-    //this->electronicWidget->setSize2D(100,20);
-    //this->electronicWidget->setAbsCoor2D(150,200);
-    this->updateElectronicWidget();
-    if (this->hasPlayer())
-      State::getPlayer()->hud().setEnergyWidget(this->electronicWidget);
-  }
-}
-
-void SpaceShip::updateShieldWidget()
-{
-  if (this->shieldWidget != NULL)
-  {
-    this->shieldWidget->setMaximum(this->shieldMax);
-    this->shieldWidget->setValue(this->shieldCur);;
-  }
-  else
-  {
-    this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical();
-    this->shieldWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1));
-    //this->shieldWidget->setDisplayedName("Shield:");
-    //his->shieldWidget->setSize2D(100,20);
-    //this->shieldWidget->setAbsCoor2D(200,200);
-    this->updateShieldWidget();
-    if (this->hasPlayer())
-      State::getPlayer()->hud().setShiledWidget(this->shieldWidget);
-  }
-}
+// void SpaceShip::updateElectronicWidget()
+// {
+//   if (this->electronicWidget != NULL)
+//   { //if it exists already: update it
+//      this->electronicWidget->setMaximum(this->electronicMax);
+//      this->electronicWidget->setValue(this->electronicCur);
+//   }
+//   else
+//   { //create the widget
+//     this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical();
+//     this->electronicWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1));
+//     //this->electronicWidget->setDisplayedName("Electronics:");
+//     //this->electronicWidget->setSize2D(100,20);
+//     //this->electronicWidget->setAbsCoor2D(150,200);
+//     this->updateElectronicWidget();
+//     if (this->hasPlayer())
+//       State::getPlayer()->hud().setEnergyWidget(this->electronicWidget);
+//   }
+// }
+// 
+// void SpaceShip::updateShieldWidget()
+// {
+//   if (this->shieldWidget != NULL)
+//   {
+//     this->shieldWidget->setMaximum(this->shieldMax);
+//     this->shieldWidget->setValue(this->shieldCur);;
+//   }
+//   else
+//   {
+//     this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical();
+//     this->shieldWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1));
+//     //this->shieldWidget->setDisplayedName("Shield:");
+//     //his->shieldWidget->setSize2D(100,20);
+//     //this->shieldWidget->setAbsCoor2D(200,200);
+//     this->updateShieldWidget();
+//     if (this->hasPlayer())
+//       State::getPlayer()->hud().setShiledWidget(this->shieldWidget);
+//   }
+// }
 
 void SpaceShip::setCameraDistance(float dist)
@@ -1183,8 +1137,3 @@
 };
 
-// void SpaceShip::addWeaponToSlot(int wm, int config, int slot, const std::string& weaponName){
-//   if (wm == 1) { this->weaponMan.addWeapon( Weapon::createWeapon( weaponName ), config, slot); }
-//   if (wm == 1) { this->weaponMan.addWeapon( Weapon::createWeapon( weaponName ), config, slot); }
-//   else return;
-// }
-
+
Index: branches/vs-enhencements/src/world_entities/space_ships/space_ship.h
===================================================================
--- branches/vs-enhencements/src/world_entities/space_ships/space_ship.h	(revision 10669)
+++ branches/vs-enhencements/src/world_entities/space_ships/space_ship.h	(revision 10670)
@@ -12,4 +12,5 @@
 #include "playable.h"
 #include "extendable.h"
+#include "world_entity.h"
 
 // Forward Declaration
@@ -64,14 +65,9 @@
 
     //!< functions for XML loading
-    inline void setReactor(float output) {this->reactorOutput = output; };
-    inline void setShield(float cur, float max, float th, float regen)
-        { this->shieldCur = cur; this->shieldMax = max; this->shieldTH = th; this->shieldRegen = regen;};
-    inline void setArmor(float cur, float max) { this->setHealth(cur); this->setHealthMax(max); };
-    inline void setElectronic(float cur, float max, float th, float regen)
-        { this->electronicCur = cur; this->electronicMax = max; this->electronicTH = th; this->electronicRegen = regen; };
-    inline void setEngine( float speedBase) {this->engineSpeedBase = speedBase; };
-    inline void setEnergyShare(float shield, float weapon, float engine)
+    void setReactor(float output) {this->reactorOutput = output; };
+    void setEngine( float speedBase) {this->engineSpeedBase = speedBase; };
+    void loadEnergyShare(float shield, float weapon, float engine)
         { float tmp = shield + weapon + engine; if (unlikely (tmp > 1)) { tmp = 1/tmp; }
-          // dirty safety hack, prevents total share being bigger than 1!!
+          // HACK dirty safety hack, prevents total share being bigger than 1!!
           this->shieldEnergyShare = shield * tmp;
           this->weaponEnergyShare = weapon * tmp;
@@ -79,18 +75,5 @@
     inline void setWeapon(float regen) { this->weaponEnergyRegen = regen; };
 
-    //!< Resynchonizes armor with health in WE!!
-//     inline void updateHealth() { this->setHealth(this->armorCur); this->setHealthMax(this->armorMax); };
-
     void addWeaponToSlot(int wm, int config, int slot, const std::string& weaponName);
-
-    //Functions for GUI
-    inline float getShieldCur() { return this->shieldCur; };        //!< returns current shield value
-    inline float getShieldMax() { return this->shieldMax; };        //!< returns maximum shield value
-
-    inline float getArmorCur() { return this->getHealth(); };          //!< returns current armor value
-    inline float getArmorMax() { return this->getHealthMax(); };          //!< returns current armor value
-
-    inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value
-    inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value
 
     inline PNode* getTravelNode() { return this->travelNode; };
@@ -121,12 +104,12 @@
     //void calculateVelocity(float time);
 
-    void regen(float time);  //!< handler for shield and electronic regeneration
+//    void regen(float time);  //!< handler for shield and electronic regeneration
 
     void weaponRegen(float time);   //!< weapon energy regeneration
 
-    inline bool systemFailure() {  return (this->electronicCur < float(rand())/float(RAND_MAX) * this->electronicTH); };
-
-    void updateElectronicWidget();
-    void updateShieldWidget();
+//     inline bool systemFailure() {  return (this->getElectronic() < float(rand())/float(RAND_MAX) * this->getElectronicTH()); };
+
+//     void updateElectronicWidget();
+//     void updateShieldWidget();
 
     //WeaponManager         weaponMan;      //!< the primary weapon manager: managing a list of energy weapons to wepaon-slot mapping
@@ -136,22 +119,21 @@
 
     //ship atributes
-    float       shieldCur;          //!< current shield
-    float       shieldMax;          //!< maximum shield
-    float       shieldEnergyShare;  //!< percentage of reactor output
-    float       shieldRegen;        //!< shield regeneration rate per second
-    float       shieldTH;           //!< shield threshhold for reactivation
-    bool        shieldActive;       //!< wheather the shield is working
-    OrxGui::GLGuiEnergyWidgetVertical* shieldWidget; //!< holds the widget that shows the shield bar
+//    float       shieldCur;          //!< current shield
+//    float       shieldMax;          //!< maximum shield
+//    float       shieldRegen;        //!< shield regeneration rate per second
+//    float       shieldTH;           //!< shield threshhold for reactivation
+//    bool        shieldActive;       //!< wheather the shield is working
+//    OrxGui::GLGuiEnergyWidgetVertical* shieldWidget; //!< holds the widget that shows the shield bar
 
 //    float       armorCur;           //!< current armor
 //    float       armorMax;           //!< maximum armor
-    float       armorRegen;         //!< armor regeneration per tick (usable on bioships?)
+//    float       armorRegen;         //!< armor regeneration per tick (usable on bioships?)
     //note that the armor widget is set on the health- widget in world- entity (see in player.cc)
 
-    float       electronicCur;      //!< current electronic
-    float       electronicMax;      //!< maximum electronic
-    float       electronicRegen;    //!< electronic regenration rate per tick
-    float       electronicTH;       //!< Threshhold for electronic failure
-    OrxGui::GLGuiEnergyWidgetVertical* electronicWidget; //!< holds the widget that shows the electronic bar
+//    float       electronicCur;      //!< current electronic
+//    float       electronicMax;      //!< maximum electronic
+//    float       electronicRegen;    //!< electronic regenration rate per tick
+//    float       electronicTH;       //!< Threshhold for electronic failure
+//    OrxGui::GLGuiEnergyWidgetVertical* electronicWidget; //!< holds the widget that shows the electronic bar
 
     float       engineSpeedCur;     //!< speed output for movement = speed base + energy share part
@@ -159,4 +141,5 @@
     int         enginePowerConsume; //!< energy needed
     float       engineEnergyShare;  //!< percentage of reactor output
+    float       shieldEnergyShare;  //!< percentage of reactor output
 
     int         weaponEnergySlot;   //!< number of energy weapon slots
Index: branches/vs-enhencements/src/world_entities/world_entity.cc
===================================================================
--- branches/vs-enhencements/src/world_entities/world_entity.cc	(revision 10669)
+++ branches/vs-enhencements/src/world_entities/world_entity.cc	(revision 10670)
@@ -75,4 +75,6 @@
   this->aabbNode = NULL;
   this->healthWidget = NULL;
+  this->electronicWidget = NULL;
+  this->shieldWidget = NULL;
   this->healthMax = 1.0f;
   this->health = 1.0f;
@@ -776,6 +778,6 @@
   this->updateHealthWidget();
   return 0.0;
-
-}
+}
+
 
 /**
@@ -792,4 +794,46 @@
   this->updateHealthWidget();
 }
+
+
+
+/**
+ * @param shiled the Shieldstength to add.
+ * @returns the shield left (this->shieldMax - shiled + this->shield)
+ */
+float WorldEntity::increaseShield(float shiled)
+{
+  this->shield += shield;
+  if (this->shield > this->shieldTH * this->shieldMax) { this->bShieldActive = true; }
+  if (this->shield > this->shieldMax)
+  {
+    float retShield = this->shieldMax - this->shield;
+    this->shield = this->shieldMax;
+    this->updateShieldWidget();
+    return retShield;
+  }
+  this->updateShieldWidget();
+  return 0.0;
+}
+
+/**
+ * @param shield the Shieldstrength to be removed
+ * @returns 0.0 or the rest, if the shield drops belew 0.0
+ */
+float WorldEntity::decreaseShield(float shield)
+{
+  this->shield -= shield;
+
+  if (this->shield <= 0)
+  {
+    float retShield = -this->shield;
+    this->updateShieldWidget();
+    this->bShieldActive = false;
+    return retShield;
+  }
+  this->updateShieldWidget();
+  return 0.0;
+}
+
+
 
 /**
@@ -813,4 +857,28 @@
 }
 
+
+void WorldEntity::createShieldWidget()
+{
+  if (this->shieldWidget == NULL)
+  {
+    this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical();
+    this->updateHealthWidget();
+  }
+  else
+    PRINTF(3)("Allready created the ShieldWidget for %s::%s\n", this->getClassCName(), this->getCName());
+}
+
+void WorldEntity::createElectronicWidget()
+{
+  if (this->electronicWidget == NULL)
+  {
+    this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical();
+    this->updateElectronicWidget();
+  }
+  else
+    PRINTF(3)("Allready created the ElectronicWidget for %s::%s\n", this->getClassCName(), this->getCName());
+}
+
+
 void WorldEntity::increaseHealthMax(float increaseHealth)
 {
@@ -822,7 +890,26 @@
 OrxGui::GLGuiWidget* WorldEntity::getHealthWidget()
 {
-  this->createHealthWidget();
+  if ( this->healthWidget == NULL)
+    this->createHealthWidget();
   return this->healthWidget;
 }
+
+
+OrxGui::GLGuiWidget* WorldEntity::getShieldWidget()
+{
+  if ( this->shieldWidget == NULL)
+    this->createShieldWidget();
+  return this->shieldWidget;
+}
+
+
+OrxGui::GLGuiWidget* WorldEntity::getElectronicWidget()
+{
+  if ( this->electronicWidget == NULL)
+    this->createElectronicWidget();
+  return this->electronicWidget;
+}
+
+
 
 /**
@@ -830,5 +917,5 @@
  * (creates the widget if needed)
  */
-void WorldEntity::setHealthWidgetVisibilit(bool visibility)
+void WorldEntity::setHealthWidgetVisibility(bool visibility)
 {
   if (visibility)
@@ -890,4 +977,52 @@
   }
 }
+
+/**
+ * @brief updates the Electronic Widget
+ */
+//!< xferred from spaceship
+void WorldEntity::updateElectronicWidget(){
+  if (this->electronicWidget != NULL)
+  { //if it exists already: update it
+     this->electronicWidget->setMaximum(this->electronicMax);
+     this->electronicWidget->setValue(this->electronic);
+  }
+  else
+  { //create the widget
+    this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical();
+    this->electronicWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1));
+    //this->electronicWidget->setDisplayedName("Electronics:");
+    //this->electronicWidget->setSize2D(100,20);
+    //this->electronicWidget->setAbsCoor2D(150,200);
+    this->updateElectronicWidget();
+//     if ( dynamic_cast<SpaceShip*>(this)->hasPlayer() )
+//       State::getPlayer()->hud().setEnergyWidget(this->electronicWidget);
+  }
+}
+
+/**
+ * @brief updates the ShieldWidget
+ */
+//!< xferred from spaceship
+void WorldEntity::updateShieldWidget()
+{
+  if (this->shieldWidget != NULL)
+  {
+    this->shieldWidget->setMaximum(this->shieldMax);
+    this->shieldWidget->setValue(this->shield);;
+  }
+  else
+  {
+    this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical();
+    this->shieldWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1));
+    //this->shieldWidget->setDisplayedName("Shield:");
+    //his->shieldWidget->setSize2D(100,20);
+    //this->shieldWidget->setAbsCoor2D(200,200);
+    this->updateShieldWidget();
+//     if (dynamic_cast<SpaceShip*>(this)->hasPlayer())
+//       State::getPlayer()->hud().setShieldWidget(this->shieldWidget);
+  }
+}
+
 
 
@@ -985,2 +1120,23 @@
 }
 
+
+void WorldEntity::regen(float time){
+  static float tmp;
+  increaseHealth(time * this->healthRegen);
+  increaseShield(time * this->shieldRegen);
+//   updateHealthWidget();
+//   updateShieldWidget();
+
+  //this->setHealth( this->shieldCur);      // FIXME currently just to test share system
+
+  if (this->electronic != this->electronicMax || this->electronicRegen != 0){
+    tmp = this->electronic + this->electronicRegen * time;
+    if ( tmp > electronicMax)
+      this->electronic = this->electronicMax;
+    else
+      this->electronic = tmp;
+
+    updateElectronicWidget();
+  }
+
+}
Index: branches/vs-enhencements/src/world_entities/world_entity.h
===================================================================
--- branches/vs-enhencements/src/world_entities/world_entity.h	(revision 10669)
+++ branches/vs-enhencements/src/world_entities/world_entity.h	(revision 10670)
@@ -161,7 +161,42 @@
   void increaseHealthMax(float increaseHealth);
   OrxGui::GLGuiWidget* getHealthWidget();
+  OrxGui::GLGuiWidget* getShieldWidget();
+  OrxGui::GLGuiWidget* getElectronicWidget();
   bool hasHealthWidget() const { return this->healthWidget != NULL; };
 
+  float getShield() const { return this->shield; };
+  float getShieldMax() const { return this->shieldMax; };
+  float increaseShield(float shield);
+  float decreaseShield(float shield);
+  bool getShieldActive() { return this->bShieldActive; };
+
+  float getElectronic() const { return this->electronic; };
+  float getElectronicMax() const { return this->electronicMax; };
+  float increaseElectronic(float electronic);
+  float decreaseElectronic(float electronic);
+
+  bool systemFailure() {  return (this->electronic < float(rand())/float(RAND_MAX) * this->electronicTH); };
+
+  void resetElectronic() { this->electronic = this->electronicMax; };
+  void resetShield()  { this->shield = this->shieldMax; this->bShieldActive = true; };
+  void resetHealth() { this->health = this->healthMax; };
+
+
+  void regen(float time);
+
+  void loadShield(float cur, float max, float th, float regen)
+      { this->setShield(cur); this->setShieldMax(max); this->setShieldTH(th); this->setShieldRegen(regen); };
+  void loadHealth(float cur, float max, float regen = 0) { this->setHealth(cur); this->setHealthMax(max); this->setHealthRegen(regen); };
+  void loadElectronic(float cur, float max, float th, float regen)
+      { this->setElectronic(cur); this->setElectronicMax(max); this->setElectronicTH(th); this->setElectronicRegen(regen); };
+/*
+  OrxGui::GLGuiEnergyWidgetVertical* getHealthWidget() { return this->healthWidget; };
+  OrxGui::GLGuiEnergyWidgetVertical* getShieldWidget() { return this->shieldWidget; };
+  OrxGui::GLGuiEnergyWidgetVertical* getEnergyWidget() { return this->electronicWidget; };*/
+
+
   virtual void varChangeHandler( std::list<int> & id );
+
+
 
 
@@ -181,18 +216,36 @@
   void pauseTrack(bool stop);
 
+//   void updateHealthWidget();
+//   void updateElectronicWidget();
+//   void updateShieldWidget();
 
 protected:
-  void setHealth(float health) { this->health = health; this->updateHealthWidget();};
-  void setHealthWidgetVisibilit(bool visibility);
+  inline void setHealth(float health) { this->health = health; this->updateHealthWidget();};
+  void setHealthWidgetVisibility(bool visibility);
   void setHealthMax(float healthMax);
   void createHealthWidget();
+  void createShieldWidget();
+  void createElectronicWidget();
+  void setHealthRegen(float regen) { this->healthRegen = regen; };
     //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
+
+  void setShield(float shield) { this->shield = shield; };
+  void setShieldMax(float shield) { this->shieldMax = shield; };
+  void setShieldTH(float th) { this->shieldTH = th; };
+  void setShieldRegen(float regen) { this->shieldRegen = regen; };
+  void setShieldActive(bool active) { this->bShieldActive = active; };
+
+  void setElectronic(float electronic) { this->electronic = electronic; };
+  void setElectronicMax(float electronic) { this->electronicMax = electronic; };
+  void setElectronicTH(float th) { this->electronicTH = th; };
+  void setElectronicRegen(float regen) { this->electronicRegen = regen; };
 
   inline void drawDebugTrack(int flag) { this->bDrawTrack = (bool)flag; }
   inline bool isDrawTrack() const { return this->bDrawTrack; }
 
-
 private:
   void updateHealthWidget();
+  void updateElectronicWidget();
+  void updateShieldWidget();
   void addTrack(const TiXmlElement* root);
 
@@ -206,9 +259,25 @@
 
 private:
-  /// TODO maybe we will move the following three entries and the corresponding functions to Playable AND NPC
+  //!< TODO maybe we will move the following three entries and the corresponding functions to Playable AND NPC
+  //!< started transfering shield/electronic/health from spaceship to WE! (nico, 4.Jun.07)
   float                   damage;             //!< the damage dealt to other objects by colliding.
   float                   health;             //!< The Energy of this Entity, if the Entity has any energy at all.
   float                   healthMax;          //!< The Maximal energy this entity can take.
+  float                   healthRegen;        //!< Regeneration Rate of Health, mesured in units per second
   OrxGui::GLGuiEnergyWidgetVertical* healthWidget;    //!< The Slider (if wanted).
+
+  float       shield;             //!< current shield
+  float       shieldMax;          //!< maximum shield
+  float       shieldRegen;        //!< shield regeneration rate per second
+  float       shieldTH;           //!< shield threshhold for reactivation
+  bool        bShieldActive;      //!< wheather the shield is working
+  OrxGui::GLGuiEnergyWidgetVertical* shieldWidget; //!< holds the widget that shows the shield bar
+
+  float       electronic;         //!< current electronic
+  float       electronicMax;      //!< maximum electronic
+  float       electronicRegen;    //!< electronic regenration rate per tick
+  float       electronicTH;       //!< Threshhold for electronic failure
+  OrxGui::GLGuiEnergyWidgetVertical* electronicWidget; //!< holds the widget that shows the electronic bar
+
 
   std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
