Changeset 8948 in orxonox.OLD for branches/mountain_lake
- Timestamp:
- Jun 30, 2006, 12:29:26 PM (18 years ago)
- Location:
- branches/mountain_lake/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mountain_lake/src/lib/graphics/effects/cloud_effect.cc
r8947 r8948 52 52 53 53 CREATE_SCRIPTABLE_CLASS(CloudEffect, CL_CLOUD_EFFECT, 54 addMethod("s hellSkyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor))55 ->addMethod(" shellCloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor))54 addMethod("skyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor)) 55 ->addMethod("cloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor)) 56 56 ); 57 57 -
branches/mountain_lake/src/world_entities/script_trigger.cc
r8783 r8948 41 41 42 42 returnCount = 1; 43 actionFinished = false;43 scriptFinished = false; 44 44 doDebugDraw = false; 45 45 invert = false; 46 46 scriptCalled = false; 47 47 scriptIsOk = false; 48 triggerLasts = false;48 triggerLasts = true; 49 49 addToScript = false; 50 50 … … 52 52 { 53 53 54 loadParams(root);55 56 if(addToScript)57 {58 script->addObject( "ScriptTrigger", this->getName());59 }54 loadParams(root); 55 56 if(addToScript && scriptIsOk) 57 { 58 script->addObject( "ScriptTrigger", this->getName()); 59 } 60 60 61 61 } … … 79 79 { 80 80 81 WorldEntity ::loadParams(root); 82 83 LoadParam(root, "file", this, ScriptTrigger, setScript) 84 .describe("the fileName of the script, that should be triggered by this script trigger") 85 .defaultValues(""); 86 LoadParam(root, "function", this, ScriptTrigger, setFunction) 87 .describe("the function of the script, that should be triggered by this script trigger") 88 .defaultValues(""); 89 LoadParam(root, "abs-coor", this, ScriptTrigger, setAbsCoor) 90 .describe("where this script trigger should be located") 91 .defaultValues(""); 92 LoadParam(root, "radius", this, ScriptTrigger, setRadius) 93 .describe("the fileName of the script, that should be triggered by this script trigger") 94 .defaultValues(0); 95 LoadParam(root, "delay", this, ScriptTrigger, setDelay) 96 .describe("the delay after which the funtion sould be triggered") 97 .defaultValues(0); 98 LoadParam(root, "worldentity", this, ScriptTrigger, setTarget) 99 .describe("The name of the target as it is in the *.oxw file") 100 .defaultValues(""); 101 LoadParam(root, "triggerparent", this, ScriptTrigger, setTriggerParent) 102 .describe("The name of the parent as it is in the *.oxw file") 103 .defaultValues(""); 104 LoadParam(root, "callonce", this, ScriptTrigger, setCallOnce) 105 .describe("True if the script shoul only be called once") 106 .defaultValues(""); 107 LoadParam(root, "invert", this, ScriptTrigger, setInvert) 108 .describe("") 109 .defaultValues(""); 110 LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts) 111 .describe("") 112 .defaultValues(""); 113 LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw) 114 .describe("True if the script should only be called once") 115 .defaultValues(""); 116 LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript) 117 .describe("True if this scripttrigger should be aviable in the script") 118 .defaultValues(""); 81 WorldEntity ::loadParams(root); 82 83 LoadParam(root, "file", this, ScriptTrigger, setScript) 84 .describe("the fileName of the script, that should be triggered by this script trigger") 85 .defaultValues(""); 86 LoadParam(root, "function", this, ScriptTrigger, setFunction) 87 .describe("the function of the script, that should be triggered by this script trigger") 88 .defaultValues(""); 89 LoadParam(root, "abs-coor", this, ScriptTrigger, setAbsCoor) 90 .describe("where this script trigger should be located") 91 .defaultValues(""); 92 LoadParam(root, "radius", this, ScriptTrigger, setRadius) 93 .describe("the fileName of the script, that should be triggered by this script trigger") 94 .defaultValues(0); 95 LoadParam(root, "delay", this, ScriptTrigger, setDelay) 96 .describe("the delay after which the funtion sould be triggered") 97 .defaultValues(0); 98 LoadParam(root, "worldentity", this, ScriptTrigger, setTarget) 99 .describe("The name of the target as it is in the *.oxw file") 100 .defaultValues(""); 101 LoadParam(root, "triggerparent", this, ScriptTrigger, setTriggerParent) 102 .describe("The name of the parent as it is in the *.oxw file") 103 .defaultValues(""); 104 LoadParam(root, "invert", this, ScriptTrigger, setInvert) 105 .describe("") 106 .defaultValues("false"); 107 LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts) 108 .describe("") 109 .defaultValues("true"); 110 LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw) 111 .describe("") 112 .defaultValues("false"); 113 LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript) 114 .describe("True if this scripttrigger should be aviable in the script") 115 .defaultValues("false"); 119 116 } 120 117 … … 159 156 void ScriptTrigger::tick(float timestep) 160 157 { 161 if( actionFinished) return;158 if(scriptFinished) return; 162 159 163 160 if(triggerLasts && scriptCalled) … … 168 165 169 166 if( !invert && this->distance(target) < radius) 170 { 171 if(!callOnce) 172 { 167 { 173 168 executeAction(timestep); 174 169 scriptCalled = true; 175 } 176 else if(callOnce && !scriptCalled) 177 { 178 executeAction(timestep); 179 scriptCalled = true; 180 } 181 182 } 183 else if( invert && this->distance(target) > radius) 184 { 185 if(!callOnce) 186 { 187 executeAction(timestep); 188 } 189 else if(callOnce && !scriptCalled) 190 { 191 executeAction(timestep); 192 scriptCalled = true; 193 } 194 195 } 170 171 } 172 else if( invert && this->distance(target) > radius) 173 { 174 executeAction(timestep); 175 scriptCalled = true; 176 } 196 177 //else 197 178 //printf("SCRIPTTRIGGER: target out of range\n"); … … 202 183 void ScriptTrigger::executeAction(float timestep) 203 184 { 204 if(scriptIsOk) 205 { 185 186 if(scriptIsOk) 187 { 206 188 //testScriptingFramework(); 207 208 209 210 211 212 213 214 215 actionFinished = script->getReturnedBool();216 189 if(!(script->selectFunction(this->functionName,returnCount)) ) 190 printf("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str()); 191 192 script->pushParam( timestep, this->functionName); 193 194 if( !(script->executeFunction()) ) 195 printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str()); 196 197 scriptFinished = script->getReturnedBool(); 198 } 217 199 218 200 … … 237 219 /* 238 220 void ScriptTrigger::testScriptingFramework() 239 221 { 240 222 std::string file("lunartest2.lua"); 241 223 //get script -
branches/mountain_lake/src/world_entities/script_trigger.h
r8783 r8948 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.