Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8948 in orxonox.OLD for branches/mountain_lake


Ignore:
Timestamp:
Jun 30, 2006, 12:29:26 PM (18 years ago)
Author:
hdavid
Message:

branches/mountain_lake

Location:
branches/mountain_lake/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/mountain_lake/src/lib/graphics/effects/cloud_effect.cc

    r8947 r8948  
    5252
    5353CREATE_SCRIPTABLE_CLASS(CloudEffect, CL_CLOUD_EFFECT,
    54                         addMethod("shellSkyColor", 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))
    5656                       );
    5757
  • branches/mountain_lake/src/world_entities/script_trigger.cc

    r8783 r8948  
    4141
    4242  returnCount = 1;
    43   actionFinished = false;
     43  scriptFinished = false;
    4444  doDebugDraw = false;
    4545  invert = false;
    4646  scriptCalled = false;
    4747  scriptIsOk = false;
    48   triggerLasts = false;
     48  triggerLasts = true;
    4949  addToScript = false;
    5050 
     
    5252  {
    5353   
    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    }
    6060 
    6161  }
     
    7979{
    8080
    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");
    119116}
    120117
     
    159156void ScriptTrigger::tick(float timestep)
    160157{
    161   if(actionFinished) return;
     158  if(scriptFinished) return;
    162159
    163160  if(triggerLasts && scriptCalled)
     
    168165 
    169166  if( !invert && this->distance(target) < radius)
    170  {
    171   if(!callOnce)
    172    {
     167  {
    173168    executeAction(timestep);
    174169    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  }
    196177 //else
    197178   //printf("SCRIPTTRIGGER: target out of range\n");
     
    202183void ScriptTrigger::executeAction(float timestep)
    203184{
    204      if(scriptIsOk)
    205      {
     185 
     186  if(scriptIsOk)
     187  {
    206188       //testScriptingFramework();
    207      if(!(script->selectFunction(this->functionName,returnCount)) )
    208        printf("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
    209      
    210      script->pushParam( timestep, this->functionName);
    211      
    212      if( !(script->executeFunction()) )
    213        printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
    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  }
    217199     
    218200     
     
    237219/*
    238220 void ScriptTrigger::testScriptingFramework()
    239  {
     221{
    240222   std::string file("lunartest2.lua");
    241223   //get script
  • branches/mountain_lake/src/world_entities/script_trigger.h

    r8783 r8948  
    3535    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
    3636    void setTriggerParent(const std::string& name);
    37     void setCallOnce(const bool call) { this->callOnce = call; }
    3837    void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
    3938    void setInvert(const bool inv) { this->invert = invert; }
     
    5150
    5251    WorldEntity* target;
    53     bool         callOnce;
    5452    bool         triggerLasts;
    5553    bool         invert;
     
    6361    bool         scriptCalled;
    6462    bool         scriptIsOk;
    65     bool         actionFinished;
     63    bool         scriptFinished;
    6664    int          returnCount;        //TODO: set return count correctly
    6765
Note: See TracChangeset for help on using the changeset viewer.