Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9245 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 6, 2006, 5:32:31 PM (18 years ago)
Author:
snellen
Message:

added setActivateOnCreation to scripttrigger

Location:
branches/scripting/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/scripting/src/world_entities/script_trigger.cc

    r9242 r9245  
    3232             ->addMethod("setTarget", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTarget))
    3333             ->addMethod("setTriggerParent", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTriggerParent))
    34              ->addMethod("setTriggerLasts", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setTriggerLasts))
     34             ->addMethod("setTriggerRemains", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setTriggerRemains))
     35             ->addMethod("setActiveOnCreation", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setActiveOnCreation))
    3536             ->addMethod("setInvert", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setInvert))
    3637             ->addMethod("setRadius", ExecutorLua1<ScriptTrigger, float>(&ScriptTrigger::setRadius))
     
    5960  scriptCalled = false;
    6061  scriptIsOk = false;
    61   triggerLasts = true;
     62  triggerRemains = true;
    6263  addToScript = false;
     64  this->activeOnCreation = false;
    6365 
    6466  if(root != NULL)
     
    119121      .describe("")
    120122      .defaultValues(false);
    121   LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts)
     123  LoadParam(root, "triggerRemains", this, ScriptTrigger, setTriggerRemains)
    122124      .describe("")
    123125      .defaultValues(true);
     
    172174  if(scriptFinished) return;
    173175
    174   if(triggerLasts && scriptCalled)
     176  if(activeOnCreation)
     177   {
     178     executeAction(timestep);
     179     return;
     180   }
     181   
     182  if(triggerRemains && scriptCalled)
    175183  {
    176184    executeAction(timestep);
     
    182190    executeAction(timestep);
    183191    scriptCalled = true;
     192    return;
    184193 
    185194  }
     
    188197    executeAction(timestep);
    189198    scriptCalled = true;
     199    return;
    190200  }
    191201 //else
  • branches/scripting/src/world_entities/script_trigger.h

    r9006 r9245  
    3535    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
    3636    void setTriggerParent(const std::string& name);
    37     void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
     37    void setTriggerRemains(const bool lasts) { this->triggerRemains = lasts; }
     38    void setActiveOnCreation(const bool avtive) { this->activeOnCreation = avtive; }
    3839    void setInvert(const bool inv) { this->invert = invert; }
    3940    void setDelay(float delay) { this->delay = delay; };
     
    5051
    5152    WorldEntity* target;
    52     bool         triggerLasts;
     53    bool         triggerRemains;
     54    bool         activeOnCreation;
    5355    bool         invert;
    5456    float        radius;
Note: See TracChangeset for help on using the changeset viewer.