Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8783 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jun 26, 2006, 2:00:31 PM (19 years ago)
Author:
patrick
Message:

merged the script engine branche back to trunk

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r8761 r8783  
    252252  CL_SCRIPT                     =    0x00000651,
    253253  CL_SCRIPT_CLASS               =    0x00000652,
    254   CL_SCRIPT_TRIGGER             =    0x00000652,
     254  CL_SCRIPT_TRIGGER             =    0x00000653,
    255255
    256256
  • trunk/src/lib/lang/class_list.cc

    r8316 r8783  
    235235BaseObject* ClassList::getObject(const std::string& objectName, const std::string& className)
    236236{
     237
    237238  ClassList* cl = ClassList::getClassList(className);
    238239  if (cl != NULL)
  • trunk/src/lib/script_engine/script.cc

    r8711 r8783  
    114114 void Script::addObject(const std::string& className, const std::string& objectName)
    115115 {
    116    //printf("Script %p: I am about to add %s of class %s\n",this,objectName.c_str(),className.c_str());
     116  // printf("Script %p: I am about to add %s of class %s\n",this,objectName.c_str(),className.c_str());
    117117
    118118   BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
    119    //printf("The script class for %s is at %p \n",className.c_str(),scriptClass);
     119  // printf("The script class for %s is at %p \n",className.c_str(),scriptClass);
    120120   WorldObject tmpObj;
    121121   if (scriptClass != NULL)
     
    128128
    129129     BaseObject* object = ClassList::getObject(objectName, className);
    130      //printf("%s is at %p \n",objectName.c_str(),object);
     130    // printf("%s is at %p \n",objectName.c_str(),object);
    131131     if (object != NULL && !objectIsAdded(objectName))
    132132     {
  • trunk/src/world_entities/npcs/generic_npc.cc

    r8724 r8783  
    125125 * @param coordinate: coordinate to go to
    126126 */
    127 bool GenericNPC::walkTo(const Vector& coordinate, float time)
     127float GenericNPC::walkTo(const Vector& coordinate, const Quaternion& dir)
    128128{
    129129
     
    136136 * @param coordinate: coordinate to go to
    137137 */
    138 bool GenericNPC::walkTo(float x, float y, float z, float time)
     138float GenericNPC::walkTo(float x, float y, float z, float qu, float qx, float qy, float qz)
    139139{
    140140
  • trunk/src/world_entities/npcs/generic_npc.h

    r8724 r8783  
    3838  void playSound(int i);
    3939
    40   bool walkTo(const Vector& coordinate, float time);
    41   bool walkTo(float x, float y, float z, float time);
     40  float walkTo(const Vector& coordinate, const Quaternion& dir);
     41  float walkTo(float x, float y, float z, float qu, float qx, float qy, float qz);
     42  float walkTo(float x, float y, float qu, float qx, float qy, float qz);
     43
     44  float runTo(const Vector& coordinate, const Quaternion& dir);
     45  float runTo(float x, float y, float z, float qu, float qx, float qy, float qz);
     46  float runTo(float x, float y, float qu, float qx, float qy, float qz);
     47
     48  float crouchTo(const Vector& coordinate, const Quaternion& dir);
     49  float crouchTo(float x, float y, float z, float qu, float qx, float qy, float qz);
     50  float crouchTo(float x, float y, float qu, float qx, float qy, float qz);
     51
    4252
    4353  void destroy();
  • trunk/src/world_entities/script_trigger.cc

    r8711 r8783  
    2121#include "state.h"
    2222
     23
     24CREATE_SCRIPTABLE_CLASS(ScriptTrigger, CL_SCRIPT_TRIGGER,
     25                            addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
     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                       );
    2330
    2431
     
    4047  scriptIsOk = false;
    4148  triggerLasts = false;
     49  addToScript = false;
     50 
     51  if(root != NULL)
     52  {
     53   
    4254  loadParams(root);
    43 
     55 
     56  if(addToScript)
     57  {
     58    script->addObject( "ScriptTrigger", this->getName());
     59  }
     60 
     61  }
    4462}
    4563
     
    6078void ScriptTrigger::loadParams(const TiXmlElement* root)
    6179{
    62   if(root != NULL)
    63   {
     80
    6481    WorldEntity ::loadParams(root);
    6582
     
    97114        .describe("True if the script should only be called once")
    98115        .defaultValues("");
    99   }
    100 
     116    LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript)
     117        .describe("True if this scripttrigger should be aviable in the script")
     118        .defaultValues("");
    101119}
    102120
  • trunk/src/world_entities/script_trigger.h

    r8711 r8783  
    1414#include "script_manager.h"
    1515#include "script.h"
     16#include "script_class.h"
    1617
    1718class ScriptTrigger : public WorldEntity
     
    4243    void setFunction(const std::string& function){ this->functionName = function;}
    4344    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
     45    void setAddToScript(const bool add) { this->addToScript = add; }
    4446
    4547    ///DRAWING
     
    5759    std::string  functionName;
    5860    bool         doDebugDraw;
    59 
     61    bool         addToScript;
    6062    //for internal use
    6163    bool         scriptCalled;
     
    6668};
    6769
     70
    6871#endif
  • trunk/src/world_entities/space_ships/helicopter.cc

    r8495 r8783  
    3636CREATE_FACTORY(Helicopter, CL_HELICOPTER);
    3737#include "script_class.h"
    38 //CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER, NULL);
    39 
     38CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,
     39                        addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp))
     40                            ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown))
     41                            ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
     42                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
     43                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
     44                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     45                           
     46                       );
    4047
    4148/**
  • trunk/src/world_entities/space_ships/helicopter.h

    r8711 r8783  
    8383};
    8484
    85 CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,
    86                         addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp))
    87                         ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown))
    88                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    89                         ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    90                         ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    91                         ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
    92                            
    93                         );
    94 
    95 
    9685#endif /* _HELICOPTERS_H */
Note: See TracChangeset for help on using the changeset viewer.