Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10045


Ignore:
Timestamp:
May 6, 2014, 4:02:07 PM (10 years ago)
Author:
smerkli
Message:

Fixed the lua stuff, can now call ScriptController functions from lua.

Location:
code/branches/ScriptableController
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController/data/gui/scripts/testscript.lua

    r10037 r10045  
    88
    99
    10 orxonox.ScriptController:moveToPosition(x, y, z)
     10local ctrl = orxonox.ScriptController:getScriptController()
     11--orxonox.ScriptController:moveToPosition(x, y, z)
     12--ctrl.moveToPosition(x,y,z)
     13
     14local docks = orxonox.Dock:getNumberOfActiveDocks()
     15local docklist = {}
     16for i = 0, docks-1 do
     17  table.insert(docklist, orxonox.Dock:getActiveDockAtIndex(i))
     18end
     19local dock = docklist[1]
     20if dock ~= nil then
     21    dock:dock()
     22end
     23
     24--orxonox.execute("setPause 1")
    1125
    1226
    13 
  • code/branches/ScriptableController/src/orxonox/CMakeLists.txt

    r9348 r10045  
    6464    infos/PlayerInfo.h
    6565    sound/SoundManager.h
     66    controllers/ScriptController.h
    6667  PCH_FILE
    6768    OrxonoxPrecompiledHeaders.h
  • code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc

    r10038 r10045  
    3030#include "core/CoreIncludes.h"
    3131#include "worldentities/ControllableEntity.h"
     32#include "core/LuaState.h"
    3233#include <cmath>
    3334
     
    6465    }
    6566
     67    ScriptController* ScriptController::getScriptController()
     68    {
     69      orxout() << "Great success!" << std::endl;
     70      for(ObjectList<ScriptController>::iterator it =
     71        ObjectList<ScriptController>::begin();
     72        it != ObjectList<ScriptController>::end(); ++it)
     73      {
     74        // TODO: do some selection here. Currently just returns the first one
     75        return *it;
     76     
     77      }
     78      return NULL;
     79    }
     80
     81
     82
    6683    void ScriptController::moveToPosition_beta(float x, float y, float z )
    6784    {
  • code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h

    r10034 r10045  
    5959
    6060           
    61             const Vector3& getPosition();
     61            static ScriptController* getScriptController();
    6262           
    6363              /* virtual void tick(float dt);*/
    6464
    6565            // tolua_end
     66            const Vector3& getPosition();
    6667
    6768        private:
Note: See TracChangeset for help on using the changeset viewer.