Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10406 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jan 27, 2007, 3:27:50 PM (18 years ago)
Author:
snellen
Message:

NPC is now scriptabel, added method atachCurrCameraToWorldEntity to CameraMan and made it scriptable

Location:
trunk/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/cameraman.cc

    r10404 r10406  
    3333CREATE_SCRIPTABLE_CLASS(CameraMan,
    3434                        addMethod("changeCurrTarget", Executor2<CameraMan, lua_State*,const std::string&,const std::string&>(&CameraMan::changeCurrTarget))
     35                        ->addMethod("atachCurrCameraToWorldEntity", Executor2<CameraMan, lua_State*,const std::string&,const std::string&>(&CameraMan::atachCurrCameraToWorldEntity))
    3536                        ->addMethod("changeTarget", Executor3<CameraMan, lua_State*, const std::string&, const std::string&,const std::string&>(&CameraMan::changeTarget))
    3637                        ->addMethod("setCam", Executor1<CameraMan, lua_State*, const std::string&>(&CameraMan::setCam))
     
    163164}
    164165
     166void CameraMan::atachCurrCameraToWorldEntity(const std::string& className, const std::string& targetEntity)
     167{
     168  BaseObject* object = ObjectListBase::getBaseObject(className, targetEntity);
     169  if(object != NULL)
     170   this->atachCurrTarget(dynamic_cast<PNode*>(object));
     171}
     172
     173
    165174void CameraMan::jumpCam(int x, int y, int z, int camNo)
    166175{
  • trunk/src/world_entities/cameraman.h

    r10404 r10406  
    3333    void changeCurrTarget(const std::string& className, const std::string& objectName);
    3434    void atachCurrTarget(PNode* target);
     35    void atachCurrCameraToWorldEntity(const std::string& className, const std::string& targetEntity);
    3536    void jumpCam(int x, int y, int z, int camNo);
    3637    void jumpCurrCam(int x, int y, int z);
  • trunk/src/world_entities/npcs/npc.cc

    r10387 r10406  
    4141CREATE_FACTORY(NPC);
    4242
     43
     44#include "script_class.h"
     45CREATE_SCRIPTABLE_CLASS(NPC,
     46                        addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     47                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     48                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
     49                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     50                        ->addMethod("setAbsDir", Executor4<PNode, lua_State*,float,float,float,float>(&PNode::setAbsDir))
     51                       );
    4352
    4453NPC::NPC(const TiXmlElement* root)
Note: See TracChangeset for help on using the changeset viewer.