Changeset 3084 for code/trunk/src/orxonox/objects/worldentities/pawns
- Timestamp:
- May 26, 2009, 9:20:57 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
r3073 r3084 39 39 #include "objects/worldentities/ParticleSpawner.h" 40 40 #include "objects/worldentities/ExplosionChunk.h" 41 41 42 #include "objects/weaponsystem/WeaponSystem.h" 42 43 #include "objects/weaponsystem/WeaponSlot.h" … … 44 45 #include "objects/weaponsystem/WeaponSet.h" 45 46 47 #include "network/NetworkFunction.h" 48 46 49 namespace orxonox 47 50 { 48 51 CreateFactory(Pawn); 52 53 registerMemberNetworkFunction( Pawn, doFire ); 49 54 50 55 Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator) … … 123 128 SUPER(Pawn, tick, dt); 124 129 125 if (this->weaponSystem_ && GameMode::isMaster())126 {127 for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++)128 if (this->fire_ & WeaponSystem::getFiremodeMask(firemode))129 this->weaponSystem_->fire(firemode);130 131 if (this->bReload_)132 this->weaponSystem_->reload();133 }134 135 this->fire_ = this->firehack_;136 this->firehack_ = 0x0;130 // if (this->weaponSystem_ && GameMode::isMaster()) 131 // { 132 // for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++) 133 // if (this->fire_ & WeaponSystem::getFiremodeMask(firemode)) 134 // this->weaponSystem_->fire(firemode); 135 // 136 // if (this->bReload_) 137 // this->weaponSystem_->reload(); 138 // } 139 // 140 // this->fire_ = this->firehack_; 141 // this->firehack_ = 0x0; 137 142 this->bReload_ = false; 138 143 139 if (this->health_ <= 0) 144 if (GameMode::isMaster()) 145 if (this->health_ <= 0) 140 146 this->death(); 141 147 } … … 263 269 void Pawn::fire(unsigned int firemode) 264 270 { 265 this->firehack_ |= WeaponSystem::getFiremodeMask(firemode); 271 this->doFire(firemode); 272 } 273 274 void Pawn::doFire(uint8_t firemode) 275 { 276 if(GameMode::isMaster()) 277 { 278 if (this->weaponSystem_) 279 this->weaponSystem_->fire(firemode); 280 } 281 else 282 { 283 callMemberNetworkFunction(Pawn, doFire, this->getObjectID(), 0, ((uint8_t)firemode)); 284 if (this->weaponSystem_) 285 this->weaponSystem_->fire(firemode); 286 } 266 287 } 267 288 -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
r3073 r3084 79 79 virtual void fire(unsigned int firemode); 80 80 virtual void reload(); 81 virtual void doFire(uint8_t firemode); 81 82 virtual void postSpawn(); 82 83
Note: See TracChangeset
for help on using the changeset viewer.