Changeset 8735 in orxonox.OLD for branches/script_engine
- Timestamp:
- Jun 22, 2006, 4:54:55 PM (18 years ago)
- Location:
- branches/script_engine/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/defs/class_id.h
r8717 r8735 250 250 CL_SCRIPT = 0x00000651, 251 251 CL_SCRIPT_CLASS = 0x00000652, 252 CL_SCRIPT_TRIGGER = 0x0000065 2,252 CL_SCRIPT_TRIGGER = 0x00000653, 253 253 254 254 -
branches/script_engine/src/lib/lang/class_list.cc
r8316 r8735 235 235 BaseObject* ClassList::getObject(const std::string& objectName, const std::string& className) 236 236 { 237 237 238 ClassList* cl = ClassList::getClassList(className); 238 239 if (cl != NULL) -
branches/script_engine/src/lib/script_engine/script.cc
r8711 r8735 114 114 void Script::addObject(const std::string& className, const std::string& objectName) 115 115 { 116 //printf("Script %p: I am about to add %s of class %s\n",this,objectName.c_str(),className.c_str());116 // printf("Script %p: I am about to add %s of class %s\n",this,objectName.c_str(),className.c_str()); 117 117 118 118 BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS); 119 //printf("The script class for %s is at %p \n",className.c_str(),scriptClass);119 // printf("The script class for %s is at %p \n",className.c_str(),scriptClass); 120 120 WorldObject tmpObj; 121 121 if (scriptClass != NULL) … … 128 128 129 129 BaseObject* object = ClassList::getObject(objectName, className); 130 //printf("%s is at %p \n",objectName.c_str(),object);130 // printf("%s is at %p \n",objectName.c_str(),object); 131 131 if (object != NULL && !objectIsAdded(objectName)) 132 132 { -
branches/script_engine/src/world_entities/script_trigger.cc
r8711 r8735 21 21 #include "state.h" 22 22 23 24 CREATE_SCRIPTABLE_CLASS(ScriptTrigger, CL_SCRIPT_TRIGGER, 25 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 26 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 27 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 28 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 29 ); 23 30 24 31 … … 40 47 scriptIsOk = false; 41 48 triggerLasts = false; 49 addToScript = false; 50 51 if(root != NULL) 52 { 53 42 54 loadParams(root); 43 55 56 printf("%s \n",this->getName()); 57 BaseObject* object = ClassList::getObject(this->getName(), "ScriptTrigger"); 58 // printf("%s \n",object->getName()); 59 60 if(addToScript) 61 { 62 script->addObject( "ScriptTrigger", this->getName()); 63 } 64 65 } 44 66 } 45 67 … … 60 82 void ScriptTrigger::loadParams(const TiXmlElement* root) 61 83 { 62 if(root != NULL) 63 { 84 64 85 WorldEntity ::loadParams(root); 65 86 … … 97 118 .describe("True if the script should only be called once") 98 119 .defaultValues(""); 99 } 100 120 LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript) 121 .describe("True if this scripttrigger should be aviable in the script") 122 .defaultValues(""); 101 123 } 102 124 -
branches/script_engine/src/world_entities/script_trigger.h
r8711 r8735 14 14 #include "script_manager.h" 15 15 #include "script.h" 16 #include "script_class.h" 16 17 17 18 class ScriptTrigger : public WorldEntity … … 42 43 void setFunction(const std::string& function){ this->functionName = function;} 43 44 void setDebugDraw(const bool draw) { this->doDebugDraw = draw; } 45 void setAddToScript(const bool add) { this->addToScript = add; } 44 46 45 47 ///DRAWING … … 57 59 std::string functionName; 58 60 bool doDebugDraw; 59 61 bool addToScript; 60 62 //for internal use 61 63 bool scriptCalled; … … 66 68 }; 67 69 70 68 71 #endif -
branches/script_engine/src/world_entities/space_ships/helicopter.cc
r8495 r8735 36 36 CREATE_FACTORY(Helicopter, CL_HELICOPTER); 37 37 #include "script_class.h" 38 //CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER, NULL); 39 38 CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER, 39 addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp)) 40 ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown)) 41 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 42 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 43 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 44 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 45 46 ); 40 47 41 48 /** -
branches/script_engine/src/world_entities/space_ships/helicopter.h
r8711 r8735 83 83 }; 84 84 85 CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,86 addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp))87 ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown))88 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))89 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))90 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))91 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))92 93 );94 95 96 85 #endif /* _HELICOPTERS_H */
Note: See TracChangeset
for help on using the changeset viewer.