![]() |
RigsofRods
Soft-body Physics Simulation
|
Proxy class that can be called by script functions. More...
#include <GameScript.h>
Public Member Functions | |
General | |
void | log (const Ogre::String &msg) |
writes a message to the games log (RoR.log) More... | |
float | getTime () |
returns the time in seconds since the game was started More... | |
void | backToMenu () |
void | quitGame () |
float | getFPS () |
float | getAvgFPS () |
float | rangeRandom (float from, float to) |
int | useOnlineAPI (const Ogre::String &apiquery, const AngelScript::CScriptDictionary &dict, Ogre::String &result) |
void | openUrlInDefaultBrowser (const std::string &url) |
Opens URL (must start with 'http://' or 'https://') in system's default web browser. More... | |
void | fetchUrlAsStringAsync (const std::string &url, const std::string &display_filename) |
Invokes a background thread to fetch data using CURL; when finished, sends MSG_APP_SCRIPT_THREAD_STATUS + Payload = RoR::ScriptEventArgs* (owner) - see SE_ANGELSCRIPT_THREAD_STATUS for arguments. More... | |
bool | pushMessage (MsgType type, AngelScript::CScriptDictionary *dict) |
Pushes a message to internal message queue. More... | |
bool | checkResourceExists (const std::string &filename, const std::string &resource_group) |
Checks if the resource file exists in the given group. More... | |
bool | deleteResource (const std::string &filename, const std::string &resource_group) |
Deletes a resource from the given group. More... | |
std::string | loadTextResourceAsString (const std::string &filename, const std::string &resource_group) |
Loads a text file resource as string. More... | |
bool | createTextResourceFromString (const std::string &data, const std::string &filename, const std::string &resource_group, bool overwrite=false) |
Saves a string as a text file resource. More... | |
Ogre::SceneManager * | getSceneManager () |
AngelScript::CScriptArray * | findResourceFileInfo (const std::string &resource_group, const std::string &pattern, bool dirs=false) |
Proxy to Ogre::ResourceGroupManager::findResourceFileInfo() , see https://ogrecave.github.io/ogre/api/1.11/class_ogre_1_1_resource_group_manager.html#a662f68163310401718d3c3981a7baec4. More... | |
Ogre::Image | loadImageResource (const std::string &filename, const std::string &resource_group) |
Loads an image in any format recognized by OGRE. More... | |
bool | serializeMeshResource (const std::string &filename, const std::string &resource_group, const Ogre::MeshPtr &mesh) |
Uses Ogre::MeshSerializer to save binary .mesh file (latest format, native endianness). More... | |
GUI | |
void | flashMessage (Ogre::String &txt, float time, float charHeight) |
DEPRECATED: use message() shows a message to the user. More... | |
void | message (Ogre::String &txt, Ogre::String &icon) |
shows a message to the user over the console system More... | |
int | getChatFontSize () |
OBSOLETE, returns 0;. More... | |
void | setChatFontSize (int size) |
OBSOLETE, does nothing. More... | |
void | showMessageBox (Ogre::String &title, Ogre::String &text, bool use_btn1, Ogre::String &btn1_text, bool allow_close, bool use_btn2, Ogre::String &btn2_text) |
void | showChooser (const Ogre::String &type, const Ogre::String &instance, const Ogre::String &box) |
void | updateDirectionArrow (Ogre::String &text, Ogre::Vector3 &vec) |
set direction arrow More... | |
void | hideDirectionArrow () |
bool | getScreenPosFromWorldPos (Ogre::Vector3 const &world_pos, Ogre::Vector2 &out_screen_pos) |
Ogre::Vector2 | getDisplaySize () |
Gets screen size in pixels. More... | |
Ogre::Vector2 | getMouseScreenPosition () |
Gets mouse position in pixels. More... | |
Script management | |
void | registerForEvent (int eventValue) |
registers for a new event to be received by the scripting system More... | |
void | unRegisterEvent (int eventValue) |
unregisters from receiving event. More... | |
BitMask_t | getRegisteredEventsMask (ScriptUnitID_t nid) |
Gets event mask for a specific running script. More... | |
void | setRegisteredEventsMask (ScriptUnitID_t nid, BitMask_t eventMask) |
Overwrites event mask for a specific running script. More... | |
ScriptRetCode_t | addScriptFunction (const Ogre::String &arg, ScriptUnitID_t nid) |
Adds a global function to the script (Wrapper for ScriptEngine::addFunction) More... | |
ScriptRetCode_t | scriptFunctionExists (const Ogre::String &arg, ScriptUnitID_t nid) |
Checks if a global function exists in the script (Wrapper for ScriptEngine::functionExists) More... | |
ScriptRetCode_t | deleteScriptFunction (const Ogre::String &arg, ScriptUnitID_t nid) |
Deletes a global function from the script (Wrapper for ScriptEngine::deleteFunction) More... | |
ScriptRetCode_t | addScriptVariable (const Ogre::String &arg, ScriptUnitID_t nid) |
Adds a global variable to the script (Wrapper for ScriptEngine::addVariable) More... | |
ScriptRetCode_t | scriptVariableExists (const Ogre::String &arg, ScriptUnitID_t nid) |
Adds a global variable to the script (Wrapper for ScriptEngine::variableExists) More... | |
ScriptRetCode_t | deleteScriptVariable (const Ogre::String &arg, ScriptUnitID_t nid) |
Deletes a global variable from the script (Wrapper for ScriptEngine::deleteVariable) More... | |
ScriptRetCode_t | getScriptVariable (const Ogre::String &varName, void *ref, int refTypeId, ScriptUnitID_t nid) |
Retrieves a memory address of a global variable in any script. More... | |
void | clearEventCache () |
int | sendGameCmd (const Ogre::String &message) |
Multiplayer only: sends AngelScript snippet to all players. More... | |
AngelScript::CScriptArray * | getRunningScripts () |
Returns array<int> with active ScriptUnitIDs; check agains global var thisScript or use getScriptDetails() to get name etc... More... | |
AngelScript::CScriptDictionary * | getScriptDetails (ScriptUnitID_t nid) |
Returns all info about running script; obtain the NID from getRunningScripts() , global var thisScript or event callbacks: More... | |
Terrain | |
void | loadTerrain (const Ogre::String &terrain) |
int | getLoadedTerrain (Ogre::String &result) |
gets the name of current terrain. More... | |
bool | getCaelumAvailable () |
Ogre::String | getCaelumTime () |
gets the time of the day in seconds More... | |
void | setCaelumTime (float value) |
sets the time of the day in seconds More... | |
float | getGravity () |
returns the currently set upo gravity More... | |
void | setGravity (float value) |
sets the gravity terrain wide. More... | |
float | getGroundHeight (Ogre::Vector3 &v) |
Gets terrain height at given coordinates. More... | |
float | getWaterHeight () |
returns the current base water level (without waves) More... | |
void | setWaterHeight (float value) |
sets the base water height More... | |
void | spawnObject (const Ogre::String &objectName, const Ogre::String &instanceName, const Ogre::Vector3 &pos, const Ogre::Vector3 &rot, const Ogre::String &eventhandler, bool uniquifyMaterials) |
This spawns a static terrain object (.ODEF file) More... | |
void | moveObjectVisuals (const Ogre::String &instanceName, const Ogre::Vector3 &pos) |
This moves an object to a new position. More... | |
void | destroyObject (const Ogre::String &instanceName) |
This destroys an object. More... | |
AngelScript::CScriptArray * | getEditorObjects () |
Returns array<TerrainEditorObjectClassPtr@> with all static objects on map (from any source). More... | |
bool | getMousePositionOnTerrain (Ogre::Vector3 &out_pos) |
Calculates mouse cursor position on terrain. More... | |
AngelScript::CScriptArray * | getMousePointedMovableObjects () |
Returns array<Ogre::MovableObjects@> in no particular order. More... | |
TerrainPtr | getTerrain () |
Character | |
Ogre::Vector3 | getPersonPosition () |
void | setPersonPosition (const Ogre::Vector3 &vec) |
sets the character position More... | |
void | movePerson (const Ogre::Vector3 &vec) |
moves the person relative More... | |
void | setPersonRotation (const Ogre::Radian &rot) |
sets the character rotation More... | |
Ogre::Radian | getPersonRotation () |
gets the character rotation More... | |
Actors | |
void | activateAllVehicles () |
void | setTrucksForcedAwake (bool forceActive) |
void | boostCurrentTruck (float factor) |
ActorPtr | getCurrentTruck () |
returns the current selected truck, 0 if in person mode More... | |
ActorPtr | getTruckByNum (int num) |
returns a truck by index, get max index by calling getNumTrucks More... | |
AngelScript::CScriptArray * | getAllTrucks () |
returns an array of all currently existing actors. More... | |
int | getCurrentTruckNumber () |
returns the current truck number. More... | |
ActorPtr | spawnTruck (Ogre::String &truckName, Ogre::Vector3 &pos, Ogre::Vector3 &rot) |
void | repairVehicle (const Ogre::String &instance, const Ogre::String &box, bool keepPosition) |
void | removeVehicle (const Ogre::String &instance, const Ogre::String &box) |
int | getNumTrucksByFlag (int flag) |
ActorPtr | getTruckRemotelyReceivingCommands () |
Actors with 'importcommands' flag will remotely respond to command keys when the player is close enough (works both on foot and in vehicles). More... | |
ActorInstanceID_t | getActorNextInstanceId () |
Returns an unused (not reused) ID to use with MSG_SIM_SPAWN_ACTOR_REQUESTED ; see game.pushMessage() . More... | |
FreeForces - see <tt>game.pushMessage()</tt> | |
FreeForceID_t | getFreeForceNextId () |
Returns an unused (not reused) ID to use with MSG_SIM_ADD_FREEFORCE_REQUESTED ; see game.pushMessage() . More... | |
Waypoint AI for Actors; to understand these values, look in TopMenubar UI->VehicleAI tab. | |
ActorPtr | spawnTruckAI (Ogre::String &truckName, Ogre::Vector3 &pos, Ogre::String &truckSectionConfig, std::string &truckSkin, int x) |
AngelScript::CScriptArray * | getWaypoints (int x) |
AngelScript::CScriptArray * | getWaypointsSpeed () |
void | addWaypoint (const Ogre::Vector3 &pos) |
int | getAIVehicleCount () |
int | getAIVehicleDistance () |
int | getAIVehiclePositionScheme () |
int | getAIVehicleSpeed () |
Ogre::String | getAIVehicleName (int x) |
Ogre::String | getAIVehicleSectionConfig (int x) |
std::string | getAIVehicleSkin (int x) |
int | getAIRepeatTimes () |
int | getAIMode () |
VehicleAIPtr | getCurrentTruckAI () |
VehicleAIPtr | getTruckAIByNum (int num) |
void | setAIVehicleCount (int count) |
void | setAIVehicleDistance (int dist) |
void | setAIVehiclePositionScheme (int scheme) |
void | setAIVehicleSpeed (int speed) |
void | setAIVehicleName (int x, std::string name) |
void | setAIVehicleSectionConfig (int x, std::string config) |
void | setAIVehicleSkin (int x, std::string skin) |
void | setAIRepeatTimes (int times) |
void | setAIMode (int mode) |
Camera | |
void | setCameraPosition (const Ogre::Vector3 &pos) |
Sets the camera's position. More... | |
void | setCameraDirection (const Ogre::Vector3 &vec) |
Sets the camera's direction vector. More... | |
void | setCameraOrientation (const Ogre::Quaternion &q) |
Sets the camera's orientation. More... | |
void | setCameraRoll (float angle) |
Rolls the camera anticlockwise, around its local z axis. More... | |
void | setCameraYaw (float angle) |
Rotates the camera anticlockwise around it's local y axis. More... | |
void | setCameraPitch (float angle) |
Pitches the camera up/down anticlockwise around it's local z axis. More... | |
Ogre::Vector3 | getCameraPosition () |
Retrieves the camera's position. More... | |
Ogre::Vector3 | getCameraDirection () |
Gets the camera's direction. More... | |
Ogre::Quaternion | getCameraOrientation () |
Gets the camera's orientation. More... | |
void | cameraLookAt (const Ogre::Vector3 &targetPoint) |
Points the camera at a location in worldspace. More... | |
Race system | |
void | stopTimer () |
void | startTimer (int id) |
void | setTimeDiff (float diff) |
void | setBestLapTime (float time) |
Material helpers | |
int | setMaterialAmbient (const Ogre::String &materialName, float red, float green, float blue) |
int | setMaterialDiffuse (const Ogre::String &materialName, float red, float green, float blue, float alpha) |
int | setMaterialSpecular (const Ogre::String &materialName, float red, float green, float blue, float alpha) |
int | setMaterialEmissive (const Ogre::String &materialName, float red, float green, float blue) |
int | setMaterialTextureName (const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, const Ogre::String &textureName) |
int | setMaterialTextureRotate (const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float rotation) |
int | setMaterialTextureScroll (const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float sx, float sy) |
int | setMaterialTextureScale (const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float u, float v) |
Audio | |
AngelScript::CScriptArray * | getAllSoundScriptTemplates () |
SoundScriptTemplatePtr | getSoundScriptTemplate (const std::string &name) |
AngelScript::CScriptArray * | getAllSoundScriptInstances () |
SoundPtr | createSoundFromResource (const std::string &filename, const std::string &resource_group_name) |
SoundScriptInstancePtr | createSoundScriptInstance (const std::string &template_name, int actor_instance_id) |
Private Member Functions | |
bool | HaveSimTerrain (const char *func_name) |
Helper; Check if SimController instance exists, log warning if not. More... | |
bool | HavePlayerAvatar (const char *func_name) |
Helper; Check if local Character instance exists, log warning if not. More... | |
bool | HaveMainCamera (const char *func_name) |
Helper; Check if main camera exists, log warning if not. More... | |
std::string | CheckFileAccess (const char *func_name, const std::string &filename, const std::string &resource_group) |
Extract filename and extension from the input, because OGRE allows absolute paths in resource system. More... | |
int | getTextureUnitState (Ogre::TextureUnitState **tu, const Ogre::String materialName, int techniqueNum, int passNum, int textureUnitNum) |
void | logFormat (const char *fmt,...) |
writes a message to the games log (RoR.log) More... | |
Proxy class that can be called by script functions.
Definition at line 41 of file GameScript.h.
void GameScript::activateAllVehicles | ( | ) |
int GameScript::addScriptFunction | ( | const Ogre::String & | arg, |
ScriptUnitID_t | nid | ||
) |
Adds a global function to the script (Wrapper for ScriptEngine::addFunction)
arg | A declaration for the function. |
Definition at line 980 of file GameScript.cpp.
int GameScript::addScriptVariable | ( | const Ogre::String & | arg, |
ScriptUnitID_t | nid | ||
) |
Adds a global variable to the script (Wrapper for ScriptEngine::addVariable)
arg | A declaration for the variable. |
Definition at line 995 of file GameScript.cpp.
void GameScript::addWaypoint | ( | const Ogre::Vector3 & | pos | ) |
void GameScript::backToMenu | ( | ) |
void GameScript::boostCurrentTruck | ( | float | factor | ) |
void GameScript::cameraLookAt | ( | const Ogre::Vector3 & | targetPoint | ) |
Points the camera at a location in worldspace.
targetPoint | A vector specifying the look at point. |
Definition at line 829 of file GameScript.cpp.
|
private |
Extract filename and extension from the input, because OGRE allows absolute paths in resource system.
Definition at line 2046 of file GameScript.cpp.
bool GameScript::checkResourceExists | ( | const std::string & | filename, |
const std::string & | resource_group | ||
) |
Checks if the resource file exists in the given group.
KNOWN LIMITATION: If existing file is deleted externally, this function will still report it exists until the resource group is reloaded.
Definition at line 1831 of file GameScript.cpp.
void GameScript::clearEventCache | ( | ) |
SoundPtr GameScript::createSoundFromResource | ( | const std::string & | filename, |
const std::string & | resource_group_name | ||
) |
filename | WAV file. |
resource_group_name | Leave empty to auto-search all groups (classic behavior). |
Definition at line 1821 of file GameScript.cpp.
SoundScriptInstancePtr GameScript::createSoundScriptInstance | ( | const std::string & | template_name, |
int | actor_instance_id = SoundScriptInstance::ACTOR_ID_UNKNOWN |
||
) |
bool GameScript::createTextResourceFromString | ( | const std::string & | data, |
const std::string & | filename, | ||
const std::string & | resource_group, | ||
bool | overwrite = false |
||
) |
Saves a string as a text file resource.
data | The file data. |
filename | Resource name within the resource group, equivalent to filename without path. |
resource_group | Name of resource group to save to. If the group has multiple locations, first writable location is used. |
overwrite | By default existing resources are not overwriten. |
Definition at line 1916 of file GameScript.cpp.
bool GameScript::deleteResource | ( | const std::string & | filename, |
const std::string & | resource_group | ||
) |
Deletes a resource from the given group.
Definition at line 1849 of file GameScript.cpp.
int GameScript::deleteScriptFunction | ( | const Ogre::String & | arg, |
ScriptUnitID_t | nid | ||
) |
Deletes a global function from the script (Wrapper for ScriptEngine::deleteFunction)
arg | A declaration for the function. |
Definition at line 990 of file GameScript.cpp.
int GameScript::deleteScriptVariable | ( | const Ogre::String & | arg, |
ScriptUnitID_t | nid | ||
) |
Deletes a global variable from the script (Wrapper for ScriptEngine::deleteVariable)
arg | A declaration for the variable. |
Definition at line 1005 of file GameScript.cpp.
void GameScript::destroyObject | ( | const Ogre::String & | instanceName | ) |
This destroys an object.
instanceName | The unique name that you chose when spawning this object |
Definition at line 427 of file GameScript.cpp.
void GameScript::fetchUrlAsStringAsync | ( | const std::string & | url, |
const std::string & | display_filename | ||
) |
Invokes a background thread to fetch data using CURL; when finished, sends MSG_APP_SCRIPT_THREAD_STATUS + Payload = RoR::ScriptEventArgs* (owner) - see SE_ANGELSCRIPT_THREAD_STATUS
for arguments.
Definition at line 953 of file GameScript.cpp.
AngelScript::CScriptArray * GameScript::findResourceFileInfo | ( | const std::string & | resource_group, |
const std::string & | pattern, | ||
bool | dirs = false |
||
) |
Proxy to Ogre::ResourceGroupManager::findResourceFileInfo()
, see https://ogrecave.github.io/ogre/api/1.11/class_ogre_1_1_resource_group_manager.html#a662f68163310401718d3c3981a7baec4.
Definition at line 1944 of file GameScript.cpp.
void GameScript::flashMessage | ( | Ogre::String & | txt, |
float | time, | ||
float | charHeight | ||
) |
DEPRECATED: use message() shows a message to the user.
Definition at line 330 of file GameScript.cpp.
ActorInstanceID_t GameScript::getActorNextInstanceId | ( | ) |
Returns an unused (not reused) ID to use with MSG_SIM_SPAWN_ACTOR_REQUESTED
; see game.pushMessage()
.
Definition at line 1798 of file GameScript.cpp.
int GameScript::getAIMode | ( | ) |
int GameScript::getAIRepeatTimes | ( | ) |
int GameScript::getAIVehicleCount | ( | ) |
int GameScript::getAIVehicleDistance | ( | ) |
Ogre::String GameScript::getAIVehicleName | ( | int | x | ) |
int GameScript::getAIVehiclePositionScheme | ( | ) |
Ogre::String GameScript::getAIVehicleSectionConfig | ( | int | x | ) |
std::string GameScript::getAIVehicleSkin | ( | int | x | ) |
int GameScript::getAIVehicleSpeed | ( | ) |
AngelScript::CScriptArray * GameScript::getAllSoundScriptInstances | ( | ) |
CScriptArray * GameScript::getAllSoundScriptTemplates | ( | ) |
AngelScript::CScriptArray * GameScript::getAllTrucks | ( | ) |
returns an array of all currently existing actors.
array<BeamClass@>
Definition at line 1159 of file GameScript.cpp.
float GameScript::getAvgFPS | ( | ) |
bool GameScript::getCaelumAvailable | ( | ) |
String GameScript::getCaelumTime | ( | ) |
gets the time of the day in seconds
Definition at line 160 of file GameScript.cpp.
Vector3 GameScript::getCameraDirection | ( | ) |
Gets the camera's direction.
Definition at line 810 of file GameScript.cpp.
Quaternion GameScript::getCameraOrientation | ( | ) |
Gets the camera's orientation.
Definition at line 821 of file GameScript.cpp.
Vector3 GameScript::getCameraPosition | ( | ) |
Retrieves the camera's position.
Definition at line 802 of file GameScript.cpp.
int GameScript::getChatFontSize | ( | ) |
OBSOLETE, returns 0;.
Definition at line 345 of file GameScript.cpp.
ActorPtr GameScript::getCurrentTruck | ( | ) |
returns the current selected truck, 0 if in person mode
Definition at line 241 of file GameScript.cpp.
VehicleAIPtr GameScript::getCurrentTruckAI | ( | ) |
int GameScript::getCurrentTruckNumber | ( | ) |
returns the current truck number.
>=0 when using a truck, -1 when in person mode
Definition at line 280 of file GameScript.cpp.
Ogre::Vector2 GameScript::getDisplaySize | ( | ) |
Gets screen size in pixels.
Definition at line 526 of file GameScript.cpp.
AngelScript::CScriptArray * GameScript::getEditorObjects | ( | ) |
Returns array<TerrainEditorObjectClassPtr@>
with all static objects on map (from any source).
Definition at line 403 of file GameScript.cpp.
float GameScript::getFPS | ( | ) |
FreeForceID_t GameScript::getFreeForceNextId | ( | ) |
Returns an unused (not reused) ID to use with MSG_SIM_ADD_FREEFORCE_REQUESTED
; see game.pushMessage()
.
Definition at line 1793 of file GameScript.cpp.
float GameScript::getGravity | ( | ) |
returns the currently set upo gravity
Definition at line 246 of file GameScript.cpp.
float GameScript::getGroundHeight | ( | Ogre::Vector3 & | v | ) |
Gets terrain height at given coordinates.
Definition at line 225 of file GameScript.cpp.
int GameScript::getLoadedTerrain | ( | Ogre::String & | result | ) |
gets the name of current terrain.
Definition at line 722 of file GameScript.cpp.
CScriptArray * GameScript::getMousePointedMovableObjects | ( | ) |
Returns array<Ogre::MovableObjects@>
in no particular order.
Definition at line 1427 of file GameScript.cpp.
bool GameScript::getMousePositionOnTerrain | ( | Ogre::Vector3 & | out_pos | ) |
Calculates mouse cursor position on terrain.
out_pos | Calculated position, in meters. |
Definition at line 1394 of file GameScript.cpp.
Ogre::Vector2 GameScript::getMouseScreenPosition | ( | ) |
Gets mouse position in pixels.
Definition at line 532 of file GameScript.cpp.
int GameScript::getNumTrucksByFlag | ( | int | flag | ) |
Vector3 GameScript::getPersonPosition | ( | ) |
Radian GameScript::getPersonRotation | ( | ) |
gets the character rotation
Definition at line 152 of file GameScript.cpp.
BitMask_t GameScript::getRegisteredEventsMask | ( | ScriptUnitID_t | nid | ) |
Gets event mask for a specific running script.
Intended for diagnostic and monitoring purposes.
nid | ScriptUnitID, obtain one from global var thisScript or callback parameters. |
Definition at line 316 of file GameScript.cpp.
AngelScript::CScriptArray * GameScript::getRunningScripts | ( | ) |
Returns array<int>
with active ScriptUnitIDs; check agains global var thisScript
or use getScriptDetails()
to get name etc...
Definition at line 1028 of file GameScript.cpp.
Ogre::SceneManager * GameScript::getSceneManager | ( | ) |
bool GameScript::getScreenPosFromWorldPos | ( | Ogre::Vector3 const & | world_pos, |
Ogre::Vector2 & | out_screen_pos | ||
) |
world_pos | The world position to be converted, in meters. |
out_screen_pos | The resulting screen position, in pixels. |
Definition at line 511 of file GameScript.cpp.
AngelScript::CScriptDictionary * GameScript::getScriptDetails | ( | ScriptUnitID_t | nid | ) |
Returns all info about running script; obtain the NID from getRunningScripts()
, global var thisScript
or event callbacks:
Definition at line 1038 of file GameScript.cpp.
int GameScript::getScriptVariable | ( | const Ogre::String & | varName, |
void * | ref, | ||
int | refTypeId, | ||
ScriptUnitID_t | nid | ||
) |
Retrieves a memory address of a global variable in any script.
nid | ScriptUnitID, ID of the running script, obtain one from global var thisScript or game.getRunningScripts() |
varName | Name of the variable. Type must match the reference type. |
ref | Pointer to the variable's memory address; To be registered as variable-type parameter ?&out |
refTypeId | Type of the reference; To be registered as variable-type parameter ?&out |
Definition at line 1010 of file GameScript.cpp.
SoundScriptTemplatePtr GameScript::getSoundScriptTemplate | ( | const std::string & | name | ) |
RoR::TerrainPtr GameScript::getTerrain | ( | ) |
|
private |
Definition at line 606 of file GameScript.cpp.
float GameScript::getTime | ( | ) |
returns the time in seconds since the game was started
Definition at line 110 of file GameScript.cpp.
VehicleAIPtr GameScript::getTruckAIByNum | ( | int | num | ) |
ActorPtr GameScript::getTruckByNum | ( | int | num | ) |
returns a truck by index, get max index by calling getNumTrucks
Definition at line 264 of file GameScript.cpp.
ActorPtr GameScript::getTruckRemotelyReceivingCommands | ( | ) |
Actors with 'importcommands' flag will remotely respond to command keys when the player is close enough (works both on foot and in vehicles).
Definition at line 286 of file GameScript.cpp.
float GameScript::getWaterHeight | ( | ) |
returns the current base water level (without waves)
Definition at line 233 of file GameScript.cpp.
AngelScript::CScriptArray * GameScript::getWaypoints | ( | int | x | ) |
AngelScript::CScriptArray * GameScript::getWaypointsSpeed | ( | ) |
|
private |
Helper; Check if main camera exists, log warning if not.
Definition at line 2036 of file GameScript.cpp.
|
private |
Helper; Check if local Character instance exists, log warning if not.
Definition at line 2026 of file GameScript.cpp.
|
private |
Helper; Check if SimController instance exists, log warning if not.
Definition at line 2016 of file GameScript.cpp.
void GameScript::hideDirectionArrow | ( | ) |
Ogre::Image GameScript::loadImageResource | ( | const std::string & | filename, |
const std::string & | resource_group | ||
) |
Loads an image in any format recognized by OGRE.
Definition at line 1975 of file GameScript.cpp.
void GameScript::loadTerrain | ( | const Ogre::String & | terrain | ) |
std::string GameScript::loadTextResourceAsString | ( | const std::string & | filename, |
const std::string & | resource_group | ||
) |
Loads a text file resource as string.
filename | Resource name within the resource group, equivalent to filename without path. |
resource_group | Name of resource group to load from |
Definition at line 1868 of file GameScript.cpp.
void GameScript::log | ( | const Ogre::String & | msg | ) |
writes a message to the games log (RoR.log)
msg | string to log |
Definition at line 81 of file GameScript.cpp.
|
private |
writes a message to the games log (RoR.log)
msg | string to log |
Definition at line 86 of file GameScript.cpp.
void GameScript::message | ( | Ogre::String & | txt, |
Ogre::String & | icon | ||
) |
shows a message to the user over the console system
Definition at line 335 of file GameScript.cpp.
void GameScript::moveObjectVisuals | ( | const Ogre::String & | instanceName, |
const Ogre::Vector3 & | pos | ||
) |
This moves an object to a new position.
instanceName | The unique name that you chose when spawning this object |
pos | The position where the object should be moved to |
Definition at line 438 of file GameScript.cpp.
void GameScript::movePerson | ( | const Ogre::Vector3 & | vec | ) |
moves the person relative
vec | translation vector |
Definition at line 136 of file GameScript.cpp.
void GameScript::openUrlInDefaultBrowser | ( | const std::string & | url | ) |
Opens URL (must start with 'http://' or 'https://') in system's default web browser.
Definition at line 948 of file GameScript.cpp.
bool GameScript::pushMessage | ( | MsgType | type, |
AngelScript::CScriptDictionary * | dict | ||
) |
Pushes a message to internal message queue.
Parameters are listed in Script2Game::MsgType
comments.
< Payload = RoR::LoadScriptRequest* (owner)
< Payload = RoR::ScriptUnitId_t* (owner)
< Payload = RoR::ActorSpawnRequest* (owner)
< Payload = RoR::ActorModifyRequest* (owner)
< Payload = RoR::ActorPtr* (owner)
< Payload = ActorPtr* (owner)
< Payload = ActorPtr* (owner)
< Payload = RoR::ActorPtr (owner) | nullptr
< Payload = Ogre::Vector3* (owner)
< Payload = RoR::CacheEntryPtr* (owner)
< Payload = RoR::CacheEntryPtr* (owner)
< Payload = RoR::CacheEntryPtr* (owner)
< Payload = RoR::CreateProjectRequest* (owner)
Definition at line 1448 of file GameScript.cpp.
void GameScript::quitGame | ( | ) |
float GameScript::rangeRandom | ( | float | from, |
float | to | ||
) |
Definition at line 717 of file GameScript.cpp.
void GameScript::registerForEvent | ( | int | eventValue | ) |
registers for a new event to be received by the scripting system
eventValue |
Definition at line 292 of file GameScript.cpp.
void GameScript::removeVehicle | ( | const Ogre::String & | instance, |
const Ogre::String & | box | ||
) |
void GameScript::repairVehicle | ( | const Ogre::String & | instance, |
const Ogre::String & | box, | ||
bool | keepPosition | ||
) |
int GameScript::scriptFunctionExists | ( | const Ogre::String & | arg, |
ScriptUnitID_t | nid | ||
) |
Checks if a global function exists in the script (Wrapper for ScriptEngine::functionExists)
arg | A declaration for the function. |
Definition at line 985 of file GameScript.cpp.
int GameScript::scriptVariableExists | ( | const Ogre::String & | arg, |
ScriptUnitID_t | nid | ||
) |
Adds a global variable to the script (Wrapper for ScriptEngine::variableExists)
arg | A declaration for the variable. |
Definition at line 1000 of file GameScript.cpp.
int GameScript::sendGameCmd | ( | const Ogre::String & | message | ) |
Multiplayer only: sends AngelScript snippet to all players.
Definition at line 1015 of file GameScript.cpp.
bool GameScript::serializeMeshResource | ( | const std::string & | filename, |
const std::string & | resource_group, | ||
const Ogre::MeshPtr & | mesh | ||
) |
Uses Ogre::MeshSerializer
to save binary .mesh file (latest format, native endianness).
Definition at line 1993 of file GameScript.cpp.
void GameScript::setAIMode | ( | int | mode | ) |
void GameScript::setAIRepeatTimes | ( | int | times | ) |
void GameScript::setAIVehicleCount | ( | int | count | ) |
void GameScript::setAIVehicleDistance | ( | int | dist | ) |
void GameScript::setAIVehicleName | ( | int | x, |
std::string | name | ||
) |
void GameScript::setAIVehiclePositionScheme | ( | int | scheme | ) |
void GameScript::setAIVehicleSectionConfig | ( | int | x, |
std::string | config | ||
) |
void GameScript::setAIVehicleSkin | ( | int | x, |
std::string | skin | ||
) |
void GameScript::setAIVehicleSpeed | ( | int | speed | ) |
void GameScript::setBestLapTime | ( | float | time | ) |
void GameScript::setCaelumTime | ( | float | value | ) |
sets the time of the day in seconds
value | day time in seconds |
Definition at line 172 of file GameScript.cpp.
void GameScript::setCameraDirection | ( | const Ogre::Vector3 & | vec | ) |
Sets the camera's direction vector.
vec | A vector representing the direction of the vector. |
Definition at line 762 of file GameScript.cpp.
void GameScript::setCameraOrientation | ( | const Ogre::Quaternion & | q | ) |
Sets the camera's orientation.
vec | A vector representing the direction of the vector. |
Definition at line 770 of file GameScript.cpp.
void GameScript::setCameraPitch | ( | float | angle | ) |
Pitches the camera up/down anticlockwise around it's local z axis.
angle | The pitch-angle |
Definition at line 786 of file GameScript.cpp.
void GameScript::setCameraPosition | ( | const Ogre::Vector3 & | pos | ) |
Sets the camera's position.
pos | The new position of the camera. |
Definition at line 754 of file GameScript.cpp.
void GameScript::setCameraRoll | ( | float | angle | ) |
Rolls the camera anticlockwise, around its local z axis.
angle | The roll-angle |
Definition at line 794 of file GameScript.cpp.
void GameScript::setCameraYaw | ( | float | angle | ) |
Rotates the camera anticlockwise around it's local y axis.
angle | The yaw-angle |
Definition at line 778 of file GameScript.cpp.
void GameScript::setChatFontSize | ( | int | size | ) |
OBSOLETE, does nothing.
Definition at line 350 of file GameScript.cpp.
void GameScript::setGravity | ( | float | value | ) |
sets the gravity terrain wide.
This is an expensive call, since the masses of all trucks are recalculated.
value | new gravity terrain wide (default is -9.81) |
Definition at line 256 of file GameScript.cpp.
int GameScript::setMaterialAmbient | ( | const Ogre::String & | materialName, |
float | red, | ||
float | green, | ||
float | blue | ||
) |
int GameScript::setMaterialDiffuse | ( | const Ogre::String & | materialName, |
float | red, | ||
float | green, | ||
float | blue, | ||
float | alpha | ||
) |
int GameScript::setMaterialEmissive | ( | const Ogre::String & | materialName, |
float | red, | ||
float | green, | ||
float | blue | ||
) |
int GameScript::setMaterialSpecular | ( | const Ogre::String & | materialName, |
float | red, | ||
float | green, | ||
float | blue, | ||
float | alpha | ||
) |
int GameScript::setMaterialTextureName | ( | const Ogre::String & | materialName, |
int | techniqueNum, | ||
int | passNum, | ||
int | textureUnitNum, | ||
const Ogre::String & | textureName | ||
) |
int GameScript::setMaterialTextureRotate | ( | const Ogre::String & | materialName, |
int | techniqueNum, | ||
int | passNum, | ||
int | textureUnitNum, | ||
float | rotation | ||
) |
int GameScript::setMaterialTextureScale | ( | const Ogre::String & | materialName, |
int | techniqueNum, | ||
int | passNum, | ||
int | textureUnitNum, | ||
float | u, | ||
float | v | ||
) |
int GameScript::setMaterialTextureScroll | ( | const Ogre::String & | materialName, |
int | techniqueNum, | ||
int | passNum, | ||
int | textureUnitNum, | ||
float | sx, | ||
float | sy | ||
) |
void GameScript::setPersonPosition | ( | const Ogre::Vector3 & | vec | ) |
sets the character position
vec | position vector on the terrain |
Definition at line 115 of file GameScript.cpp.
void GameScript::setPersonRotation | ( | const Ogre::Radian & | rot | ) |
sets the character rotation
rot | the character rotation |
Definition at line 144 of file GameScript.cpp.
void GameScript::setRegisteredEventsMask | ( | ScriptUnitID_t | nid, |
BitMask_t | eventMask | ||
) |
Overwrites event mask for a specific running script.
Intended for debugging tools - use with caution.
nid | ScriptUnitID, obtain one from global var thisScript or callback parameters. |
eventMask |
Definition at line 324 of file GameScript.cpp.
void GameScript::setTimeDiff | ( | float | diff | ) |
void GameScript::setTrucksForcedAwake | ( | bool | forceActive | ) |
void GameScript::setWaterHeight | ( | float | value | ) |
sets the base water height
value | base height in meters |
Definition at line 212 of file GameScript.cpp.
void GameScript::showChooser | ( | const Ogre::String & | type, |
const Ogre::String & | instance, | ||
const Ogre::String & | box | ||
) |
void GameScript::showMessageBox | ( | Ogre::String & | title, |
Ogre::String & | text, | ||
bool | use_btn1, | ||
Ogre::String & | btn1_text, | ||
bool | allow_close, | ||
bool | use_btn2, | ||
Ogre::String & | btn2_text | ||
) |
void GameScript::spawnObject | ( | const Ogre::String & | objectName, |
const Ogre::String & | instanceName, | ||
const Ogre::Vector3 & | pos, | ||
const Ogre::Vector3 & | rot, | ||
const Ogre::String & | eventhandler, | ||
bool | uniquifyMaterials | ||
) |
This spawns a static terrain object (.ODEF file)
objectName | The name of the object (~the name of the odef file, but without the .odef extension) |
instanceName | A unique name for this object (you can choose one, but make sure that you don't use the same name twice) |
pos | The position where the object should be spawned |
rot | The rotation in which the object should be spawned |
eventhandler | A name of a function that should be called when an event happens (events, as defined in the object definition file) |
uniquifyMaterials | Set this to true if you need to uniquify the materials |
Definition at line 449 of file GameScript.cpp.
ActorPtr GameScript::spawnTruck | ( | Ogre::String & | truckName, |
Ogre::Vector3 & | pos, | ||
Ogre::Vector3 & | rot | ||
) |
ActorPtr GameScript::spawnTruckAI | ( | Ogre::String & | truckName, |
Ogre::Vector3 & | pos, | ||
Ogre::String & | truckSectionConfig, | ||
std::string & | truckSkin, | ||
int | x | ||
) |
void GameScript::startTimer | ( | int | id | ) |
void GameScript::stopTimer | ( | ) |
void GameScript::unRegisterEvent | ( | int | eventValue | ) |
unregisters from receiving event.
eventValue |
Definition at line 304 of file GameScript.cpp.
void GameScript::updateDirectionArrow | ( | Ogre::String & | text, |
Ogre::Vector3 & | vec | ||
) |
set direction arrow
text | text to be displayed. "" to hide the text |
Definition at line 340 of file GameScript.cpp.
int GameScript::useOnlineAPI | ( | const Ogre::String & | apiquery, |
const AngelScript::CScriptDictionary & | dict, | ||
Ogre::String & | result | ||
) |