Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9214 in orxonox.OLD for branches/presentation


Ignore:
Timestamp:
Jul 5, 2006, 12:20:34 PM (18 years ago)
Author:
rennerc
Message:

new weapon demage

Location:
branches/presentation/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/creatures/fps_player.cc

    r9213 r9214  
    169169
    170170  this->initWeapon = false;
     171  this->damageTicker = 0.0f;
     172
    171173  toList( OM_PLAYERS );
    172174}
     
    275277    this->getWeaponManager().fire();
    276278
    277     WorldEntity* target = this->aimingSystem->getNearestTarget();
    278     if( target != NULL)
     279//     WorldEntity* target = this->aimingSystem->getNearestTarget();
     280//     if( target != NULL)
     281//     {
     282//       PRINTF(0)("hit hit hit, got: %s\n", target->getClassName());
     283//     }
     284//     else
     285//     {
     286//       PRINTF(0)("nothing hit\n");
     287//     }
     288  }
     289
     290
     291  //dealing damage
     292 
     293  if ( State::isOnline() && SharedNetworkData::getInstance()->isGameServer() )
     294  {
     295    this->damageTicker -= time;
     296 
     297    if ( this->damageTicker <= 0.0f && this->beFire() )
    279298    {
    280       PRINTF(0)("hit hit hit, got: %s\n", target->getClassName());
     299      this->damageTicker = 0.25;
     300   
     301      WorldEntity * victim = aimingSystem->getNearestTarget();
     302   
     303      if ( victim )
     304      {
     305        PRINTF(0)("FIRE: hit %s\n", victim->getClassName());
     306        victim->hit( 20, this );
     307      }
     308      else
     309      {
     310        PRINTF(0)("FIRE: nothing hit\n");
     311      }
    281312    }
    282     else
    283     {
    284       PRINTF(0)("nothing hit\n");
    285     }
    286   }
    287 
    288 
     313  }
    289314
    290315
     
    462487  if( State::isOnline())
    463488    toList( OM_PLAYERS );
     489 
     490  this->damageTicker = 0.0f;
    464491}
    465492
  • branches/presentation/src/world_entities/creatures/fps_player.h

    r9166 r9214  
    6565
    6666    AimingSystem*         aimingSystem;        //!< aiming system of the player
     67
     68    float                 damageTicker;        //!< ticker for dealing damage
    6769};
    6870
  • branches/presentation/src/world_entities/playable.h

    r9162 r9214  
    9090  static const std::string& playmodeToString(Playable::Playmode playmode);
    9191  static const std::string playmodeNames[];
     92 
     93  inline bool beFire(){ return this->bFire; }
    9294
    9395protected:
Note: See TracChangeset for help on using the changeset viewer.