- Timestamp:
- Nov 2, 2010, 10:34:07 PM (14 years ago)
- Location:
- code/branches/lastmanstanding
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw
r7603 r7605 6 6 include("templates/spaceship_assff.oxt") 7 7 include("templates/spaceship_pirate.oxt") 8 include("templates/pickup_representation_templates.oxt") 8 9 ?> 9 10 … … 21 22 skybox = "Orxonox/skypanoramagen1" 22 23 > 23 <!----- Spawnpoints -----> 24 25 <?lua 26 include("includes/pickups.oxi") 27 ?> 28 29 <!----- Spawnpoints 24 30 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/> 25 31 <SpawnPoint team=0 position="-1150,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /> … … 28 34 <SpawnPoint team=0 position="700,0,-700" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /> 29 35 <SpawnPoint team=0 position="0,0,-1150" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /> 30 <SpawnPoint team=0 position="0,0,1150" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /> 36 <SpawnPoint team=0 position="0,0,1150" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /> -----> 31 37 <Bot /> 32 38 … … 41 47 </collisionShapes> 42 48 </StaticEntity> 43 <!--StaticEntity position="0,0,0" collisionType=static> 44 <collisionShapes> 45 <SphereCollisionShape radius="145" /> 46 </collisionShapes> 47 </StaticEntity--> 49 50 <PickupSpawner position="-160,65,10" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"><!--EasterEgg--> 51 <pickup> 52 <InvisiblePickup template=mediuminvisiblepickup /> 53 </pickup> 54 </PickupSpawner> 55 <PickupSpawner position="-160,60,17" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"><!--EasterEgg--> 56 <pickup> 57 <InvisiblePickup template=hugeinvisiblepickup /> 58 </pickup> 59 </PickupSpawner> 60 <StaticEntity position="-160,60,28.4"><!--EasterEgg-Indicator--> 61 <attached> 62 <Model position="0,0,0" scale=1 mesh="sphere.mesh" /> 63 </attached> 64 </StaticEntity> 48 65 49 66 <!-- ---------------asteroid dome----------------- --> … … 54 71 y = math.sin(i/max*6)*750 55 72 z = math.cos(i/max*6)*750 56 x = i*1057 73 ?> 58 74 <?lua … … 62 78 ?> 63 79 64 65 <!--SpawnPoint team=0 position="<?lua print(y*1.4) ?>,0,<?lua print(z*1.4) ?>" spawnclass=SpaceShip pawndesign=spaceshipassff /--> 80 <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 /> 66 81 67 82 <StaticEntity position="<?lua print(y) ?>,0,<?lua print(z) ?>" scale=<?lua print(j * 2) ?> collisionType=static > … … 83 98 <BoxCollisionShape halfExtents="45,100,45" position = "0,0,0" /> 84 99 </collisionShapes> 85 </StaticEntity> #100 </StaticEntity> 86 101 87 102 <StaticEntity position="<?lua print(y) ?>,200,<?lua print(z) ?>" scale=<?lua print(j * 2) ?> collisionType=static > … … 116 131 117 132 <!-- ---------Top Asteroid----------- --> 118 119 133 <StaticEntity position="<?lua print(y) ?>,300,<?lua print(z) ?>" scale=<?lua print(j * 2.1) ?> pitch="90" roll="180" yaw="<?lua print(-90+i*360/max) ?>" collisionType=static > 120 134 <attached> … … 128 142 129 143 130 131 144 <?lua 132 145 end … … 134 147 <?lua end ?> 135 148 136 137 138 139 149 </Scene> 140 150 </Level> -
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
r7602 r7605 35 35 #include "core/ConfigValueIncludes.h" 36 36 #include "util/Convert.h" 37 //TODO: respawn delay 37 38 38 namespace orxonox 39 39 { … … 48 48 this->timeRemaining=15.0f; 49 49 this->respawnDelay=4.0f; 50 this->noPunishment=false; 51 this->hardPunishment=false; 52 this->punishDamageRate=0.4f; 50 53 this->setHUDTemplate("LastmanstandingHUD"); 51 54 } … … 84 87 SetConfigValue(timeRemaining, 15.0f); 85 88 SetConfigValue(respawnDelay, 4.0f); 89 SetConfigValue(noPunishment, false); 90 SetConfigValue(hardPunishment, false); 86 91 } 87 92 … … 91 96 { 92 97 this->timeToAct_[originator->getPlayer()]=timeRemaining; 98 99 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer()); 100 if (it != this->players_.end()) 101 { 102 if (it->first->getClientID()== CLIENTID_UNKNOWN) 103 return true; 104 const std::string& message = ""; // set blank - erases Camper-Warning-message 105 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 106 } 93 107 } 94 108 return true; … … 111 125 } 112 126 127 int LastManStanding::getMinLives() 128 { 129 int min=lives; 130 for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it) 131 { 132 if (it->second<=0) 133 continue; 134 if (it->second<lives) 135 min=it->second; 136 } 137 return min; 138 } 139 113 140 void LastManStanding::end() 114 141 { … … 127 154 } 128 155 156 129 157 void LastManStanding::playerEntered(PlayerInfo* player) 130 158 { … … 132 160 return; 133 161 Deathmatch::playerEntered(player); 134 135 playerLives_[player]=lives; 162 if (playersAlive<=1) 163 playerLives_[player]=lives; 164 else 165 playerLives_[player]=getMinLives();//new players only get minimum of lives 136 166 this->playersAlive++; 137 167 this->timeToAct_[player]=timeRemaining; … … 154 184 { 155 185 this->playersAlive--; 156 //this->playerLives_[player].erase (player); not necessary? 186 this->playerLives_.erase (player); 187 this->playerDelayTime_.erase (player); 188 this->inGame_.erase (player); 157 189 //Update: EachPlayer's "Players in Game"-HUD 158 190 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) … … 207 239 } 208 240 209 void LastManStanding:: killPlayer(PlayerInfo* player)241 void LastManStanding::punishPlayer(PlayerInfo* player) 210 242 { 211 243 if(!player) 244 return; 245 if(noPunishment) 212 246 return; 213 247 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player); … … 215 249 { 216 250 if(!player->getControllableEntity()) 217 {return;}251 return; 218 252 Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity()); 219 253 if(!pawn) 220 {return;} 221 pawn->kill(); 222 this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer 223 } 224 } 225 254 return; 255 if(hardPunishment) 256 { 257 pawn->kill(); 258 this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer 259 } 260 /*else 261 { 262 float damage=pawn->getMaxHealth()*punishDamageRate*0.5; 263 pawn->removeHealth(damage); 264 this->timeToAct_[player]=timeRemaining;//reset timer 265 }*/ 266 } 267 } 268 226 269 void LastManStanding::tick(float dt) 227 270 { … … 231 274 if ((this->hasStarted()&&(playersAlive<=1)))//last player remaining 232 275 { 233 this->end();276 this->end(); 234 277 } 235 278 for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it) … … 243 286 if (playerDelayTime_[it->first]<=0) 244 287 this->inGame_[it->first]=true; 288 289 if (it->first->getClientID()== CLIENTID_UNKNOWN) 290 continue; 291 int output=1+playerDelayTime_[it->first]; 292 const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown 293 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 245 294 } 246 295 else if (it->second<0.0f) … … 248 297 it->second=timeRemaining+3.0f;//reset punishment-timer 249 298 if (playerGetLives(it->first)>0) 250 this-> killPlayer(it->first);251 } 252 else if (it->second<timeRemaining/ 6)//Warning message299 this->punishPlayer(it->first); 300 } 301 else if (it->second<timeRemaining/5)//Warning message 253 302 { 254 303 if (it->first->getClientID()== CLIENTID_UNKNOWN) -
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
r7596 r7605 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 virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn 60 bool noPunishment; 61 bool hardPunishment; 62 float punishDamageRate; 63 virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn. 64 virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped; 61 65 62 66 public: … … 75 79 76 80 const int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_". 77 void killPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".81 void punishPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining". 78 82 void tick (float dt); //!< used to end the game 79 83 };
Note: See TracChangeset
for help on using the changeset viewer.