1 #ifndef SCRIPTABLE_CONTROLLER_API_H 2 #define SCRIPTABLE_CONTROLLER_API_H 7 #include "OgreVector3.h" 14 class ScriptableController;
227 std::function<void (std::string, std::string)>
callback_;
252 : entity_(entity), id_(id), start_point_(x, y, z), atEnter_(atEnter),
callback_(callback)
253 { this-> end_point_ = this->start_point_ + Vector3(dx, dy, dz); }
268 std::map<std::string, std::list<std::function<void (std::string, std::string, double, double)> > >
pawnHitHandlers_;
300 #endif // SCRIPTABLE_CONTROLLER_API_H WorldEntity * entity1_
Definition: scriptable_controller_api.h:224
std::function< void(std::string, std::string)> callback_
Definition: scriptable_controller_api.h:227
void setPosition(std::string id, double x, double y, double z)
Set the position of an object.
Definition: scriptable_controller_api.cc:296
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
Runs a scripts on a per-level basis and handles the connection to orxonox.
Definition: scriptable_controller.h:31
static const double periodic_interval
Definition: scriptable_controller_api.h:270
Vector3 point_
Definition: scriptable_controller_api.h:241
void registerAfterTimeout(std::function< void(void)> callback, double timeout)
Register a function that will be called after a timeout.
Definition: scriptable_controller_api.cc:65
void setAngularVelocity(std::string id, double x, double y, double z)
Set the angular velocity of an object.
Definition: scriptable_controller_api.cc:358
std::list< NearObjectHandler > nearObjectHandlers_
Definition: scriptable_controller_api.h:264
void registerAtNearPoint(std::function< void(std::string)> callback, std::string id, double x, double y, double z, double distance)
Register a function that will be called when an object is close to a certain point.
Definition: scriptable_controller_api.cc:93
std::map< std::string, std::list< std::function< void(std::string, std::string, double, double)> > > pawnHitHandlers_
Definition: scriptable_controller_api.h:268
Groups everything together that is needed to handle a near-poinb event.
Definition: scriptable_controller_api.h:233
::std::string string
Definition: gtest-port.h:756
ScriptableControllerAPI(lua_State *lua, ScriptableController *controller)
Constructs the API with the given lua state.
Definition: scriptable_controller_api.cc:19
lua_State * lua_
Definition: scriptable_controller_api.h:262
void registerAtAreaLeave(std::function< void(std::string)> callback, std::string id, int x, int y, int z, int dx, int dy, int dz)
Register a function that will be called when an object leaves a cubic area.
Definition: scriptable_controller_api.cc:109
NearObjectHandler(WorldEntity *entity1, WorldEntity *entity2, std::string id1, std::string id2, double distance, std::function< void(std::string, std::string)> callback)
Definition: scriptable_controller_api.h:220
std::string id1_
Definition: scriptable_controller_api.h:225
void registerAtPawnHit(std::function< void(std::string, std::string, double, double)> callback, std::string id)
Register a function that will be called when a Pawn is hit.
Definition: scriptable_controller_api.cc:122
double distance_
Definition: scriptable_controller_api.h:242
double distance_
Definition: scriptable_controller_api.h:226
bool atEnter_
Definition: scriptable_controller_api.h:258
The WorldEntity represents everything that can be put in a Scene at a certain location.
Definition: WorldEntity.h:72
ScriptableController * controller_
Definition: scriptable_controller_api.h:263
void periodic(void)
Called every 0.5s.
Definition: scriptable_controller_api.cc:419
void moveControllableEntity(std::string id, double x, double y, double z)
Definition: scriptable_controller_api.cc:497
Declaration of the Timer class, used to call functions after a given time-interval.
Timer periodicTimer
Definition: scriptable_controller_api.h:269
AreaHandler(WorldEntity *entity, std::string id, double x, double y, double z, double dx, double dy, double dz, bool atEnter, std::function< void(std::string)> callback)
Definition: scriptable_controller_api.h:251
void spawnTest(std::string id)
Definition: scriptable_controller_api.cc:202
~ScriptableControllerAPI()
Destructs the API and closes the lua state.
Definition: scriptable_controller_api.cc:55
void killPawn(std::string id)
Kill a pawn.
Definition: scriptable_controller_api.cc:127
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
void spawn(std::string type, std::string id)
Spawn an object.
Definition: scriptable_controller_api.cc:136
double myTestFunction(double x, double y)
Set the angular velocity of an object.
Definition: scriptable_controller_api.cc:486
std::list< AreaHandler > areaHandlers_
Definition: scriptable_controller_api.h:266
WorldEntity * entity_
Definition: scriptable_controller_api.h:255
Defines several very important macros used to register objects, register classes, and to work with id...
Groups everything together that is needed to handle a near-object event.
Definition: scriptable_controller_api.h:218
API for ScriptableController's lua-scripts.
Definition: scriptable_controller_api.h:25
void orxPrint(std::string msg)
Print a message.
Definition: scriptable_controller_api.cc:60
void registerAtNearObject(std::function< void(std::string, std::string)> callback, std::string id1, std::string id2, double distance)
Register a function that will be called when two object are close to eachother.
Definition: scriptable_controller_api.cc:84
std::function< void(std::string)> callback_
Definition: scriptable_controller_api.h:243
std::function< void(std::string)> callback_
Definition: scriptable_controller_api.h:259
std::string id2_
Definition: scriptable_controller_api.h:225
void registerAtPawnKilled(std::function< void(std::string)> callback, std::string id)
Register a function that will be called when a Pawn is killed.
Definition: scriptable_controller_api.cc:117
void setOrientation(std::string id, double x, double y, double z, double angle)
Set the orientation of an object.
Definition: scriptable_controller_api.cc:315
WorldEntity * entity2_
Definition: scriptable_controller_api.h:224
Groups everything together that is needed to handle an area enter/leave event.
Definition: scriptable_controller_api.h:249
The Scripts' code is executed through lua.
std::map< std::string, std::list< std::function< void(std::string)> > > pawnDestroyedHandlers_
Definition: scriptable_controller_api.h:267
void pawnHit(std::string target_id, std::string source_id, double new_health, double new_shield)
Called by ScriptableController when a Pawn is hit.
Definition: scriptable_controller_api.cc:413
std::string id_
Definition: scriptable_controller_api.h:240
std::list< NearPointHandler > nearPointHandlers_
Definition: scriptable_controller_api.h:265
void registerAtAreaEnter(std::function< void(std::string)> callback, std::string id, int x, int y, int z, int dx, int dy, int dz)
Register a function that will be called when an object enters a cubic area.
Definition: scriptable_controller_api.cc:101
WorldEntity * entity_
Definition: scriptable_controller_api.h:239
void setVelocity(std::string id, double x, double y, double z)
Set the velocity of an object.
Definition: scriptable_controller_api.cc:339
Timer is a helper class that executes a function after a given amount of seconds in game-time...
Definition: Timer.h:105
NearPointHandler(WorldEntity *entity, std::string id, double x, double y, double z, double distance, std::function< void(std::string)> callback)
Definition: scriptable_controller_api.h:235
std::string id_
Definition: scriptable_controller_api.h:256
void pawnKilled(std::string id, Pawn *pawn)
Called by ScriptableController when a pawn is killed.
Definition: scriptable_controller_api.cc:377
Vector3 start_point_
Definition: scriptable_controller_api.h:257