30#include <angelscript.h>
31#include <scriptdictionary/scriptdictionary.h>
53 void log(
const Ogre::String& msg);
67 int useOnlineAPI(
const Ogre::String& apiquery,
const AngelScript::CScriptDictionary& dict, Ogre::String& result);
96 bool deleteResource(
const std::string& filename,
const std::string& resource_group);
115 bool createTextResourceFromString(
const std::string& data,
const std::string& filename,
const std::string& resource_group,
bool overwrite=
false);
122 AngelScript::CScriptArray*
findResourceFileInfo(
const std::string& resource_group,
const std::string& pattern,
bool dirs =
false);
127 Ogre::Image
loadImageResource(
const std::string& filename,
const std::string& resource_group);
132 bool serializeMeshResource(
const std::string& filename,
const std::string& resource_group,
const Ogre::MeshPtr& mesh);
143 void flashMessage(Ogre::String& txt,
float time,
float charHeight);
148 void message(Ogre::String& txt, Ogre::String& icon);
160 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);
162 void showChooser(
const Ogre::String& type,
const Ogre::String& instance,
const Ogre::String& box);
358 void spawnObject(
const Ogre::String& objectName,
const Ogre::String& instanceName,
const Ogre::Vector3& pos,
const Ogre::Vector3& rot,
const Ogre::String& eventhandler,
bool uniquifyMaterials);
366 void moveObjectVisuals(
const Ogre::String& instanceName,
const Ogre::Vector3& pos);
463 void repairVehicle(
const Ogre::String& instance,
const Ogre::String& box,
bool keepPosition);
465 void removeVehicle(
const Ogre::String& instance,
const Ogre::String& box);
500 ActorPtr spawnTruckAI(Ogre::String& truckName, Ogre::Vector3& pos, Ogre::String& truckSectionConfig, std::string& truckSkin,
int x);
610 int setMaterialAmbient(
const Ogre::String& materialName,
float red,
float green,
float blue);
611 int setMaterialDiffuse(
const Ogre::String& materialName,
float red,
float green,
float blue,
float alpha);
612 int setMaterialSpecular(
const Ogre::String& materialName,
float red,
float green,
float blue,
float alpha);
613 int setMaterialEmissive(
const Ogre::String& materialName,
float red,
float green,
float blue);
614 int setMaterialTextureName(
const Ogre::String& materialName,
int techniqueNum,
int passNum,
int textureUnitNum,
const Ogre::String& textureName);
615 int setMaterialTextureRotate(
const Ogre::String& materialName,
int techniqueNum,
int passNum,
int textureUnitNum,
float rotation);
616 int setMaterialTextureScroll(
const Ogre::String& materialName,
int techniqueNum,
int passNum,
int textureUnitNum,
float sx,
float sy);
617 int setMaterialTextureScale(
const Ogre::String& materialName,
int techniqueNum,
int passNum,
int textureUnitNum,
float u,
float v);
643 std::string
CheckFileAccess(
const char* func_name,
const std::string& filename,
const std::string& resource_group);
644 int getTextureUnitState(Ogre::TextureUnitState** tu,
const Ogre::String materialName,
int techniqueNum,
int passNum,
int textureUnitNum);
Central state/object manager and communications hub.
Proxy class that can be called by script functions.
FreeBeamGfxID_t getFreeBeamGfxNextId()
Returns an unused (not reused) ID to use with MSG_SIM_ADD_FREEBEAMGFX_REQUESTED; see game....
AngelScript::CScriptArray * getRunningScripts()
Returns array<int> with active ScriptUnitIDs; check agains global var thisScript or use getScriptDeta...
Ogre::String getAIVehicleSectionConfig(int x)
bool checkResourceExists(const std::string &filename, const std::string &resource_group)
Checks if the resource file exists in the given group.
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 registerForEvent(int eventValue)
registers for a new event to be received by the scripting system
int setMaterialTextureScroll(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float sx, float sy)
int setMaterialTextureRotate(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float rotation)
void movePerson(const Ogre::Vector3 &vec)
moves the person relative
void logFormat(const char *fmt,...)
writes a message to the games log (RoR.log)
void setAIVehicleCount(int count)
void log(const Ogre::String &msg)
writes a message to the games log (RoR.log)
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_STAT...
void setGravity(float value)
sets the gravity terrain wide.
float getGroundHeight(Ogre::Vector3 &v)
Gets terrain height at given coordinates.
void cameraLookAt(const Ogre::Vector3 &targetPoint)
Points the camera at a location in worldspace.
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.
bool getCaelumAvailable()
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.
AngelScript::CScriptArray * getAllTrucks()
returns an array of all currently existing actors.
AngelScript::CScriptArray * getMousePointedMovableObjects()
Returns array<Ogre::MovableObjects@> in no particular order.
void setTimeDiff(float diff)
int getChatFontSize()
OBSOLETE, returns 0;.
int sendGameCmd(const Ogre::String &message)
Multiplayer only: sends AngelScript snippet to all players.
int getLoadedTerrain(Ogre::String &result)
gets the name of current terrain.
bool getScreenPosFromWorldPos(Ogre::Vector3 const &world_pos, Ogre::Vector2 &out_screen_pos)
Ogre::String getCaelumTime()
gets the time of the day in seconds
bool HaveSimTerrain(const char *func_name)
Helper; Check if SimController instance exists, log warning if not.
Ogre::String getAIVehicleName(int x)
int getAIVehicleDistance()
void setAIVehicleSpeed(int speed)
int getCurrentTruckNumber()
returns the current truck number.
void setAIVehicleSectionConfig(int x, std::string config)
AngelScript::CScriptArray * getEditorObjects()
Returns array<TerrainEditorObjectClassPtr@> with all static objects on map (from any source).
ActorPtr spawnTruck(Ogre::String &truckName, Ogre::Vector3 &pos, Ogre::Vector3 &rot)
void setCaelumTime(float value)
sets the time of the day in seconds
void activateAllVehicles()
std::string getAIVehicleSkin(int x)
void unRegisterEvent(int eventValue)
unregisters from receiving event.
AngelScript::CScriptArray * getWaypoints(int x)
void setBestLapTime(float time)
void setChatFontSize(int size)
OBSOLETE, does nothing.
int useOnlineAPI(const Ogre::String &apiquery, const AngelScript::CScriptDictionary &dict, Ogre::String &result)
Ogre::Vector3 getPersonPosition()
ActorPtr getCurrentTruck()
returns the current selected truck, 0 if in person mode
AngelScript::CScriptDictionary * getScriptDetails(ScriptUnitID_t nid)
Returns all info about running script; obtain the NID from getRunningScripts(), global var thisScript...
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).
SoundPtr createSoundFromResource(const std::string &filename, const std::string &resource_group_name)
int getAIVehiclePositionScheme()
void setPersonPosition(const Ogre::Vector3 &vec)
sets the character position
ScriptRetCode_t deleteScriptVariable(const Ogre::String &arg, ScriptUnitID_t nid)
Deletes a global variable from the script (Wrapper for ScriptEngine::deleteVariable)
ScriptRetCode_t deleteScriptFunction(const Ogre::String &arg, ScriptUnitID_t nid)
Deletes a global function from the script (Wrapper for ScriptEngine::deleteFunction)
Ogre::Vector2 getMouseScreenPosition()
Gets mouse position in pixels.
void setWaterHeight(float value)
sets the base water height
Ogre::Quaternion getCameraOrientation()
Gets the camera's orientation.
int setMaterialAmbient(const Ogre::String &materialName, float red, float green, float blue)
bool getMousePositionOnTerrain(Ogre::Vector3 &out_pos)
Calculates mouse cursor position on terrain.
void setCameraOrientation(const Ogre::Quaternion &q)
Sets the camera's orientation.
void setCameraRoll(float angle)
Rolls the camera anticlockwise, around its local z axis.
float getTime()
returns the time in seconds since the game was started
int setMaterialDiffuse(const Ogre::String &materialName, float red, float green, float blue, float alpha)
AngelScript::CScriptArray * getAllSoundScriptTemplates()
Ogre::Vector3 getCameraDirection()
Gets the camera's direction.
void flashMessage(Ogre::String &txt, float time, float charHeight)
DEPRECATED: use message() shows a message to the user.
ScriptRetCode_t scriptFunctionExists(const Ogre::String &arg, ScriptUnitID_t nid)
Checks if a global function exists in the script (Wrapper for ScriptEngine::functionExists)
void setAIVehicleSkin(int x, std::string skin)
void updateDirectionArrow(Ogre::String &text, Ogre::Vector3 &vec)
set direction arrow
void setAIVehiclePositionScheme(int scheme)
ActorInstanceID_t getActorNextInstanceId()
Returns an unused (not reused) ID to use with MSG_SIM_SPAWN_ACTOR_REQUESTED; see game....
bool pushMessage(MsgType type, AngelScript::CScriptDictionary *dict)
Pushes a message to internal message queue.
Ogre::Vector2 getDisplaySize()
Gets screen size in pixels.
void moveObjectVisuals(const Ogre::String &instanceName, const Ogre::Vector3 &pos)
This moves an object to a new position.
Ogre::SceneManager * getSceneManager()
AngelScript::CScriptArray * getAllSoundScriptInstances()
void setCameraPosition(const Ogre::Vector3 &pos)
Sets the camera's position.
Ogre::Vector3 getCameraPosition()
Retrieves the camera's position.
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.
FreeForceID_t getFreeForceNextId()
Returns an unused (not reused) ID to use with MSG_SIM_ADD_FREEFORCE_REQUESTED; see game....
void removeVehicle(const Ogre::String &instance, const Ogre::String &box)
int getNumTrucksByFlag(int flag)
Ogre::Image loadImageResource(const std::string &filename, const std::string &resource_group)
Loads an image in any format recognized by OGRE.
void hideDirectionArrow()
void setAIVehicleName(int x, std::string name)
VehicleAIPtr getCurrentTruckAI()
void setPersonRotation(const Ogre::Radian &rot)
sets the character rotation
float getWaterHeight()
returns the current base water level (without waves)
void showChooser(const Ogre::String &type, const Ogre::String &instance, const Ogre::String &box)
void setCameraDirection(const Ogre::Vector3 &vec)
Sets the camera's direction vector.
int getTextureUnitState(Ogre::TextureUnitState **tu, const Ogre::String materialName, int techniqueNum, int passNum, int textureUnitNum)
int setMaterialEmissive(const Ogre::String &materialName, float red, float green, float blue)
ActorPtr getTruckByNum(int num)
returns a truck by index, get max index by calling getNumTrucks
void message(Ogre::String &txt, Ogre::String &icon)
shows a message to the user over the console system
ActorPtr getTruckRemotelyReceivingCommands()
Actors with 'importcommands' flag will remotely respond to command keys when the player is close enou...
ScriptRetCode_t scriptVariableExists(const Ogre::String &arg, ScriptUnitID_t nid)
Adds a global variable to the script (Wrapper for ScriptEngine::variableExists)
void loadTerrain(const Ogre::String &terrain)
std::string loadTextResourceAsString(const std::string &filename, const std::string &resource_group)
Loads a text file resource as string.
Ogre::Radian getPersonRotation()
gets the character rotation
void setAIVehicleDistance(int dist)
ScriptRetCode_t addScriptFunction(const Ogre::String &arg, ScriptUnitID_t nid)
Adds a global function to the script (Wrapper for ScriptEngine::addFunction)
BitMask_t getRegisteredEventsMask(ScriptUnitID_t nid)
Gets event mask for a specific running script.
ScriptRetCode_t addScriptVariable(const Ogre::String &arg, ScriptUnitID_t nid)
Adds a global variable to the script (Wrapper for ScriptEngine::addVariable)
AngelScript::CScriptArray * getWaypointsSpeed()
void openUrlInDefaultBrowser(const std::string &url)
Opens URL (must start with 'http://' or 'https://') in system's default web browser.
void destroyObject(const Ogre::String &instanceName)
This destroys an object.
void setRegisteredEventsMask(ScriptUnitID_t nid, BitMask_t eventMask)
Overwrites event mask for a specific running script.
int setMaterialTextureName(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, const Ogre::String &textureName)
SoundScriptTemplatePtr getSoundScriptTemplate(const std::string &name)
void setCameraYaw(float angle)
Rotates the camera anticlockwise around it's local y axis.
void setAIRepeatTimes(int times)
bool HavePlayerAvatar(const char *func_name)
Helper; Check if local Character instance exists, log warning if not.
float rangeRandom(float from, float to)
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)
bool HaveMainCamera(const char *func_name)
Helper; Check if main camera exists, log warning if not.
void boostCurrentTruck(float factor)
void repairVehicle(const Ogre::String &instance, const Ogre::String &box, bool keepPosition)
int setMaterialSpecular(const Ogre::String &materialName, float red, float green, float blue, float alpha)
SoundScriptInstancePtr createSoundScriptInstance(const std::string &template_name, int actor_instance_id)
bool deleteResource(const std::string &filename, const std::string &resource_group)
Deletes a resource from the given group.
void addWaypoint(const Ogre::Vector3 &pos)
VehicleAIPtr getTruckAIByNum(int num)
void setCameraPitch(float angle)
Pitches the camera up/down anticlockwise around it's local z axis.
float getGravity()
returns the currently set upo gravity
int setMaterialTextureScale(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float u, float v)
ActorPtr spawnTruckAI(Ogre::String &truckName, Ogre::Vector3 &pos, Ogre::String &truckSectionConfig, std::string &truckSkin, int x)
void setTrucksForcedAwake(bool forceActive)
AngelScript::CScriptArray * findResourceFileInfo(const std::string &resource_group, const std::string &pattern, bool dirs=false)
Proxy to Ogre::ResourceGroupManager::findResourceFileInfo(), see https://ogrecave....
MsgType
Global gameplay message loop, see struct Message in GameContext.h.
int ActorInstanceID_t
Unique sequentially generated ID of an actor in session. Use ActorManager::GetActorById()
int FreeForceID_t
Unique sequentially generated ID of FreeForce; use ActorManager::GetFreeForceNextId().
int ScriptRetCode_t
see enum RoR::ScriptRetCode - combines AngelScript codes and RoR internal codes.
int ScriptUnitID_t
Unique sequentially generated ID of a loaded and running scriptin session. Use ScriptEngine::getScrip...
int FreeBeamGfxID_t
Index into GfxScene::m_gfx_freebeams, use RoR::FREEBEAMGFXID_INVALID as empty value.