Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 14, 2010, 11:02:57 PM (14 years ago)
Author:
jo
Message:

Some cleanup. There's still a nasty bug.

Location:
code/branches/lastmanstanding
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/lastmanstanding/data/levels/gametype_lastmanstanding.oxw

    r7480 r7542  
    2323    skybox       = "Orxonox/Starbox"
    2424  >
    25 
     25<!----- Spawnpoints ----->
    2626    <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"/>
    2727    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
     
    3131    <SpawnPoint team=0 position="200,200,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
    3232    <SpawnPoint team=0 position="200,0,200" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
    33    
     33
     34<!-- ----------------random fog ------>
     35<?lua
     36for i = 1, 100, 1
     37do
     38j = math.random()
     39?>
     40
     41    <StaticEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>">
     42      <attached>
     43        <ParticleEmitter position="0,0,0" source="Orxonox/Steam" />
     44      </attached>
     45    </StaticEntity>
     46
     47<?lua
     48end
     49?>
     50<!-- Carrier with guns not implemented yet-->
     51    <MovableEntity position="-2000,-1000,-2000" pitch="-90" roll="90">
     52      <attached>
     53        <Model position="0,0,0" scale=10 mesh="Carrier.mesh" />
     54        <Model position="0,30,20" scale=10 mesh="pirate.mesh" roll="180" />
     55        <Model position="-80,-30,20" scale=10 mesh="pirate.mesh" roll="180" />
     56      </attached>
     57              <collisionShapes>
     58        <BoxCollisionShape position="70,0,-25"      halfExtents="150, 50, 25" />
     59        <BoxCollisionShape position="95,75,-16"     halfExtents="70, 10, 12" />
     60        <BoxCollisionShape position="95,-75,-16"    halfExtents="70, 10, 12" />
     61        <BoxCollisionShape position="77,47,30"      halfExtents="110, 2, 30" />
     62        <BoxCollisionShape position="77,-47,30"     halfExtents="110, 2, 30" />
     63        <BoxCollisionShape position="77,0,50"       halfExtents="110, 45, 6" />
     64        <BoxCollisionShape position="167,0,70"      halfExtents="17, 20, 20" />
     65      </collisionShapes>
     66    </MovableEntity>
     67
     68<!-- ---------------- Space Station --------------- -->
     69<?lua
     70    dofile("includes/CuboidSpaceStation.lua")
     71  ?>
     72      <StaticEntity scale=1 position="-5000,100,1000" roll=30>
     73        <attached>
     74          <?lua
     75            createSpaceStationPar(65461,2,1,2,1,2,1,100)
     76          ?>
     77            <attached>
     78              <Billboard position="0,0,0" colour="1.0,1.0,0" material="Examples/Flare" />
     79            </attached>
     80        </attached>
     81      </StaticEntity>
     82<!--
     83    <Destroyer position="3500, -2000, -1000" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=500>
     84      <attached>
     85        <CheckPoint />
     86        <Model position="0,0,0" scale="5" mesh="Carrier.mesh"/>
     87        <Backlight
     88          mainstate=activity
     89          active=false
     90          scale=0.4
     91          name=bltest
     92          position=" 7.6, 0, 6"
     93          colour="0.2, 0.65, 1.0, 1.0"
     94          width=15
     95          length=1500
     96          lifetime=2
     97          elements=50
     98          trailmaterial="Trail/backlighttrail"
     99          turnontime=1
     100          turnofftime=1
     101          material="Flares/ThrusterFlare1"
     102        />
     103      </attached>
     104      <collisionShapes>
     105        <BoxCollisionShape position="70,0,-25"      halfExtents="150, 50, 25" />
     106        <BoxCollisionShape position="95,75,-16"     halfExtents="70, 10, 12" />
     107        <BoxCollisionShape position="95,-75,-16"    halfExtents="70, 10, 12" />
     108        <BoxCollisionShape position="77,47,30"      halfExtents="110, 2, 30" />
     109        <BoxCollisionShape position="77,-47,30"     halfExtents="110, 2, 30" />
     110        <BoxCollisionShape position="77,0,50"       halfExtents="110, 45, 6" />
     111        <BoxCollisionShape position="167,0,70"      halfExtents="17, 20, 20" />
     112      </collisionShapes>
     113    </Destroyer>
     114-->
     115
     116
    34117  </Scene>
    35118</Level>
  • code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc

    r7485 r7542  
    4848    }
    4949
     50    void LastManStanding::spawnDeadPlayersIfRequested()
     51    {
     52        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     53            if (it->second.state_ == PlayerState::Dead)
     54            {
     55                bool alive = (0<playerLives_[it->first]);
     56                if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
     57                    this->spawnPlayer(it->first);
     58             }
     59    }
     60
     61
    5062    void LastManStanding::setConfigValues()
    5163    {
     
    6678    bool LastManStanding::allowPawnDeath(Pawn* victim, Pawn* originator)
    6779    {
    68         if (!victim)// only for safety
     80        if (!victim||!victim->getPlayer())// only for safety
    6981            return true;
    70         playerLives_[victim->getPlayer()]--;
    71         if (!playerLives_[victim->getPlayer()])//if player lost all lives
     82        playerLives_[victim->getPlayer()]=playerLives_[victim->getPlayer()]-1;
     83        if (playerLives_[victim->getPlayer()]<=0)//if player lost all lives
    7284        {
    7385            this->playersAlive--;
     
    183195        if(!player)
    184196            return;
    185         std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
     197        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);//!!!!!!!!!!!
    186198        if (it != this->players_.end())
    187199        {
     
    189201            it->second.killed_++;
    190202
    191             playerLives_[player]--;//-----------datapart
    192             if (!playerLives_[player])//if player lost all lives
     203            playerLives_[player]=playerLives_[player]-1;//-----------datapart
     204            if (playerLives_[player]<=0)//if player lost all lives
    193205            {
    194206                this->playersAlive--;
    195                 const std::string& message = player->getName() + " has lost all lives";
     207                const std::string& message = player->getName() + " is out";
    196208                COUT(0) << message << std::endl;
    197209                Host::Broadcast(message);
    198210            }
     211            this->timeToAct_[player]=timeRemaining+3.0f;//reset timer
    199212        }
    200213    }
     
    215228                if (it->second<0.0f)
    216229                {
    217                     it->second=timeRemaining+3.0f;
    218                     this->killPlayer(it->first);
     230                    it->second=timeRemaining+3.0f;//reset timer
     231                    if (playerGetLives(it->first)>0)
     232                        this->killPlayer(it->first);
    219233                }
    220234            }
     
    222236    }
    223237
    224     void LastManStanding::spawnDeadPlayersIfRequested()
    225     {
    226         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    227             if (it->second.state_ == PlayerState::Dead)
    228             {
    229                 bool alive = (0<playerLives_[it->first]);
    230                 if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
    231                     this->spawnPlayer(it->first);
    232              }
    233     }
    234 
    235238}
  • code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h

    r7485 r7542  
    6060            float timeRemaining; //!< Each player has a certain time where he or she has to hit an opponent or will be punished.
    6161            std::map<PlayerInfo*, float> timeToAct_; //!< Each player's time till she/he will be punished is stored here.
    62             virtual void spawnDeadPlayersIfRequested();
     62            virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn
    6363
    6464        public:
     
    6767            void setConfigValues(); //!< Makes values configurable.
    6868
    69             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponet, his punishment countdown will be resetted.
    70             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each lives.
     69            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.
     70            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each players lives.
    7171
    7272            virtual void start(); //!< Sends a start message.
     
    7878            virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
    7979
    80             const int playerGetLives(PlayerInfo* player);
    81             void killPlayer(PlayerInfo* player);
    82             void tick (float dt);// used to end the game
     80            const int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_"
     81            void killPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".
     82            void tick (float dt); //!< used to end the game
    8383    };
    8484}
Note: See TracChangeset for help on using the changeset viewer.