[Orxonox-commit 2878] r7581 - in code/branches/lastmanstanding: data/overlays src/orxonox/gametypes
jo at orxonox.net
jo at orxonox.net
Mon Oct 25 22:21:53 CEST 2010
Author: jo
Date: 2010-10-25 22:21:53 +0200 (Mon, 25 Oct 2010)
New Revision: 7581
Added:
code/branches/lastmanstanding/data/overlays/lastmanstandinghud.oxo
Modified:
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
Log:
Almost finished. Yeay.
Added: code/branches/lastmanstanding/data/overlays/lastmanstandinghud.oxo
===================================================================
--- code/branches/lastmanstanding/data/overlays/lastmanstandinghud.oxo (rev 0)
+++ code/branches/lastmanstanding/data/overlays/lastmanstandinghud.oxo 2010-10-25 20:21:53 UTC (rev 7581)
@@ -0,0 +1,23 @@
+<Template name="LastmanstandingHUD">
+ <OverlayGroup name="DynamicmatcHUD" scale = "1, 1">
+
+ <GametypeStaticMessage
+ name = "staticmessage"
+ position = "0.5, 0.01"
+ font = "VeraMono"
+ caption = ""
+ textsize = 0.033
+ colour = "1.0, 1.0, 0.5, 1.0"
+ align = "center"
+ />
+
+<GametypeFadingMessage
+ name = "fadingmessage"
+ position = "0.5, 0.05"
+ font = "VeraMono"
+ textsize = 0.04
+ colour = "1.0, 1.0, 0.5, 1.0"
+ align = "center"
+ />
+ </OverlayGroup>
+</Template>
Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc 2010-10-24 18:33:58 UTC (rev 7580)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc 2010-10-25 20:21:53 UTC (rev 7581)
@@ -235,15 +235,7 @@
else
return 0;
}
- /*BUG-Description:
- *There are two ways for a player to be killed: Either receiving damage, or through the following function.
- *The function works fine - until the last call, when a player looses his last live. Than the kill part
- *(it->second.state_ = PlayerState::Dead;) somehow isn't executed:
- *The player isn't killed (he doesn't leave play). Although the corresponding code is reached.
- *
- *How to reproduce this bug: Start a new Lastmanstanding-Match. Immdiately add 8 bots(before actually entering the level).
- *Just fly around and wait. Don't shoot, since only passive behaviour triggers the killPlayer-Function.
- */
+
void LastManStanding::killPlayer(PlayerInfo* player)
{
if(!player)
@@ -251,34 +243,22 @@
std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
if (it != this->players_.end())
{
- if (playerLives_[player]<=1)//if player lost all lives
- {
- this->playersAlive--;
- const std::string& message = player->getName() + " is out";
- COUT(0) << message << std::endl;
- Host::Broadcast(message);
- playerLives_[player]=playerLives_[player]-1;//-----------datapart
- it->second.killed_++;
- it->second.state_ = PlayerState::Dead;//-------------killpart
- }
- else
- {
- playerLives_[player]=playerLives_[player]-1;//-----------datapart
- it->second.killed_++;
- it->second.state_ = PlayerState::Dead;//-------------killpart
-
- this->timeToAct_[player]=timeRemaining+3.0f;//reset timer
- }
-
+ if(!player->getControllableEntity())
+ {return;}
+ Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity());
+ if(!pawn)
+ {return;}
+ pawn->kill();
+ this->timeToAct_[player]=timeRemaining+3.0f;//reset timer
}
}
void LastManStanding::tick(float dt)
{
SUPER(LastManStanding, tick, dt);
- if(!this->hasEnded())
+ if(this->hasStarted()&&(!this->hasEnded()))
{
- if ((this->hasStarted()&&(playersAlive==1)))//last player remaining
+ if ((this->hasStarted()&&(playersAlive<=1)))//last player remaining
{
this->end();
}
More information about the Orxonox-commit
mailing list