Changeset 8941 for code/branches
- Timestamp:
- Nov 16, 2011, 5:02:12 PM (13 years ago)
- Location:
- code/branches/gamecontent/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamecontent/src/modules/weapons/weaponmodes/LightningGun.cc
r8855 r8941 52 52 this->reloadTime_ = 1.0f; 53 53 this->damage_ = 0.0f; 54 this->speed_ = 250.0f;54 this->speed_ = 700.0f; 55 55 56 56 this->setMunitionName("LaserMunition"); -
code/branches/gamecontent/src/orxonox/gametypes/Mission.cc
r8923 r8941 30 30 //#include "TeamGametype.h" 31 31 #include "items/Engine.h" 32 #include "controllers/ArtificialController.h" 32 33 33 34 #include "core/CoreIncludes.h" … … 70 71 { 71 72 Gametype::start(); 72 73 this->setTeams(); 73 74 /*for (ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it != ObjectList<Engine>::end(); ++it) 74 75 it->setActive(false); // works -> @sr :*/ … … 87 88 * */ 88 89 } 90 91 void Mission::setTeams() 92 { 93 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) 94 this->setObjectColour(*it); 95 } 96 97 98 89 99 } -
code/branches/gamecontent/src/orxonox/gametypes/Mission.h
r8923 r8941 46 46 virtual void start(); 47 47 virtual void end(); 48 virtual void setTeams(); 48 49 virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command 49 50 inline void setLives(unsigned int amount) -
code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc
r8930 r8941 35 35 #include "worldentities/TeamSpawnPoint.h" 36 36 #include "worldentities/pawns/Pawn.h" 37 #include "controllers/ArtificialController.h" 37 38 38 39 namespace orxonox … … 70 71 { 71 72 Gametype::playerEntered(player); 73 if(player == NULL) return; 72 74 this->findAndSetTeam(player); 75 if( getNumberOfPlayers() < maxPlayers_ || maxPlayers_ == 0) 76 this->allowedInGame_[player]= true; 77 else 78 this->allowedInGame_[player]= false; 73 79 } 74 80 … … 108 114 void TeamGametype::spawnDeadPlayersIfRequested() 109 115 { 110 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); 111 ++it) 112 if (it->second.state_ == PlayerState::Dead) 113 { 114 if ((it->first->isReadyToSpawn() || this->bForceSpawn_)) 115 { 116 this->spawnPlayer(it->first); 116 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)\ 117 { 118 if(true)//check if dead player is allowed to enter -> if maximum nr of players is exceeded & player was not in game before: disallow 119 continue; 120 if (it->second.state_ == PlayerState::Dead) 121 { 122 if ((it->first->isReadyToSpawn() || this->bForceSpawn_)) 123 { 124 this->spawnPlayer(it->first); 125 } 117 126 } 118 127 } … … 209 218 return; 210 219 220 this->setTeamColour(player,pawn); 221 } 222 223 bool TeamGametype::pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2) 224 { 225 if (pawn1 && pawn2) 226 { 227 std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer()); 228 std::map<PlayerInfo*, int>::const_iterator it2 = this->teamnumbers_.find(pawn2->getPlayer()); 229 230 if (it1 != this->teamnumbers_.end() && it2 != this->teamnumbers_.end()) 231 return (it1->second == it2->second); 232 } 233 return false; 234 } 235 236 int TeamGametype::getTeam(PlayerInfo* player) 237 { 238 std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player); 239 if (it_player != this->teamnumbers_.end()) 240 return it_player->second; 241 else 242 return -1; 243 } 244 245 void TeamGametype::setTeamColour(PlayerInfo* player, Pawn* pawn) 246 { 211 247 // Set the team colour 212 248 std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player); … … 230 266 } 231 267 232 bool TeamGametype::pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2) 233 { 234 if (pawn1 && pawn2) 235 { 236 std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer()); 237 std::map<PlayerInfo*, int>::const_iterator it2 = this->teamnumbers_.find(pawn2->getPlayer()); 238 239 if (it1 != this->teamnumbers_.end() && it2 != this->teamnumbers_.end()) 240 return (it1->second == it2->second); 241 } 242 return false; 243 } 244 245 int TeamGametype::getTeam(PlayerInfo* player) 246 { 247 std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player); 248 if (it_player != this->teamnumbers_.end()) 249 return it_player->second; 250 else 251 return -1; 252 } 268 void TeamGametype::setObjectColour(Pawn* pawn) 269 { 270 if(pawn == NULL) 271 return; 272 //get Pawn's controller 273 ArtificialController* controller = orxonox_cast<ArtificialController*>(pawn); 274 if(controller == NULL) 275 return; 276 //get Teamnumber - get the data 277 int teamnumber= controller->getTeam(); 278 if(teamnumber < 0) 279 return; 280 //set ObjectColour 281 pawn->setRadarObjectColour(this->teamcolours_[teamnumber]); 282 283 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); 284 for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it) 285 { 286 if ((*it)->isA(Class(TeamColourable))) 287 { 288 TeamColourable* tc = orxonox_cast<TeamColourable*>(*it); 289 tc->setTeamColour(this->teamcolours_[teamnumber]); 290 } 291 } 292 } 293 294 253 295 } -
code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h
r8930 r8941 73 73 //unsigned int playersPerTeam_; //<! Defines Maximum for players per team. Value 0: no maximum! 74 74 unsigned int maxPlayers_; //<! Defines Maximum for number of players. Value 0 : no maximum! 75 std::map<PlayerInfo*, bool> allowedInGame_; //!< Only those players are allowed to spawn which are listed here as 'true'. 76 void setTeamColour(PlayerInfo* player, Pawn* pawn); 77 void setObjectColour(Pawn* pawn); 75 78 }; 76 79 }
Note: See TracChangeset
for help on using the changeset viewer.