Changeset 9709 in orxonox.OLD for branches/new_class_id/src/world_entities/npcs/gate.cc
- Timestamp:
- Aug 31, 2006, 10:51:08 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/world_entities/npcs/gate.cc
r9406 r9709 25 25 26 26 #include "gate.h" 27 #include "class_list.h"28 29 27 #include "effects/explosion.h" 30 28 … … 33 31 34 32 35 36 CREATE_FACTORY(Gate, CL_GATE); 33 #include "class_id.h" 34 NewObjectListDefinitionID(Gate, CL_GATE); 35 CREATE_FACTORY(Gate); 37 36 38 37 39 38 #include "script_class.h" 40 CREATE_SCRIPTABLE_CLASS(Gate, CL_GATE,39 CREATE_SCRIPTABLE_CLASS(Gate, Gate::classID(), 41 40 addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide)) 42 41 ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide)) 43 ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy)) 42 ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy)) 44 43 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 45 44 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) … … 49 48 50 49 50 51 51 //! list of all different animations a std md2model supports 52 52 sAnim Gate::animationList[3] = … … 62 62 Gate::Gate(const TiXmlElement* root) 63 63 { 64 65 this->setClassID(CL_GATE, "Gate"); 64 this->registerObject(this, Gate::_objectList); 66 65 this->scale = 1.0f; 67 66 this->actionRadius = 1.0; … … 165 164 void Gate::close() 166 165 { 167 166 168 167 if( this->destroyed) 169 168 return; 170 169 171 170 this->setAnimation(GATE_CLOSE, MD2_ANIM_ONCE); 172 171 this->bOpen = false; … … 178 177 if( this->destroyed) 179 178 return; 180 179 181 180 this->setAnimation(GATE_DIE, MD2_ANIM_ONCE); 182 181 183 182 Explosion::explode(this, Vector(this->getScaling()/160,this->getScaling()/160,this->getScaling()/160)); 184 185 183 184 186 185 this->destroyed = true; 187 186 } 188 187 188 #include "playable.h" 189 #include "generic_npc.h" 189 190 190 191 /** … … 195 196 196 197 std::list<BaseObject*>::const_iterator it; 197 const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);198 198 WorldEntity* entity; 199 199 float distance; 200 200 201 if( list == NULL)202 return false;203 204 201 // for all players 205 for( it = list->begin(); it != list->end(); it++) 206 { 207 entity = dynamic_cast<WorldEntity*>(*it); 202 for (NewObjectList<Playable>::const_iterator it = Playable::objectList().begin(); 203 it != Playable::objectList().end(); 204 ++it) 205 { 206 entity = (*it); 208 207 209 208 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len()); … … 213 212 214 213 215 list = ClassList::getList(CL_GENERIC_NPC); 216 if( list == NULL) 217 return false; 218 for( it = list->begin(); it != list->end(); it++) 219 { 220 entity = dynamic_cast<WorldEntity*>(*it); 214 for (NewObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin(); 215 it != GenericNPC::objectList().end(); 216 ++it) 217 { 218 entity = (*it); 221 219 222 220 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
Note: See TracChangeset
for help on using the changeset viewer.