[Orxonox-commit 2839] r7542 - in code/branches/lastmanstanding: data/levels src/orxonox/gametypes
jo at orxonox.net
jo at orxonox.net
Thu Oct 14 23:02:58 CEST 2010
Author: jo
Date: 2010-10-14 23:02:57 +0200 (Thu, 14 Oct 2010)
New Revision: 7542
Modified:
code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
Log:
Some cleanup. There's still a nasty bug.
Modified: code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw
===================================================================
--- code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw 2010-10-14 10:55:59 UTC (rev 7541)
+++ code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw 2010-10-14 21:02:57 UTC (rev 7542)
@@ -22,7 +22,7 @@
ambientlight = "0.8, 0.8, 0.8"
skybox = "Orxonox/Starbox"
>
-
+<!----- Spawnpoints ----->
<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"/>
<SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
<SpawnPoint team=0 position="-200,200,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
@@ -30,7 +30,90 @@
<SpawnPoint team=0 position="200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
<SpawnPoint team=0 position="200,200,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
<SpawnPoint team=0 position="200,0,200" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
-
+
+<!-- ----------------random fog ------>
+<?lua
+for i = 1, 100, 1
+do
+j = math.random()
+?>
+
+ <StaticEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>">
+ <attached>
+ <ParticleEmitter position="0,0,0" source="Orxonox/Steam" />
+ </attached>
+ </StaticEntity>
+
+<?lua
+end
+?>
+<!-- Carrier with guns not implemented yet-->
+ <MovableEntity position="-2000,-1000,-2000" pitch="-90" roll="90">
+ <attached>
+ <Model position="0,0,0" scale=10 mesh="Carrier.mesh" />
+ <Model position="0,30,20" scale=10 mesh="pirate.mesh" roll="180" />
+ <Model position="-80,-30,20" scale=10 mesh="pirate.mesh" roll="180" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="70,0,-25" halfExtents="150, 50, 25" />
+ <BoxCollisionShape position="95,75,-16" halfExtents="70, 10, 12" />
+ <BoxCollisionShape position="95,-75,-16" halfExtents="70, 10, 12" />
+ <BoxCollisionShape position="77,47,30" halfExtents="110, 2, 30" />
+ <BoxCollisionShape position="77,-47,30" halfExtents="110, 2, 30" />
+ <BoxCollisionShape position="77,0,50" halfExtents="110, 45, 6" />
+ <BoxCollisionShape position="167,0,70" halfExtents="17, 20, 20" />
+ </collisionShapes>
+ </MovableEntity>
+
+<!-- ---------------- Space Station --------------- -->
+<?lua
+ dofile("includes/CuboidSpaceStation.lua")
+ ?>
+ <StaticEntity scale=1 position="-5000,100,1000" roll=30>
+ <attached>
+ <?lua
+ createSpaceStationPar(65461,2,1,2,1,2,1,100)
+ ?>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,1.0,0" material="Examples/Flare" />
+ </attached>
+ </attached>
+ </StaticEntity>
+<!--
+ <Destroyer position="3500, -2000, -1000" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=500>
+ <attached>
+ <CheckPoint />
+ <Model position="0,0,0" scale="5" mesh="Carrier.mesh"/>
+ <Backlight
+ mainstate=activity
+ active=false
+ scale=0.4
+ name=bltest
+ position=" 7.6, 0, 6"
+ colour="0.2, 0.65, 1.0, 1.0"
+ width=15
+ length=1500
+ lifetime=2
+ elements=50
+ trailmaterial="Trail/backlighttrail"
+ turnontime=1
+ turnofftime=1
+ material="Flares/ThrusterFlare1"
+ />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="70,0,-25" halfExtents="150, 50, 25" />
+ <BoxCollisionShape position="95,75,-16" halfExtents="70, 10, 12" />
+ <BoxCollisionShape position="95,-75,-16" halfExtents="70, 10, 12" />
+ <BoxCollisionShape position="77,47,30" halfExtents="110, 2, 30" />
+ <BoxCollisionShape position="77,-47,30" halfExtents="110, 2, 30" />
+ <BoxCollisionShape position="77,0,50" halfExtents="110, 45, 6" />
+ <BoxCollisionShape position="167,0,70" halfExtents="17, 20, 20" />
+ </collisionShapes>
+ </Destroyer>
+-->
+
+
</Scene>
</Level>
Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc 2010-10-14 10:55:59 UTC (rev 7541)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc 2010-10-14 21:02:57 UTC (rev 7542)
@@ -47,6 +47,18 @@
this->timeRemaining=20.0f;
}
+ void LastManStanding::spawnDeadPlayersIfRequested()
+ {
+ for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+ if (it->second.state_ == PlayerState::Dead)
+ {
+ bool alive = (0<playerLives_[it->first]);
+ if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
+ this->spawnPlayer(it->first);
+ }
+ }
+
+
void LastManStanding::setConfigValues()
{
SetConfigValue(lives, 4);
@@ -65,10 +77,10 @@
bool LastManStanding::allowPawnDeath(Pawn* victim, Pawn* originator)
{
- if (!victim)// only for safety
+ if (!victim||!victim->getPlayer())// only for safety
return true;
- playerLives_[victim->getPlayer()]--;
- if (!playerLives_[victim->getPlayer()])//if player lost all lives
+ playerLives_[victim->getPlayer()]=playerLives_[victim->getPlayer()]-1;
+ if (playerLives_[victim->getPlayer()]<=0)//if player lost all lives
{
this->playersAlive--;
const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
@@ -182,20 +194,21 @@
{
if(!player)
return;
- std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
+ std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);//!!!!!!!!!!!
if (it != this->players_.end())
{
it->second.state_ = PlayerState::Dead;//-------------killpart
it->second.killed_++;
- playerLives_[player]--;//-----------datapart
- if (!playerLives_[player])//if player lost all lives
+ playerLives_[player]=playerLives_[player]-1;//-----------datapart
+ if (playerLives_[player]<=0)//if player lost all lives
{
this->playersAlive--;
- const std::string& message = player->getName() + " has lost all lives";
+ const std::string& message = player->getName() + " is out";
COUT(0) << message << std::endl;
Host::Broadcast(message);
}
+ this->timeToAct_[player]=timeRemaining+3.0f;//reset timer
}
}
@@ -214,22 +227,12 @@
it->second-=dt;
if (it->second<0.0f)
{
- it->second=timeRemaining+3.0f;
- this->killPlayer(it->first);
+ it->second=timeRemaining+3.0f;//reset timer
+ if (playerGetLives(it->first)>0)
+ this->killPlayer(it->first);
}
}
}
}
- void LastManStanding::spawnDeadPlayersIfRequested()
- {
- for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
- if (it->second.state_ == PlayerState::Dead)
- {
- bool alive = (0<playerLives_[it->first]);
- if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
- this->spawnPlayer(it->first);
- }
- }
-
}
Modified: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h
===================================================================
--- code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h 2010-10-14 10:55:59 UTC (rev 7541)
+++ code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h 2010-10-14 21:02:57 UTC (rev 7542)
@@ -59,15 +59,15 @@
int playersAlive; //!< Counter counting players with more than 0 lives.
float timeRemaining; //!< Each player has a certain time where he or she has to hit an opponent or will be punished.
std::map<PlayerInfo*, float> timeToAct_; //!< Each player's time till she/he will be punished is stored here.
- virtual void spawnDeadPlayersIfRequested();
+ virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn
public:
LastManStanding(BaseObject* creator); //!< Default Constructor.
virtual ~LastManStanding() {} //!< Default Destructor.
void setConfigValues(); //!< Makes values configurable.
- virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponet, his punishment countdown will be resetted.
- virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each lives.
+ virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.
+ virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each players lives.
virtual void start(); //!< Sends a start message.
virtual void end(); //!< Sends an end message.
@@ -77,9 +77,9 @@
virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
- const int playerGetLives(PlayerInfo* player);
- void killPlayer(PlayerInfo* player);
- void tick (float dt);// used to end the game
+ const int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_"
+ void killPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".
+ void tick (float dt); //!< used to end the game
};
}
More information about the Orxonox-commit
mailing list