- Timestamp:
- Jan 31, 2007, 5:39:05 AM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/npcs/npc.cc
r10542 r10545 73 73 ->addMethod("setAI", Executor1<NPC, lua_State*, bool>(&NPC::setAI)) 74 74 ->addMethod("setVisibility", Executor1<WorldEntity, lua_State*, bool>(&WorldEntity::setVisibility)) 75 ->addMethod("destroy", Executor0<NPC, lua_State*/*, WorldEntity**/>(&NPC::destroy ))75 ->addMethod("destroy", Executor0<NPC, lua_State*/*, WorldEntity**/>(&NPC::destroyThis)) 76 76 ); 77 77 … … 81 81 this->registerObject(this, NPC::_objectList); 82 82 83 this->toList(OM_GROUP_0 1);83 this->toList(OM_GROUP_00); 84 84 this->bAIEnabled = false; 85 85 … … 262 262 } 263 263 264 void NPC::destroy( /*WorldEntity* killer*/)264 void NPC::destroy( WorldEntity* killer ) 265 265 { 266 266 … … 314 314 //} 315 315 316 this->toList(OM_NULL); 317 this->setAI( false); 318 this->setAbsCoor(-10000,-10000,-10000); 319 320 316 321 } 317 322 … … 430 435 void NPC::hit( float damage, WorldEntity* killer) 431 436 { 437 this->destroy( killer); 432 438 this->setDamage(killer->getDamage()); 433 439 } -
trunk/src/world_entities/npcs/npc.h
r10539 r10545 35 35 void setAI(bool activate); 36 36 inline void enableAI(int flag) { this->bAIEnabled = (bool)flag; } 37 void destroy( /*WorldEntity* killer*/);37 void destroy( WorldEntity* killer ); 38 38 39 39 void hit( float damage, WorldEntity* killer); 40 41 inline void destroyThis() { this->destroy(NULL);}; 40 42 41 43 private: -
trunk/src/world_entities/projectiles/hbolt.cc
r10511 r10545 20 20 #include "state.h" 21 21 #include "model.h" 22 #include "world_entities/npcs/npc.h" 22 23 23 24 #include "particles/dot_emitter.h" … … 147 148 this->angle += this->rotationSpeed * dt; 148 149 149 for( ObjectList< Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)150 for( ObjectList<NPC>::const_iterator eIterator = NPC::objectList().begin(); eIterator !=NPC::objectList().end(); eIterator++) 150 151 { 151 if( ((*eIterator)->getOMListNumber() != (this->origList -1)) 152 if( ((*eIterator)->getOMListNumber() != (this->origList -1)) && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8) 152 153 { 153 (*eIterator)-> hit (this->getDamage(),this);154 (*eIterator)->destroy(this); //hit (this->getDamage(),this); 154 155 this->deactivate(); 155 156 PRINTF(0)("HBolt destroyed\n"); -
trunk/src/world_entities/projectiles/lbolt.cc
r10511 r10545 22 22 #include "state.h" 23 23 #include "model.h" 24 25 #include "world_entities/npcs/npc.h" 24 26 25 27 #include "particles/dot_emitter.h" … … 148 150 angle += rotationSpeed * dt; 149 151 150 for( ObjectList< Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)152 for( ObjectList<NPC>::const_iterator eIterator = NPC::objectList().begin(); eIterator !=NPC::objectList().end(); eIterator++) 151 153 { 152 if( ((*eIterator)->getOMListNumber() != (this->origList -1)) 154 if( ((*eIterator)->getOMListNumber() != (this->origList -1)) && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8) 153 155 { 154 (*eIterator)-> hit (this->getDamage(),this);156 (*eIterator)->destroy(this); //hit (this->getDamage(),this); 155 157 this->deactivate(); 156 158 PRINTF(0)("LBolt destroyed\n"); -
trunk/src/world_entities/projectiles/mbolt.cc
r10420 r10545 22 22 #include "state.h" 23 23 #include "model.h" 24 25 #include "world_entities/npcs/npc.h" 24 26 25 27 #include "particles/dot_emitter.h" … … 176 178 this->trail->tick(dt); 177 179 178 for( ObjectList< Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)180 for( ObjectList<NPC>::const_iterator eIterator = NPC::objectList().begin(); eIterator !=NPC::objectList().end(); eIterator++) 179 181 { 180 182 if( ((*eIterator)->getOMListNumber() != (this->origList -1)) && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8) 181 183 { 182 (*eIterator)-> hit (this->getDamage(),this);184 (*eIterator)->destroy(this); //hit (this->getDamage(),this); 183 185 this->deactivate(); 184 186 PRINTF(0)("MBolt destroyed\n"); -
trunk/src/world_entities/projectiles/swarm_projectile.cc
r10539 r10545 224 224 this->curDir = this->velocity; 225 225 226 if( this->target != NULL && (this->getAbsCoor() - this->target->getAbsCoor()).len() < 3) // FIXMETemp fake workaround for collision :)226 if( this->target != NULL && (this->getAbsCoor() - this->target->getAbsCoor()).len() < 3) // HACK Temp fake workaround for collision :) 227 227 { 228 228 dynamic_cast<WorldEntity*>(target)->destroy(this); //hit(this->getDamage(), this); -
trunk/src/world_entities/weapons/swarm_launcher.cc
r10539 r10545 156 156 bool fired = false; 157 157 158 PRINTF(0)("fire\n");159 158 Projectile* pj = NULL; 160 159 for( ObjectList<NPC>::const_iterator eIterator = NPC::objectList().begin(); eIterator !=NPC::objectList().end(); eIterator++)
Note: See TracChangeset
for help on using the changeset viewer.