Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9031 in orxonox.OLD


Ignore:
Timestamp:
Jul 3, 2006, 1:35:40 PM (18 years ago)
Author:
snellen
Message:

added some methods to generic npcs scriptable

Location:
branches/single_player_map/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/lib/collision_reaction/cr_object_damage.cc

    r9008 r9031  
    5656  float damage = 0.0f;
    5757
    58   PRINTF(0)("Dealing damage - Handling collision: %s vs %s\n",
    59             collision->getEntityA()->getClassName(),
    60             collision->getEntityB()->getClassName());
     58 // PRINTF(0)("Dealing damage - Handling collision: %s vs %s\n",
     59        //    collision->getEntityA()->getClassName(),
     60        //    collision->getEntityB()->getClassName());
    6161
    6262  // the collision damage been dealed by the entity
     
    6565    collision->getEntityA()->hit(damage, collision->getEntityB());
    6666  }
    67   PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassName());
     67 // PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassName());
    6868
    6969  if( collision->isEntityBCollide()) {
     
    7171    collision->getEntityB()->hit(damage, collision->getEntityA());
    7272  }
    73   PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassName());
     73 // PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassName());
    7474
    7575  collision->flushCollisionEvents();
  • branches/single_player_map/src/lib/script_engine/script.cc

    r9020 r9031  
    2626CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT,
    2727                    addMethod("addObject", ExecutorLua2<Script,const std::string&, const std::string& >(&Script::addObject))
    28                     //->addMethod("selectFunction", ExecutorLua2ret<Script, bool, const std::string&, int >(&Script::selectFunction))
     28                   // ->addMethod("selectFunction", ExecutorLua2ret<Script, bool, const std::string&, int >(&Script::selectFunction))
    2929                    ->addMethod("executeFunction", ExecutorLua0ret<Script,bool >(&Script::executeFunction))
    3030                     );
     
    8282   filedest += "scripts/" + filename;
    8383   
     84   this->addThisScript();
     85   this->registerStandartClasses();
     86   
    8487   if(currentFile.length() != 0)
    8588   {
     
    98101     {
    99102      currentFile = filename;
    100       this->addThisScript();
    101       this->registerStandartClasses();
    102103      return true;
    103104     }
     
    121122 void Script::addObject(const std::string& className, const std::string& objectName)
    122123 {
    123   // printf("Script %p: I am about to add %s of class %s\n",this,objectName.c_str(),className.c_str());
     124   //printf("Script %s: I am about to add %s of class %s\n",this->getName(),objectName.c_str(),className.c_str());
    124125
    125126   BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
     
    359360   //success = this->registerClass(std::string("Vector"));
    360361    success = this->registerClass("ScriptTrigger");
    361     success = this->registerClass("Script");
    362    
     362
    363363   return success;
    364364 }
  • branches/single_player_map/src/world_entities/npcs/generic_npc.cc

    r9020 r9031  
    4040                        ->addMethod("turnTo", ExecutorLua1<GenericNPC,float>(&GenericNPC::turnTo))
    4141                        ->addMethod("finalGoalReached", ExecutorLua0ret<GenericNPC,bool>(&GenericNPC::finalGoalReached))
     42                        // Animation and sound
     43                        ->addMethod("playAnimation", ExecutorLua2<GenericNPC,int,int>(&GenericNPC::playAnimation))
     44                        //->addMethod("playSound", ExecutorLua1<GenericNPC,const std::string&>(&GenericNPC::playSound))
    4245                        // Display
    4346                        ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
  • branches/single_player_map/src/world_entities/playable.h

    r8724 r9031  
    5656
    5757  // Player Settup
     58  bool hasPlayer(){return !(this->currentPlayer == NULL);}
    5859  bool setPlayer(Player* player);
    5960  Player* getCurrentPlayer() const { return this->currentPlayer; };
  • branches/single_player_map/src/world_entities/space_ships/space_ship.cc

    r9008 r9031  
    5555
    5656CREATE_FACTORY(SpaceShip, CL_SPACE_SHIP);
    57 
     57#include "script_class.h"
     58CREATE_SCRIPTABLE_CLASS(SpaceShip, CL_SPACE_SHIP,
     59                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     60                       );
    5861
    5962/**
Note: See TracChangeset for help on using the changeset viewer.