Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8207 in orxonox.OLD


Ignore:
Timestamp:
Jun 7, 2006, 6:23:33 PM (18 years ago)
Author:
snellen
Message:

set parent mode of script trigger to PNODE_MOVEMENT

Location:
branches/script_engine/src/lib/script_engine
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/lib/script_engine/script.cc

    r8206 r8207  
    9393 {
    9494   BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
     95   WorldObject tmpObj;
    9596   if (scriptClass != NULL)
    9697   {
    9798     if( !classIsRegistered(className) )
     99     {
    98100     static_cast<ScriptClass*>(scriptClass)->registerClass(this);
     101     tmpObj.type = className;
     102     }
    99103     
    100104     BaseObject* object = ClassList::getObject(objectName, className);
     
    102106     {
    103107        static_cast<ScriptClass*>(scriptClass)->insertObject(this, object, false);
     108        tmpObj.name = objectName;
     109        registeredObjects.push_back(tmpObj);
    104110     }
    105111   }
     
    296302 bool Script::classIsRegistered(const std::string& type)
    297303 {
    298    for(std::list<worldObject>::const_iterator it = registeredObjects.begin(); it != registeredObjects.end(); it++ )
     304   for(std::list<WorldObject>::const_iterator it = registeredObjects.begin(); it != registeredObjects.end(); it++ )
    299305   {
    300306     if( (*it).type == type)
     
    310316 bool Script::objectIsAdded(const std::string& name)
    311317 {
    312    for(std::list<worldObject>::const_iterator it = registeredObjects.begin(); it != registeredObjects.end(); it++ )
     318   for(std::list<WorldObject>::const_iterator it = registeredObjects.begin(); it != registeredObjects.end(); it++ )
    313319   {
    314320     if( (*it).name == name)
  • branches/script_engine/src/lib/script_engine/script.h

    r8206 r8207  
    88struct lua_State;
    99
    10 struct worldObject
     10struct WorldObject
    1111{
    1212  std::string name;
     
    5757
    5858    int  reportError(int error);                      //!< Get errormessage from the lua stack and print it.
    59     bool classIsRegistered(const std::string& type);
    60     bool objectIsAdded(const std::string& name);
     59    bool classIsRegistered(const std::string& type);  //!< Checks wheter the class "type" has already been registered with the script
     60    bool objectIsAdded(const std::string& name);      //!< Checks wheter the object "name" has already been added to the script
    6161
    6262    lua_State*              luaState;                //!< The lua_State that the Script works on
     
    6666    int                     returnCount;             //!< Number of return values of the current function
    6767   
    68     std::list<worldObject>  registeredObjects;       //!< The list of all the objects and their type that have been registered with this script
     68    std::list<WorldObject>  registeredObjects;       //!< The list of all the objects and their type that have been registered with this script
    6969
    7070
  • branches/script_engine/src/lib/script_engine/script_trigger.cc

    r8206 r8207  
    2121void ScriptTrigger::loadParams(const TiXmlElement* root)
    2222{
     23  if(root != NULL)
     24  {
    2325  WorldEntity ::loadParams(root);
    2426 
     
    4648
    4749    }
    48  timer = delay;
     50    timer = delay;
     51  }
     52 
    4953}
    5054
     
    7175  {
    7276    this->setParent(dynamic_cast<WorldEntity*>(parentEntity));
     77    this->setParentMode(PNODE_MOVEMENT);
    7378  }
    7479  else
     
    103108     Script* script = scriptManager->getScriptByFile(this->scriptFile);
    104109     if(script != NULL)
     110     {
    105111     if(!(script->selectFunction(this->functionName,0)) )
    106112       printf("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), scriptFile.c_str());
    107113     if( !(script->executeFunction()) )
    108114       printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(),scriptFile.c_str());
     115     }
    109116}
  • branches/script_engine/src/lib/script_engine/script_trigger.h

    r8205 r8207  
    1212{
    1313  public:
    14     ScriptTrigger(const TiXmlElement* root);
     14    ScriptTrigger(const TiXmlElement* root = NULL);
    1515    ~ScriptTrigger();
    1616
     17    ///LOADING
    1718    virtual void loadParams(const TiXmlElement* root);
     19   
     20   
     21    ///
    1822    virtual void tick(float timestep);
    1923    virtual void executeAction();
     
    3034    void setScript(const std::string& script){this->scriptFile = script;}
    3135    void setFunction(const std::string& function){this->functionName = function;}
    32 
    33     std::string getTargetName();
    3436
    3537  private:
Note: See TracChangeset for help on using the changeset viewer.