Changeset 8869 in orxonox.OLD
- Timestamp:
- Jun 28, 2006, 4:48:16 PM (18 years ago)
- Location:
- branches/single_player_map/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/script_engine/script_manager.h
r8711 r8869 1 1 /*! 2 * @file scrip _manager.h2 * @file script_manager.h 3 3 * manages the scripts 4 4 */ -
branches/single_player_map/src/world_entities/creatures/fps_player.cc
r8776 r8869 35 35 36 36 CREATE_FACTORY(FPSPlayer, CL_FPS_PLAYER); 37 38 #include "script_class.h" 39 CREATE_SCRIPTABLE_CLASS(FPSPlayer, CL_FPS_PLAYER, 40 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 41 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 42 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 43 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 44 ); 37 45 38 46 -
branches/single_player_map/src/world_entities/npcs/generic_npc.cc
r8847 r8869 40 40 #include "script_class.h" 41 41 CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC, 42 //addMethod("walkTo", ExecutorLua7ret<GenericNPC,float, float, float, float, float, float, float, float>(&GenericNPC::walkTo))42 // Move 43 43 addMethod("walkTo", ExecutorLua3ret<GenericNPC,float,float,float,float>(&GenericNPC::walkTo)) 44 44 ->addMethod("setTime", ExecutorLua1<GenericNPC,float>(&GenericNPC::setTime)) 45 45 ->addMethod("turnTo", ExecutorLua4ret<GenericNPC,bool,float,float,float,float>(&GenericNPC::turnTo)) 46 // Display 47 ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide)) 48 ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide)) 49 // Coordinates 50 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 51 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 52 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 46 53 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 47 54 ->addMethod("setAbsDir", ExecutorLua4<PNode,float,float,float,float>(&PNode::setAbsDir)) 55 48 56 ); 49 57 … … 412 420 printf("Turning: %f, %f, %f, %f \n",qu,qx,qy,qz); 413 421 // check if this is the current goal 414 this->destDir.debug();415 destDir.debug();416 422 if( this->destDir != destDir) 417 423 { -
branches/single_player_map/src/world_entities/script_trigger.cc
r8783 r8869 24 24 CREATE_SCRIPTABLE_CLASS(ScriptTrigger, CL_SCRIPT_TRIGGER, 25 25 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 26 27 28 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 29 ); 30 30 … … 41 41 42 42 returnCount = 1; 43 actionFinished = false;43 scriptFinished = false; 44 44 doDebugDraw = false; 45 45 invert = false; … … 102 102 .describe("The name of the parent as it is in the *.oxw file") 103 103 .defaultValues(""); 104 LoadParam(root, "callonce", this, ScriptTrigger, setCallOnce)105 .describe("True if the script shoul only be called once")106 .defaultValues("");107 104 LoadParam(root, "invert", this, ScriptTrigger, setInvert) 108 105 .describe("") … … 112 109 .defaultValues(""); 113 110 LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw) 114 .describe(" True if the script should only be called once")111 .describe("") 115 112 .defaultValues(""); 116 113 LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript) … … 159 156 void ScriptTrigger::tick(float timestep) 160 157 { 161 if( actionFinished) return;158 if(scriptFinished) return; 162 159 163 160 if(triggerLasts && scriptCalled) … … 169 166 if( !invert && this->distance(target) < radius) 170 167 { 171 if(!callOnce)172 {173 168 executeAction(timestep); 174 169 scriptCalled = true; 175 }176 else if(callOnce && !scriptCalled)177 {178 executeAction(timestep);179 scriptCalled = true;180 }181 170 182 171 } 183 172 else if( invert && this->distance(target) > radius) 184 173 { 185 if(!callOnce) 186 { 187 executeAction(timestep); 188 } 189 else if(callOnce && !scriptCalled) 190 { 191 executeAction(timestep); 174 executeAction(timestep); 192 175 scriptCalled = true; 193 }194 195 176 } 196 177 //else … … 202 183 void ScriptTrigger::executeAction(float timestep) 203 184 { 185 204 186 if(scriptIsOk) 205 187 { … … 213 195 printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str()); 214 196 215 actionFinished = script->getReturnedBool();197 scriptFinished = script->getReturnedBool(); 216 198 } 217 199 -
branches/single_player_map/src/world_entities/script_trigger.h
r8783 r8869 35 35 void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; } 36 36 void setTriggerParent(const std::string& name); 37 void setCallOnce(const bool call) { this->callOnce = call; }38 37 void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; } 39 38 void setInvert(const bool inv) { this->invert = invert; } … … 51 50 52 51 WorldEntity* target; 53 bool callOnce;54 52 bool triggerLasts; 55 53 bool invert; … … 63 61 bool scriptCalled; 64 62 bool scriptIsOk; 65 bool actionFinished;63 bool scriptFinished; 66 64 int returnCount; //TODO: set return count correctly 67 65
Note: See TracChangeset
for help on using the changeset viewer.