[Orxonox-commit 5991] r10650 - in code/trunk: data/levels/includes src/orxonox/weaponsystem src/orxonox/worldentities/pawns

fvultier at orxonox.net fvultier at orxonox.net
Mon Oct 12 22:57:01 CEST 2015


Author: fvultier
Date: 2015-10-12 22:57:00 +0200 (Mon, 12 Oct 2015)
New Revision: 10650

Modified:
   code/trunk/data/levels/includes/weaponSettingsRing.oxi
   code/trunk/src/orxonox/weaponsystem/Weapon.cc
   code/trunk/src/orxonox/weaponsystem/Weapon.h
   code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
   code/trunk/src/orxonox/weaponsystem/WeaponMode.h
   code/trunk/src/orxonox/weaponsystem/WeaponPack.cc
   code/trunk/src/orxonox/weaponsystem/WeaponSet.cc
   code/trunk/src/orxonox/weaponsystem/WeaponSlot.h
   code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc
   code/trunk/src/orxonox/weaponsystem/WeaponSystem.h
   code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
Log:
There is now a spaceship that uses the gravity bomb. Minor documentation improvements.

Modified: code/trunk/data/levels/includes/weaponSettingsRing.oxi
===================================================================
--- code/trunk/data/levels/includes/weaponSettingsRing.oxi	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/data/levels/includes/weaponSettingsRing.oxi	2015-10-12 20:57:00 UTC (rev 10650)
@@ -1,5 +1,6 @@
 <weaponslots>
   <WeaponSlot position="11,0,-7" />
+  <WeaponSlot position="0,0,-7" />
   <WeaponSlot position="-11,0,-7" />
 </weaponslots>
 <weaponsets>
@@ -13,10 +14,13 @@
       <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
     </links>
     <Weapon>
-      <IceGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 muzzleoffset=" 0.1, 1.4,-3" freezefactor=0.5 freezetime=2.0 />
+      <IceGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 muzzleoffset="11,0,-3" freezefactor=0.5 freezetime=2.0 />
     </Weapon>
     <Weapon>
-      <IceGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 muzzleoffset=" 0.1, 1.4,-3" freezefactor=0.5 freezetime=2.0 />
+      <IceGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 muzzleoffset=" -11,0,-3" freezefactor=0.5 freezetime=2.0 />
     </Weapon>
+    <Weapon>
+      <GravityBombFire mode=1 munitionpershot=0 delay=0.125 damage=3 muzzleoffset="0,0,-7"/>
+    </Weapon>
   </WeaponPack>
 </weapons>

Modified: code/trunk/src/orxonox/weaponsystem/Weapon.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/Weapon.cc	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/weaponsystem/Weapon.cc	2015-10-12 20:57:00 UTC (rev 10650)
@@ -94,6 +94,10 @@
         return 0;
     }
 
