Changeset 9941 for code/trunk
- Timestamp:
- Dec 29, 2013, 8:06:44 PM (11 years ago)
- Location:
- code/trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/data/gui/layouts/CreditsMenu.layout
r9016 r9941 46 46 47 47 Credits: 48 http://www.orxonox.net/wiki/credits 49 50 Thanks to AMIV: 51 https://www.amiv.ethz.ch/ 48 52 </Property> 49 53 </Window> -
code/trunk/data/gui/scripts/MiscConfigMenu.lua
r9939 r9941 33 33 table.insert(P.commandList, "UnderAttack gameTime_") 34 34 table.insert(P.commandList, "TeamDeathmatch teams_") 35 table.insert(P.commandList, "TeamDeathmatch maxScore_") 35 36 table.insert(P.commandList, "HumanPlayer nick_") 36 37 table.insert(P.commandList, "ChatOverlay displayTime_") … … 56 57 table.insert(P.nameList, "UnderAttack: game time") 57 58 table.insert(P.nameList, "TeamDeathmatch: Number of teams") 59 table.insert(P.nameList, "TeamDeathmatch: Score needed to end the game") 58 60 table.insert(P.nameList, "Playername") 59 61 table.insert(P.nameList, "Chat: display time") -
code/trunk/data/levels/missionOne.oxw
r9939 r9941 2 2 <LevelInfo 3 3 name = "Mission One" 4 description = " First Guided Steps in the Orxonoxian Universe."4 description = "Codename: Awakening - First Guided Steps in the Orxonoxian Universe." 5 5 screenshot = "missionOne.png" 6 6 tags = "mission" -
code/trunk/data/levels/underAttack.oxw
r9939 r9941 56 56 angularDamping = 0.9999999 57 57 health = 10000 58 maxhealth = 10000 58 maxhealth = 10000000 59 59 initialhealth = 10000 60 60 radarname = "Transporter" … … 62 62 63 63 <attached> 64 <TeamSpawnPoint team=1 position="150,0,7" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 65 <TeamSpawnPoint team=1 position="0,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 66 <TeamSpawnPoint team=1 position="-50,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 67 <TeamSpawnPoint team=1 position="100,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 68 <TeamSpawnPoint team=1 position="50,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 64 <SpaceBoundaries position="1,2,3" maxDistance="1600" warnDistance="300" showDistance="300" reactionMode="1" healthDecrease="5.0" /> 65 <TeamSpawnPoint team=1 position="200,0,20" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 66 <TeamSpawnPoint team=1 position="50,0,100" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 67 <TeamSpawnPoint team=1 position="-200,0,-60" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 68 <TeamSpawnPoint team=1 position="100,0,-50" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 69 <TeamSpawnPoint team=1 position="400,0,20" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /> 69 70 <?lua for i = 1, 100, 1 do ?> 70 71 <TeamSpawnPoint 71 72 team=0 72 position="<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>"73 position="<?lua print((math.random() * 450 + 450) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 450 + 450) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 450 + 450) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>" 73 74 lookat="0,0,0" 74 75 spawnclass=SpaceShip -
code/trunk/src/modules/objects/SpaceBoundaries.cc
r9667 r9941 117 117 this->billboards_[current].usedYet = true; 118 118 119 Vector3 directionVector = (this->get Position() - position).normalisedCopy(); // vector from the position of the billboard to the center of the sphere119 Vector3 directionVector = (this->getWorldPosition() - position).normalisedCopy(); // vector from the position of the billboard to the center of the sphere 120 120 this->billboards_[current].billy->setCommonDirection(directionVector); 121 121 … … 252 252 if(item != NULL) 253 253 { 254 Vector3 itemPosition = item->get Position();255 return (itemPosition.distance(this->get Position()));254 Vector3 itemPosition = item->getWorldPosition(); 255 return (itemPosition.distance(this->getWorldPosition())); 256 256 } else { 257 257 return -1; … … 267 267 { 268 268 269 Vector3 direction = item->get Position() - this->getPosition();269 Vector3 direction = item->getWorldPosition() - this->getWorldPosition(); 270 270 direction.normalise(); 271 271 272 Vector3 boundaryPosition = this->get Position() + direction * this->maxDistance_;272 Vector3 boundaryPosition = this->getWorldPosition() + direction * this->maxDistance_; 273 273 274 274 this->positionBillboard(boundaryPosition, alpha); … … 277 277 void SpaceBoundaries::conditionalBounceBack(Pawn *item, float currentDistance, float dt) 278 278 { 279 Vector3 normal = item->get Position() - this->getPosition();279 Vector3 normal = item->getWorldPosition() - this->getWorldPosition(); 280 280 normal.normalise(); 281 281 Vector3 velocity = item->getVelocity(); … … 300 300 acceleration = acceleration.reflect(*normal); 301 301 302 item->lookAt( *velocity + this->get Position() );302 item->lookAt( *velocity + this->getWorldPosition() ); 303 303 304 304 item->setAcceleration(acceleration * dampingFactor); 305 305 item->setVelocity(*velocity * dampingFactor); 306 306 307 item->setPosition( item->get Position() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.307 item->setPosition( item->getWorldPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary. 308 308 } 309 309 -
code/trunk/src/orxonox/gametypes/LastTeamStanding.cc
r9667 r9941 242 242 party = it2->second; 243 243 } 244 //if (party < 0) return; //if search failed244 if (party < 0) return; //if search failed 245 245 //victory message to all team members, loose message to everyone else 246 for (std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3) 247 { 248 if (it3->first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 249 continue; 250 if (it3->second == party) 251 {this->gtinfo_->sendAnnounceMessage("You have won the match!", it3->first->getClientID());} 252 else 253 {this->gtinfo_->sendAnnounceMessage("You have lost the match!", it3->first->getClientID());} 254 } 246 this->announceTeamWin(party); 247 255 248 return; 256 249 } -
code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc
r9667 r9941 33 33 #include "infos/PlayerInfo.h" 34 34 #include "worldentities/pawns/Pawn.h" 35 #include "core/config/ConfigValueIncludes.h" 35 36 36 37 namespace orxonox … … 41 42 { 42 43 RegisterObject(TeamDeathmatch); 44 45 this->setConfigValues(); 46 } 47 48 void TeamDeathmatch::setConfigValues() 49 { 50 SetConfigValue(maxScore_, 10); 43 51 } 44 52 … … 57 65 std::string message("The match has ended."); 58 66 ChatManager::message(message); 67 68 //find team that won the match 69 int winnerTeam = 0; 70 int highestScore = 0; 71 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 72 { 73 if ( this->getTeamScore(it->first) > highestScore ) 74 { 75 winnerTeam = this->getTeam(it->first); 76 highestScore = this->getTeamScore(it->first); 77 } 78 } 79 80 //announce win 81 this->announceTeamWin(winnerTeam); 59 82 } 60 83 … … 100 123 { 101 124 if (killer->getPlayer()) 125 { 102 126 message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName(); 127 if(this->isExactlyA(Class(TeamDeathmatch)) && (this->getTeamScore(killer->getPlayer()) >= (this->maxScore_ -1)) ) 128 this->end(); 129 } 103 130 else 104 131 message = victim->getPlayer()->getName() + " was killed"; -
code/trunk/src/orxonox/gametypes/TeamDeathmatch.h
r9667 r9941 41 41 virtual ~TeamDeathmatch() {} 42 42 43 void setConfigValues(); 43 44 virtual void start(); 44 45 virtual void end(); … … 49 50 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 50 51 virtual void playerScored(PlayerInfo* player, int score = 1); 52 protected: 53 int maxScore_; 51 54 }; 52 55 } -
code/trunk/src/orxonox/gametypes/TeamGametype.cc
r9667 r9941 173 173 } 174 174 175 int TeamGametype::getTeamScore(PlayerInfo* player) 176 { 177 int teamscore = 0; 178 if(!player || this->getTeam(player) == -1) 179 return 0; 180 for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 181 { 182 if ( this->getTeam(it->first) == this->getTeam(player) ) 183 { 184 teamscore += it->second.frags_; 185 } 186 } 187 return teamscore; 188 } 189 190 int TeamGametype::getTeamSize(int team) 191 { 192 int teamSize = 0; 193 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it) 194 { 195 if (it->second == team) 196 teamSize++; 197 } 198 return teamSize; 199 } 200 201 int TeamGametype::getHumansInTeam(int team) 202 { 203 int teamSize = 0; 204 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it) 205 { 206 if (it->second == team && it->first->isHumanPlayer()) 207 teamSize++; 208 } 209 return teamSize; 210 } 211 212 175 213 SpawnPoint* TeamGametype::getBestSpawnPoint(PlayerInfo* player) const 176 214 { … … 336 374 } 337 375 376 void TeamGametype::announceTeamWin(int winnerTeam) 377 { 378 for (std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3) 379 { 380 if (it3->first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 381 continue; 382 if (it3->second == winnerTeam) 383 { 384 this->gtinfo_->sendAnnounceMessage("Your team has won the match!", it3->first->getClientID()); 385 } 386 else 387 { 388 this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", it3->first->getClientID()); 389 } 390 } 391 } 392 338 393 } -
code/trunk/src/orxonox/gametypes/TeamGametype.h
r9667 r9941 62 62 inline const ColourValue& getTeamColour(int teamnr) const 63 63 { return this->teamcolours_[teamnr]; } 64 int getTeamScore(PlayerInfo* player); 65 int getTeamSize(int team); 66 int getHumansInTeam(int team); 64 67 65 68 protected: … … 77 80 void setDefaultObjectColour(Pawn* pawn); 78 81 void colourPawn(Pawn* pawn, int teamNr); 82 void announceTeamWin(int winnerTeam); 83 79 84 }; 80 85 } -
code/trunk/src/orxonox/gametypes/UnderAttack.cc
r9667 r9941 38 38 namespace orxonox 39 39 { 40 const int attacker_ = 0; // teamnumber of the attacking team 41 const int defender_ = 1; // defender's teamnumber 42 40 43 RegisterUnloadableClass(UnderAttack); 41 44 … … 76 79 continue; 77 80 78 if (it->second == 0)81 if (it->second == attacker_) 79 82 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID()); 80 83 else … … 188 191 } 189 192 } 193 194 void UnderAttack::playerEntered(PlayerInfo* player) 195 { 196 if (!player) 197 return; 198 TeamDeathmatch::playerEntered(player); 199 this->setTransporterHealth(); 200 } 201 202 void UnderAttack::setTransporterHealth() 203 { 204 if (this->destroyer_ != 0) 205 { 206 //Calculation: Each attacker deals about 3500 damage. A human attacker deals 1500 damage additionally. 207 //Each defender prevents 500 damage. If human 2000 damage will be additionally be prevented. 208 //TODO: use gametime and the damage dealt so far in order to calculate the transporter's life more precisely 209 float health = this->getTeamSize(attacker_)*2000.0f + this->getHumansInTeam(attacker_)*3000.0f - this->getTeamSize(defender_)*500.0f - this->getHumansInTeam(defender_)*2000.0f ; 210 this->destroyer_->setHealth(std::max(health, 5000.0f)); //the destoyer should have at least 5000.0f life. 211 } 212 } 213 214 190 215 } -
code/trunk/src/orxonox/gametypes/UnderAttack.h
r9667 r9941 51 51 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); 52 52 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); 53 virtual void playerEntered(PlayerInfo* player); 53 54 54 55 protected: 55 56 virtual void killedDestroyer(); 57 void setTransporterHealth(); 56 58 57 59 WeakPtr<Destroyer> destroyer_;
Note: See TracChangeset
for help on using the changeset viewer.