|
Orxonox
0.0.5 Codename: Arcturus
|
Runs a scripts on a per-level basis and handles the connection to orxonox. More...
Public Member Functions | |
| MobileEntity * | getMobileEntityByID (std::string id) const |
| Convert an ID to a MobileEntity pointer. More... | |
| Pawn * | getPawnByID (std::string id) const |
| Convert an ID to a Pawt pointer. More... | |
| WorldEntity * | getWorldEntityByID (std::string id) const |
| Convert an ID to a WorldEntity pointer. More... | |
| void | pawnHit (Pawn *target, Pawn *source, double new_health, double new_shield) |
| Called when a Pawn is hit. More... | |
| void | pawnKilled (Pawn *pawn) |
| Called when a Pawn is killed. More... | |
| void | registerMobileEntity (std::string id, MobileEntity *entity) |
| Register a MobileEntity to the ScriptableController. More... | |
| void | registerPawn (std::string id, Pawn *pawn) |
| Register a Pawn to the ScriptableController. More... | |
| void | registerWorldEntity (std::string id, WorldEntity *entity) |
| Register a WorldEntity to the ScriptableController. More... | |
| int | runScript (const std::string &file_path) |
| Run a lua script. More... | |
| void | setPlayer (PlayerInfo *player) |
| Set the player object of the current game. More... | |
Private Member Functions | |
| void | printLuaError (lua_State *lua) |
| Prints a human readable error message if a lua error occurs. More... | |
Private Attributes | |
| std::list< std::unique_ptr< ScriptableControllerAPI > > | apis_ |
| std::map< std::string, ControllableEntity * > | controllabelEntities_ |
| std::map< std::string, MobileEntity * > | mobileEntities_ |
| std::map< std::string, Pawn * > | pawns_ |
| std::map< Pawn *, std::string > | pawnsReverse_ |
| PlayerInfo * | player_ |
| std::map< std::string, WorldEntity * > | worldEntities_ |
Runs a scripts on a per-level basis and handles the connection to orxonox.
The script is an attribute of the <Level> element with the name 'script' and should be the path to a lua script. The script will be run as soon as the player spawns. It can then register on various events and react to them. See ScriptableControllerAPI for the complete API.
| MobileEntity * orxonox::ScriptableController::getMobileEntityByID | ( | std::string | id | ) | const |
Convert an ID to a MobileEntity pointer.
| id | The ID of the MobileEntity |
| Pawn * orxonox::ScriptableController::getPawnByID | ( | std::string | id | ) | const |
| WorldEntity * orxonox::ScriptableController::getWorldEntityByID | ( | std::string | id | ) | const |
Convert an ID to a WorldEntity pointer.
| id | The ID of the WorldEntity |
|
private |
Prints a human readable error message if a lua error occurs.
| lua | The lua state where the error occured |
| void orxonox::ScriptableController::registerMobileEntity | ( | std::string | id, |
| MobileEntity * | entity | ||
| ) |
Register a MobileEntity to the ScriptableController.
| id | The ID of the MobileEntity |
| entity | The MobileEntity |
The ScriptableController needs a list of all MobileEntity's so it can convert an ID to a MobileEntity.
Register a Pawn to the ScriptableController.
The ScriptableController needs a list of all Pawn's in addition to the WorldEntity's, because they have additional actions available.
| void orxonox::ScriptableController::registerWorldEntity | ( | std::string | id, |
| WorldEntity * | entity | ||
| ) |
Register a WorldEntity to the ScriptableController.
| id | The ID of the WorldEntity |
| entity | The WorldEntity |
The ScriptableController needs a list of all WorldEntity's so it can convert an ID to a WorldEntity.
| int orxonox::ScriptableController::runScript | ( | const std::string & | file_path | ) |
Run a lua script.
| file_path | Path to the script |
Constructs an API for the script and runs it.
| void orxonox::ScriptableController::setPlayer | ( | PlayerInfo * | player | ) |
Set the player object of the current game.
| player | The player |
The player is a special object and can perfom special actions.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.11