+    /**
+    @brief
+        Fire this Weapon with the the WeaponMode defined by @param mode
+    */
     void Weapon::fire(unsigned int mode)
     {
         // To avoid firing with more than one mode at the same time, we lock the weapon (reloading) for

Modified: code/trunk/src/orxonox/weaponsystem/Weapon.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/Weapon.h	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/weaponsystem/Weapon.h	2015-10-12 20:57:00 UTC (rev 10650)
@@ -38,6 +38,11 @@
 
 namespace orxonox
 {
+    /**
+    @brief
+        A Weapon is a StaticEntity that can be attached to a WeaponSlot. A Weapon can shoot with different @ref orxonox::WeaponMode modes.
+        Imagine for example that a machine gun can shoot normal bullets, tracer bullets or even grenades.
+    */    
     class _OrxonoxExport Weapon : public StaticEntity
     {
         public:
@@ -52,11 +57,19 @@
             void addWeaponmode(WeaponMode* weaponmode);
             WeaponMode* getWeaponmode(unsigned int index) const;
 
+            /**
+            @brief
+                This function is called by a @ref orxonox::WeaponPack if this Weapon is added to the WeaponPack.
+            */
             inline void setWeaponPack(WeaponPack * weaponPack)
                 { this->weaponPack_ = weaponPack; this->notifyWeaponModes(); }
             inline WeaponPack * getWeaponPack() const
                 { return this->weaponPack_; }
 
+            /**
+            @brief
+                This function is called by a @ref orxonox::WeaponSlot if this Weapon gets attached to the WeaponSlot.
+            */
             inline void setWeaponSlot(WeaponSlot * wSlot)
                 { this->weaponSlot_ = wSlot; }
             inline WeaponSlot * getWeaponSlot() const

Modified: code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponMode.cc	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/weaponsystem/WeaponMode.cc	2015-10-12 20:57:00 UTC (rev 10650)
@@ -127,21 +127,21 @@
 
         if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this))
         {
-            float reloadtime = this->reloadTime_;
+            float tempReloadtime = this->reloadTime_;
 
             if (this->bAutoReload_ && this->munition_->needReload(this))
             {
                 if (this->munition_->reload(this))
                 {
                     if (this->bParallelReload_)
-                        reloadtime = std::max(this->reloadTime_, this->munition_->getReloadTime());
+                        tempReloadtime = std::max(this->reloadTime_, this->munition_->getReloadTime());
                     else
-                        reloadtime = this->reloadTime_ + this->munition_->getReloadTime();
+                        tempReloadtime = this->reloadTime_ + this->munition_->getReloadTime();
                 }
             }
 
             this->bReloading_ = true;
-            this->reloadTimer_.setInterval(reloadtime);
+            this->reloadTimer_.setInterval(tempReloadtime);
             this->reloadTimer_.startTimer();
 
             if( this->defSndWpnFire_ && !(this->defSndWpnFire_->isPlaying()))

Modified: code/trunk/src/orxonox/weaponsystem/WeaponMode.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponMode.h	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/weaponsystem/WeaponMode.h	2015-10-12 20:57:00 UTC (rev 10650)
@@ -40,6 +40,10 @@
 
 namespace orxonox
 {
+    /**
+    @brief
+        A WeaponMode defines how a Weapon is used. It specifies what kind of @ref orxonox::Projectile is created when you fire it, how much time it takes to reload, what sound you hear while shooting, how much damage the projectile deals to a target, ...
+    */
     class _OrxonoxExport WeaponMode : public BaseObject
     {
         public:

Modified: code/trunk/src/orxonox/weaponsystem/WeaponPack.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponPack.cc	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/weaponsystem/WeaponPack.cc	2015-10-12 20:57:00 UTC (rev 10650)
@@ -69,12 +69,20 @@
         XMLPortObject(WeaponPack, DefaultWeaponmodeLink, "links", addDefaultWeaponmodeLink, getDefaultWeaponmodeLink, xmlelement, mode);
     }
 
+    /**
+    @brief
+        Fire all weapons in this WeaponSet with the defined weaponmode.
+    */
     void WeaponPack::fire(unsigned int weaponmode)
     {
         for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
             (*it)->fire(weaponmode);
     }
 
+    /**
+    @brief
+        Reload all weapons in this WeaponSet.
+    */
     void WeaponPack::reload()
     {
         for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)

Modified: code/trunk/src/orxonox/weaponsystem/WeaponSet.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSet.cc	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSet.cc	2015-10-12 20:57:00 UTC (rev 10650)
@@ -61,7 +61,7 @@
 
     void WeaponSet::fire()
     {
-        // fire all WeaponPacks with their defined weaponmode
+        // Fire all WeaponPacks with their defined weaponmode
         for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
             if (it->second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
                 it->first->fire(it->second);
@@ -69,7 +69,7 @@
 
     void WeaponSet::reload()
     {
-        // fire all WeaponPacks with their defined weaponmode
+        // Reload all WeaponPacks with their defined weaponmode
         for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
             it->first->reload();
     }

Modified: code/trunk/src/orxonox/weaponsystem/WeaponSlot.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSlot.h	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSlot.h	2015-10-12 20:57:00 UTC (rev 10650)
@@ -36,7 +36,7 @@
 {
     /**
     @brief
-        The a WeaponSlot defines where a @ref orxonox::Weapon "Weapon" is placed on a pawn. (A WeaponSlot is a StaticEntity)
+        The a WeaponSlot defines where a @ref orxonox::Weapon "Weapon" is placed on a pawn. A WeaponSlot is a @ref orxonox::StaticEntity, therefore it has a position and orientation.
         In a WeaponSlot there can be only one "Weapon", but a Weapon can have several @ref orxonox::WeaponMode "WeaponModes".
         A WeaponMode is what one intuitively imagines as weapon. (E.g. RocketFire, LightningGun, LaserFire are weaponmodes)
 

Modified: code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc	2015-10-12 20:57:00 UTC (rev 10650)
@@ -282,6 +282,10 @@
         wSet->setWeaponmodeLink(wPack, weaponmode);
     }
 
+    /**
+    @brief
+        Fires the @ref Orxonox::WeaponSet with the specified firemode.
+    */
     void WeaponSystem::fire(unsigned int firemode)
     {
         std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);

Modified: code/trunk/src/orxonox/weaponsystem/WeaponSystem.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSystem.h	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSystem.h	2015-10-12 20:57:00 UTC (rev 10650)
@@ -39,6 +39,11 @@
 
 namespace orxonox
 {
+    /**
+    @brief
+        An @ref orxonox::Pawn that is able to fire weapons always need to have a WeaponSystem. The WeaponSystem manages all the @ref orxonox::WeaponSet, @ref orxonox::WeaponPack and @ref orxonox::WeaponSlot classes.
+        
+    */       
     class _OrxonoxExport WeaponSystem : public BaseObject
     {
         public:

Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	2015-10-12 16:40:48 UTC (rev 10649)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	2015-10-12 20:57:00 UTC (rev 10650)
@@ -298,7 +298,6 @@
         }
     }
 
-
     void Pawn::kill()
     {
         this->damage(this->health_);
@@ -319,7 +318,6 @@
         }
     }
 
-
     void Pawn::death()
     {
         this->setHealth(1);
@@ -471,6 +469,10 @@
         }
     }
 
+    /**
+    @brief
+        Check whether the Pawn has a @ref Orxonox::WeaponSystem and fire it with the specified firemode if it has one.
+    */
     void Pawn::fired(unsigned int firemode)
     {
         if (this->weaponSystem_)




More information about the Orxonox-commit mailing list