Changeset 7617 for code/branches/lastmanstanding/src/orxonox
- Timestamp:
- Nov 5, 2010, 5:58:01 PM (14 years ago)
- Location:
- code/branches/lastmanstanding/src/orxonox/gametypes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
r7605 r7617 48 48 this->timeRemaining=15.0f; 49 49 this->respawnDelay=4.0f; 50 this-> noPunishment=false;51 this-> hardPunishment=false;50 this->bNoPunishment=false; 51 this->bHardPunishment=false; 52 52 this->punishDamageRate=0.4f; 53 53 this->setHUDTemplate("LastmanstandingHUD"); … … 63 63 { 64 64 this->spawnPlayer(it->first); 65 }66 else if ((!inGame_[it->first])&&(0<playerLives_[it->first]))67 {68 if (it->first->getClientID()== CLIENTID_UNKNOWN)69 continue;70 const std::string& message = "Respawn in " +multi_cast<std::string>(respawnDelay)+ " seconds." ;71 this->gtinfo_->sendFadingMessage(message,it->first->getClientID());72 65 } 73 66 else if (0>=playerLives_[it->first]) … … 87 80 SetConfigValue(timeRemaining, 15.0f); 88 81 SetConfigValue(respawnDelay, 4.0f); 89 SetConfigValue( noPunishment, false);90 SetConfigValue( hardPunishment, false);82 SetConfigValue(bNoPunishment, false); 83 SetConfigValue(bHardPunishment, false); 91 84 } 92 85 … … 102 95 if (it->first->getClientID()== CLIENTID_UNKNOWN) 103 96 return true; 104 const std::string& message = ""; // set blank - erases Camper-Warning-message97 const std::string& message = ""; // resets Camper-Warning-message 105 98 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 106 99 } … … 243 236 if(!player) 244 237 return; 245 if( noPunishment)238 if(bNoPunishment) 246 239 return; 247 240 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player); … … 253 246 if(!pawn) 254 247 return; 255 if( hardPunishment)248 if(bHardPunishment) 256 249 { 257 250 pawn->kill(); 258 251 this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer 259 252 } 260 /*else261 { 262 float damage=pawn->getMaxHealth()*punishDamageRate*0.5; 253 else 254 { 255 float damage=pawn->getMaxHealth()*punishDamageRate*0.5;//TODO: Factor 0.5 is hard coded. Where is the ratio between MaxHealth actually defined? 263 256 pawn->removeHealth(damage); 264 257 this->timeToAct_[player]=timeRemaining;//reset timer 265 } */258 } 266 259 } 267 260 } … … 297 290 it->second=timeRemaining+3.0f;//reset punishment-timer 298 291 if (playerGetLives(it->first)>0) 292 { 299 293 this->punishPlayer(it->first); 294 if (it->first->getClientID()== CLIENTID_UNKNOWN) 295 return; 296 const std::string& message = ""; // resets Camper-Warning-message 297 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 298 } 300 299 } 301 300 else if (it->second<timeRemaining/5)//Warning message -
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
r7605 r7617 55 55 float timeRemaining; //!< Each player has a certain time where he or she has to hit an opponent or will be punished. 56 56 std::map<PlayerInfo*, float> timeToAct_; //!< Each player's time till she/he will be punished is stored here. 57 float respawnDelay; 57 float respawnDelay; //!<Time in seconds when a player will respawn after death. 58 58 std::map<PlayerInfo*, float> playerDelayTime_; //!< Stores each Player's delay time. 59 59 std::map<PlayerInfo*, bool> inGame_; //!< Indicates each Player's state. 60 bool noPunishment;61 bool hardPunishment;62 float punishDamageRate; 60 bool bNoPunishment; //!< Config value to switch off Punishment function if it is set to true. 61 bool bHardPunishment; //!< Switches between damage and death as punishment. 62 float punishDamageRate; //!< Makes Damage adjustable. 63 63 virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn. 64 64 virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
Note: See TracChangeset
for help on using the changeset viewer.