- Timestamp:
- Jun 16, 2007, 11:15:39 AM (18 years ago)
- Location:
- branches/presentation/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/world_entities/creatures/fps_player.cc
r10705 r10708 157 157 wpRight->toList( this->getOMListNumber() ); 158 158 wpRight->setParent( this->cameraNode ); 159 wpRight->setForwardDamageToParent( true ); 159 160 //wpRight->requestAction( WA_ACTIVATE ); 160 161 //wpRight->addChild(this->aimingSystem); -
branches/presentation/src/world_entities/npcs/adm_turret.cc
r10704 r10708 242 242 void AdmTurret::addCannons( const TiXmlElement * root ) 243 243 { 244 this->cannons = new WorldEntity();244 this->cannons = new DamageForwardingWorldEntity( this ); 245 245 this->cannons->setParent(this); 246 246 this->cannons->loadParams( root ); … … 250 250 251 251 this->cannons->toList( getOMListNumber() ); 252 this->cannons->setForwardDamageToParent( true ); 252 253 } 253 254 … … 260 261 //this->weapon->setAbsCoor( this->cannons->getAbsCoor() ); 261 262 this->weapon->setAbsDir( this->weapon->getAbsDir() * Quaternion( PI, Vector(0, 1, 0) ) ); 263 264 this->weapon->setForwardDamageToParent( true ); 262 265 } 263 266 264 267 void AdmTurret::addSensor( const TiXmlElement * root ) 265 268 { 266 this->sensor = new WorldEntity();269 this->sensor = new DamageForwardingWorldEntity( this ); 267 270 this->sensor->setParent(this); 268 271 this->sensor->loadParams( root ); … … 270 273 //this->sensor->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 271 274 //this->sensor->addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE); 272 this->sensor->toList( getOMListNumber() );275 273 276 } 274 277 -
branches/presentation/src/world_entities/npcs/adm_turret.h
r10703 r10708 12 12 #include "world_entity.h" 13 13 #include "weapons/bsp_weapon.h" 14 15 class DamageForwardingWorldEntity: public WorldEntity 16 { 17 public: 18 DamageForwardingWorldEntity( WorldEntity* dfp ){ this->damPar = dfp; } 19 virtual void hit(float damage, WorldEntity* killer){ this->damPar->hit(damage, killer); } 20 private: 21 WorldEntity* damPar; 22 }; 14 23 15 24 -
branches/presentation/src/world_entities/world_entity.cc
r10704 r10708 97 97 this->entityTrack = NULL; 98 98 this->bDrawTrack = false; 99 100 this->forwardDamageToParent = false; 99 101 100 102 // registering default reactions: … … 179 181 LoadParam(root, "drawTrack", this, WorldEntity, drawDebugTrack) 180 182 .describe("draws the track for debugging purposes"); 183 184 LoadParam(root, "forwardDamageToParent", this, WorldEntity, setForwardDamageToParent); 181 185 182 186 // Track … … 980 984 void WorldEntity::hit(float damage, WorldEntity* killer) 981 985 { 982 986 PRINTF(0)("TESTS: %i %i %i\n", (forwardDamageToParent), (this->getParent() != NullParent::getNullParent()), (this->getParent()->isA( WorldEntity::staticClassID() ))); 987 if ( forwardDamageToParent && this->getParent() != NullParent::getNullParent() && this->getParent()->isA( WorldEntity::staticClassID() ) ) 988 { 989 WorldEntity* pa = dynamic_cast<WorldEntity*>(this->getParent()); 990 pa->hit( damage, killer ); 991 return; 992 } 993 994 bool dead = this->getHealth()<=0; 995 983 996 this->decreaseHealth(damage); 984 997 … … 991 1004 else 992 1005 { 993 this->destroy( killer ); 1006 if ( !dead ) 1007 this->destroy( killer ); 994 1008 } 995 1009 } -
branches/presentation/src/world_entities/world_entity.h
r10698 r10708 63 63 void unmount(int slot); 64 64 65 65 void setForwardDamageToParent( bool val ){ this->forwardDamageToParent = val; } 66 66 67 67 /** @param visibility if the Entity should be visible (been draw) */ … … 262 262 //!< started transfering shield/electronic/health from spaceship to WE! (nico, 4.Jun.07) 263 263 264 float damage; //!< the damage dealt to other objects by colliding. 265 float health; //!< The Energy of this Entity, if the Entity has any energy at all. 266 float healthMax; //!< The Maximal energy this entity can take. 264 265 float damage; //!< the damage dealt to other objects by colliding. 266 float health; //!< The Energy of this Entity, if the Entity has any energy at all. 267 bool forwardDamageToParent; //!< if true, damage taken will be forwardet to parent 268 float healthMax; //!< The Maximal energy this entity can take. 267 269 float implantEnergy; //!< energy of implants 268 270 float healthRegen; //!< Regeneration Rate of Health, mesured in units per second
Note: See TracChangeset
for help on using the changeset viewer.