[Orxonox-commit 2914] r7617 - in code/branches/lastmanstanding: data/levels src/orxonox/gametypes

jo at orxonox.net jo at orxonox.net
Fri Nov 5 17:58:01 CET 2010


Author: jo
Date: 2010-11-05 17:58:01 +0100 (Fri, 05 Nov 2010)
New Revision: 7617

Modified:
   code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw
   code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
   code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
Log:
Level is now fixed. Some further minor changes.

Modified: code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw
===================================================================
--- code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw	2010-11-04 21:47:25 UTC (rev 7616)
+++ code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw	2010-11-05 16:58:01 UTC (rev 7617)
@@ -65,17 +65,13 @@
 
 <!-- ---------------asteroid dome----------------- -->
 <?lua
-max = 17
-for i = 1, max, 1
+max = 16
+for i = 0, max, 1
 do
     y = math.sin(i/max*6)*750
     z = math.cos(i/max*6)*750
+    j = 1
     ?>
-<?lua
-for k = 1, 17, 1
-do
-j = math.random()
-?>
 
     <SpawnPoint team=0 position="<?lua print(y*1.4+z*0.2) ?>,0,<?lua print(z*1.4-y*0.2) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
 
@@ -141,9 +137,6 @@
     </StaticEntity>
 
 
-<?lua
-end
-?>
 <?lua end ?>
 
   </Scene>

Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc	2010-11-04 21:47:25 UTC (rev 7616)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc	2010-11-05 16:58:01 UTC (rev 7617)
@@ -47,8 +47,8 @@
         this->playersAlive=0;
         this->timeRemaining=15.0f;
         this->respawnDelay=4.0f;
-        this->noPunishment=false;
-        this->hardPunishment=false;
+        this->bNoPunishment=false;
+        this->bHardPunishment=false;
         this->punishDamageRate=0.4f;
         this->setHUDTemplate("LastmanstandingHUD");
     }
@@ -63,13 +63,6 @@
                 {
                     this->spawnPlayer(it->first);
                 }
-                else if ((!inGame_[it->first])&&(0<playerLives_[it->first]))
-                {
-                    if (it->first->getClientID()== CLIENTID_UNKNOWN)
-                        continue;
-                    const std::string& message = "Respawn in " +multi_cast<std::string>(respawnDelay)+ " seconds." ;
-                    this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
-                }
                 else if (0>=playerLives_[it->first])
                 {
                     if (it->first->getClientID()== CLIENTID_UNKNOWN)
@@ -86,8 +79,8 @@
         SetConfigValue(lives, 4);
         SetConfigValue(timeRemaining, 15.0f);
         SetConfigValue(respawnDelay, 4.0f);
-        SetConfigValue(noPunishment, false);
-        SetConfigValue(hardPunishment, false);
+        SetConfigValue(bNoPunishment, false);
+        SetConfigValue(bHardPunishment, false);
     }
 
     bool LastManStanding::allowPawnDamage(Pawn* victim, Pawn* originator)
@@ -101,7 +94,7 @@
             {
                 if (it->first->getClientID()== CLIENTID_UNKNOWN)
                     return true;
-                const std::string& message = ""; // set blank - erases Camper-Warning-message
+                const std::string& message = ""; // resets Camper-Warning-message
                 this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
             }    
         }
@@ -242,7 +235,7 @@
     {
         if(!player)
             return;
-        if(noPunishment)
+        if(bNoPunishment)
             return;
         std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
         if (it != this->players_.end())
@@ -252,17 +245,17 @@
             Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity());
             if(!pawn)
                 return;
-            if(hardPunishment)
+            if(bHardPunishment)
             {
                 pawn->kill();
                 this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer
             }
-            /*else
+            else
             {
-                float damage=pawn->getMaxHealth()*punishDamageRate*0.5;
+                float damage=pawn->getMaxHealth()*punishDamageRate*0.5;//TODO: Factor 0.5 is hard coded. Where is the ratio between MaxHealth actually defined?
                 pawn->removeHealth(damage);
                 this->timeToAct_[player]=timeRemaining;//reset timer
-            }*/
+            }
         }
     }
 
@@ -296,7 +289,13 @@
                 {
                     it->second=timeRemaining+3.0f;//reset punishment-timer
                     if (playerGetLives(it->first)>0)
+                    {
                         this->punishPlayer(it->first);
+                        if (it->first->getClientID()== CLIENTID_UNKNOWN)
+                            return;
+                        const std::string& message = ""; // resets Camper-Warning-message
+                        this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
+                    }
                 }
                 else if (it->second<timeRemaining/5)//Warning message
                 {

Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h	2010-11-04 21:47:25 UTC (rev 7616)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h	2010-11-05 16:58:01 UTC (rev 7617)
@@ -54,12 +54,12 @@
             int playersAlive; //!< Counter counting players with more than 0 lives.
             float timeRemaining; //!< Each player has a certain time where he or she has to hit an opponent or will be punished.
             std::map<PlayerInfo*, float> timeToAct_; //!< Each player's time till she/he will be punished is stored here.
-            float respawnDelay;
+            float respawnDelay; //!<Time in seconds when a player will respawn after death.
             std::map<PlayerInfo*, float> playerDelayTime_; //!< Stores each Player's delay time.
             std::map<PlayerInfo*, bool> inGame_; //!< Indicates each Player's state.
-            bool noPunishment;
-            bool hardPunishment;
-            float punishDamageRate;
+            bool bNoPunishment; //!< Config value to switch off Punishment function if it is set to true.
+            bool bHardPunishment; //!< Switches between damage and death as punishment.
+            float punishDamageRate; //!< Makes Damage adjustable.
             virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn.
             virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped; 
 




More information about the Orxonox-commit mailing list