RigsofRods
Soft-body Physics Simulation
GameScript.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2013-2020 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
25 
26 #pragma once
27 
28 #include "Application.h"
29 
30 #include <angelscript.h>
31 #include <scriptdictionary/scriptdictionary.h>
32 
33 namespace RoR {
34 
37 
42 {
43 public:
44  // PLEASE maintain the same order as in GameScriptAngelscript.cpp!
45 
48 
53  void log(const Ogre::String& msg);
54 
59  float getTime();
60 
61  void backToMenu();
62  void quitGame();
63  float getFPS();
64  float getAvgFPS();
65  float rangeRandom(float from, float to);
66 
67  int useOnlineAPI(const Ogre::String& apiquery, const AngelScript::CScriptDictionary& dict, Ogre::String& result);
68 
72  void openUrlInDefaultBrowser(const std::string& url);
73 
77  void fetchUrlAsStringAsync(const std::string& url, const std::string& display_filename);
78 
83  bool pushMessage(MsgType type, AngelScript::CScriptDictionary* dict);
84 
90  bool checkResourceExists(const std::string& filename, const std::string& resource_group);
91 
96  bool deleteResource(const std::string& filename, const std::string& resource_group);
97 
104  std::string loadTextResourceAsString(const std::string& filename, const std::string& resource_group);
105 
115  bool createTextResourceFromString(const std::string& data, const std::string& filename, const std::string& resource_group, bool overwrite=false);
116 
117  Ogre::SceneManager* getSceneManager();
118 
122  AngelScript::CScriptArray* findResourceFileInfo(const std::string& resource_group, const std::string& pattern, bool dirs = false);
123 
127  Ogre::Image loadImageResource(const std::string& filename, const std::string& resource_group);
128 
132  bool serializeMeshResource(const std::string& filename, const std::string& resource_group, const Ogre::MeshPtr& mesh);
133 
135 
138 
143  void flashMessage(Ogre::String& txt, float time, float charHeight);
144 
148  void message(Ogre::String& txt, Ogre::String& icon);
149 
153  int getChatFontSize();
154 
158  void setChatFontSize(int size);
159 
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);
161 
162  void showChooser(const Ogre::String& type, const Ogre::String& instance, const Ogre::String& box);
163 
168  void updateDirectionArrow(Ogre::String& text, Ogre::Vector3& vec);
169 
170  void hideDirectionArrow();
171 
177  bool getScreenPosFromWorldPos(Ogre::Vector3 const& world_pos, Ogre::Vector2& out_screen_pos);
178 
182  Ogre::Vector2 getDisplaySize();
183 
187  Ogre::Vector2 getMouseScreenPosition();
188 
190 
193 
198  void registerForEvent(int eventValue);
199 
204  void unRegisterEvent(int eventValue);
205 
211 
217  void setRegisteredEventsMask(ScriptUnitId_t nid, BitMask_t eventMask);
218 
224  int addScriptFunction(const Ogre::String& arg);
225 
231  int scriptFunctionExists(const Ogre::String& arg);
232 
238  int deleteScriptFunction(const Ogre::String& arg);
239 
245  int addScriptVariable(const Ogre::String& arg);
246 
252  int deleteScriptVariable(const Ogre::String& arg);
253 
254  void clearEventCache();
255 
259  int sendGameCmd(const Ogre::String& message);
260 
264  AngelScript::CScriptArray* getRunningScripts();
265 
274  AngelScript::CScriptDictionary* getScriptDetails(ScriptUnitId_t nid);
275 
277 
280 
281  void loadTerrain(const Ogre::String& terrain);
282 
287  int getLoadedTerrain(Ogre::String& result);
288 
289  bool getCaelumAvailable();
290 
295  Ogre::String getCaelumTime();
296 
301  void setCaelumTime(float value);
302 
307  float getGravity();
308 
313  void setGravity(float value);
314 
318  float getGroundHeight(Ogre::Vector3& v);
319 
324  float getWaterHeight();
325 
330  void setWaterHeight(float value);
331 
341  void spawnObject(const Ogre::String& objectName, const Ogre::String& instanceName, const Ogre::Vector3& pos, const Ogre::Vector3& rot, const Ogre::String& eventhandler, bool uniquifyMaterials);
342 
349  void moveObjectVisuals(const Ogre::String& instanceName, const Ogre::Vector3& pos);
350 
356  void destroyObject(const Ogre::String& instanceName);
357 
363  bool getMousePositionOnTerrain(Ogre::Vector3& out_pos);
364 
366 
368 
371 
372  Ogre::Vector3 getPersonPosition();
373 
378  void setPersonPosition(const Ogre::Vector3& vec);
379 
384  void movePerson(const Ogre::Vector3& vec);
385 
390  void setPersonRotation(const Ogre::Radian& rot);
391 
396  Ogre::Radian getPersonRotation();
397 
399 
402 
403  void activateAllVehicles();
404 
405  void setTrucksForcedAwake(bool forceActive);
406 
407  //anglescript test
408  void boostCurrentTruck(float factor);
409 
415 
420  ActorPtr getTruckByNum(int num);
421 
426  AngelScript::CScriptArray* getAllTrucks();
427 
432  int getCurrentTruckNumber();
433 
434  ActorPtr spawnTruck(Ogre::String& truckName, Ogre::Vector3& pos, Ogre::Vector3& rot);
435 
436  void repairVehicle(const Ogre::String& instance, const Ogre::String& box, bool keepPosition);
437 
438  void removeVehicle(const Ogre::String& instance, const Ogre::String& box);
439 
440  int getNumTrucksByFlag(int flag);
441 
443 
446 
447  ActorPtr spawnTruckAI(Ogre::String& truckName, Ogre::Vector3& pos, Ogre::String& truckSectionConfig, std::string& truckSkin, int x);
448  AngelScript::CScriptArray* getWaypoints(int x);
449  AngelScript::CScriptArray* getWaypointsSpeed();
450  void addWaypoint(const Ogre::Vector3& pos);
451  int getAIVehicleCount();
452  int getAIVehicleDistance();
454  int getAIVehicleSpeed();
455  Ogre::String getAIVehicleName(int x);
456  Ogre::String getAIVehicleSectionConfig(int x);
457  std::string getAIVehicleSkin(int x);
458  int getAIRepeatTimes();
459  int getAIMode();
461  VehicleAIPtr getTruckAIByNum(int num);
462  // AI: set
463  void setAIVehicleCount(int count);
464  void setAIVehicleDistance(int dist);
465  void setAIVehiclePositionScheme(int scheme);
466  void setAIVehicleSpeed(int speed);
467  void setAIVehicleName(int x, std::string name);
468  void setAIVehicleSectionConfig(int x, std::string config);
469  void setAIVehicleSkin(int x, std::string skin);
470  void setAIRepeatTimes(int times);
471  void setAIMode(int mode);
472 
474 
477 
482  void setCameraPosition(const Ogre::Vector3& pos);
483 
488  void setCameraDirection(const Ogre::Vector3& vec);
489 
494  void setCameraOrientation(const Ogre::Quaternion& q);
495 
500  void setCameraRoll(float angle);
501 
506  void setCameraYaw(float angle);
507 
512  void setCameraPitch(float angle);
513 
518  Ogre::Vector3 getCameraPosition();
519 
524  Ogre::Vector3 getCameraDirection();
525 
530  Ogre::Quaternion getCameraOrientation();
531 
540  void cameraLookAt(const Ogre::Vector3& targetPoint);
541 
543 
546 
547  void stopTimer();
548  void startTimer(int id);
549  void setTimeDiff(float diff);
550  void setBestLapTime(float time);
551 
553 
556 
557  int setMaterialAmbient(const Ogre::String& materialName, float red, float green, float blue);
558  int setMaterialDiffuse(const Ogre::String& materialName, float red, float green, float blue, float alpha);
559  int setMaterialSpecular(const Ogre::String& materialName, float red, float green, float blue, float alpha);
560  int setMaterialEmissive(const Ogre::String& materialName, float red, float green, float blue);
561  int setMaterialTextureName(const Ogre::String& materialName, int techniqueNum, int passNum, int textureUnitNum, const Ogre::String& textureName);
562  int setMaterialTextureRotate(const Ogre::String& materialName, int techniqueNum, int passNum, int textureUnitNum, float rotation);
563  int setMaterialTextureScroll(const Ogre::String& materialName, int techniqueNum, int passNum, int textureUnitNum, float sx, float sy);
564  int setMaterialTextureScale(const Ogre::String& materialName, int techniqueNum, int passNum, int textureUnitNum, float u, float v);
565 
567 
570 
571  AngelScript::CScriptArray* getAllSoundScriptTemplates();
572  SoundScriptTemplatePtr getSoundScriptTemplate(const std::string& name);
573  AngelScript::CScriptArray* getAllSoundScriptInstances();
574 
579  SoundPtr createSoundFromResource(const std::string& filename, const std::string& resource_group_name);
580 
581  SoundScriptInstancePtr createSoundScriptInstance(const std::string& template_name, int actor_instance_id /*= SoundScriptInstance::ACTOR_ID_UNKNOWN*/);
582 
584 
585 private:
586 
587  bool HaveSimTerrain(const char* func_name);
588  bool HavePlayerAvatar(const char* func_name);
589  bool HaveMainCamera(const char* func_name);
590  std::string CheckFileAccess(const char* func_name, const std::string& filename, const std::string& resource_group);
591  int getTextureUnitState(Ogre::TextureUnitState** tu, const Ogre::String materialName, int techniqueNum, int passNum, int textureUnitNum);
592 
597  void logFormat(const char* fmt, ...);
598 };
599 
601 
602 } // namespace RoR
RoR::GameScript::HavePlayerAvatar
bool HavePlayerAvatar(const char *func_name)
Helper; Check if local Character instance exists, log warning if not.
Definition: GameScript.cpp:1856
RoR::GameScript::getAIVehicleSkin
std::string getAIVehicleSkin(int x)
Definition: GameScript.cpp:1212
RoR::GameScript::getSoundScriptTemplate
SoundScriptTemplatePtr getSoundScriptTemplate(const std::string &name)
Definition: GameScript.cpp:1641
RoR::GameScript::getAllSoundScriptTemplates
AngelScript::CScriptArray * getAllSoundScriptTemplates()
Definition: GameScript.cpp:1636
RoR::GameScript::stopTimer
void stopTimer()
Definition: GameScript.cpp:191
RoR::GameScript::getTerrain
TerrainPtr getTerrain()
Definition: GameScript.cpp:704
RoR::GameScript::setCameraPosition
void setCameraPosition(const Ogre::Vector3 &pos)
Sets the camera's position.
Definition: GameScript.cpp:723
RoR::GameScript::sendGameCmd
int sendGameCmd(const Ogre::String &message)
Multiplayer only: sends AngelScript snippet to all players.
Definition: GameScript.cpp:974
RoR::GameScript::setAIRepeatTimes
void setAIRepeatTimes(int times)
Definition: GameScript.cpp:1304
RoR::GameScript::setMaterialTextureScale
int setMaterialTextureScale(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float u, float v)
Definition: GameScript.cpp:667
RoR::GameScript::getLoadedTerrain
int getLoadedTerrain(Ogre::String &result)
gets the name of current terrain.
Definition: GameScript.cpp:691
RoR::GameScript::getCurrentTruckNumber
int getCurrentTruckNumber()
returns the current truck number.
Definition: GameScript.cpp:279
RoR::GameScript::setMaterialTextureRotate
int setMaterialTextureRotate(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float rotation)
Definition: GameScript.cpp:629
RoR::GameScript::setMaterialTextureScroll
int setMaterialTextureScroll(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float sx, float sy)
Definition: GameScript.cpp:648
RoR::GameScript::getAIMode
int getAIMode()
Definition: GameScript.cpp:1232
RoR::GameScript::createSoundScriptInstance
SoundScriptInstancePtr createSoundScriptInstance(const std::string &template_name, int actor_instance_id)
Definition: GameScript.cpp:1656
RoR::GameScript::setCameraOrientation
void setCameraOrientation(const Ogre::Quaternion &q)
Sets the camera's orientation.
Definition: GameScript.cpp:739
RoR::GameScript::getTime
float getTime()
returns the time in seconds since the game was started
Definition: GameScript.cpp:109
RoR::GameScript::setWaterHeight
void setWaterHeight(float value)
sets the base water height
Definition: GameScript.cpp:211
RoR::GameScript::setPersonRotation
void setPersonRotation(const Ogre::Radian &rot)
sets the character rotation
Definition: GameScript.cpp:143
RoR::GameScript::setMaterialDiffuse
int setMaterialDiffuse(const Ogre::String &materialName, float red, float green, float blue, float alpha)
Definition: GameScript.cpp:524
RoR::GameScript::pushMessage
bool pushMessage(MsgType type, AngelScript::CScriptDictionary *dict)
Pushes a message to internal message queue.
Definition: GameScript.cpp:1373
RoR::GameScript::setCameraPitch
void setCameraPitch(float angle)
Pitches the camera up/down anticlockwise around it's local z axis.
Definition: GameScript.cpp:755
RoR::GameScript::getWaterHeight
float getWaterHeight()
returns the current base water level (without waves)
Definition: GameScript.cpp:232
RoR::GameScript::getAIVehicleDistance
int getAIVehicleDistance()
Definition: GameScript.cpp:1166
RoR::GameScript::updateDirectionArrow
void updateDirectionArrow(Ogre::String &text, Ogre::Vector3 &vec)
set direction arrow
Definition: GameScript.cpp:333
RoR::GameScript::getWaypointsSpeed
AngelScript::CScriptArray * getWaypointsSpeed()
Definition: GameScript.cpp:1141
RoR::GameScript::flashMessage
void flashMessage(Ogre::String &txt, float time, float charHeight)
DEPRECATED: use message() shows a message to the user.
Definition: GameScript.cpp:323
RoR::GameScript::setAIVehicleName
void setAIVehicleName(int x, std::string name)
Definition: GameScript.cpp:1260
RoR::GameScript::getNumTrucksByFlag
int getNumTrucksByFlag(int flag)
Definition: GameScript.cpp:268
RoR::GameScript::setAIVehicleSkin
void setAIVehicleSkin(int x, std::string skin)
Definition: GameScript.cpp:1288
RoR::GameScript::getCaelumAvailable
bool getCaelumAvailable()
Definition: GameScript.cpp:181
RoR::GameScript::activateAllVehicles
void activateAllVehicles()
Definition: GameScript.cpp:99
RoR::GameScript::setMaterialTextureName
int setMaterialTextureName(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, const Ogre::String &textureName)
Definition: GameScript.cpp:609
RoR::GameScript::getCurrentTruckAI
VehicleAIPtr getCurrentTruckAI()
Definition: GameScript.cpp:1025
RoR::GameScript::getMousePositionOnTerrain
bool getMousePositionOnTerrain(Ogre::Vector3 &out_pos)
Calculates mouse cursor position on terrain.
Definition: GameScript.cpp:1353
RoR::GameScript::getPersonPosition
Ogre::Vector3 getPersonPosition()
Definition: GameScript.cpp:127
RoR::GameScript::loadTerrain
void loadTerrain(const Ogre::String &terrain)
Definition: GameScript.cpp:122
RoR::GameScript::getTruckByNum
ActorPtr getTruckByNum(int num)
returns a truck by index, get max index by calling getNumTrucks
Definition: GameScript.cpp:263
RoR::GameScript::getSceneManager
Ogre::SceneManager * getSceneManager()
Definition: GameScript.cpp:1368
RoR::GameScript::HaveSimTerrain
bool HaveSimTerrain(const char *func_name)
Helper; Check if SimController instance exists, log warning if not.
Definition: GameScript.cpp:1846
RoR::GameScript::getGroundHeight
float getGroundHeight(Ogre::Vector3 &v)
Gets terrain height at given coordinates.
Definition: GameScript.cpp:224
RoR::GameScript::getAIVehicleName
Ogre::String getAIVehicleName(int x)
Definition: GameScript.cpp:1184
RoR::GameScript::getAIVehicleCount
int getAIVehicleCount()
Definition: GameScript.cpp:1160
RoR::GameScript::openUrlInDefaultBrowser
void openUrlInDefaultBrowser(const std::string &url)
Opens URL (must start with 'http://' or 'https://') in system's default web browser.
Definition: GameScript.cpp:917
RoR::GameScript::getWaypoints
AngelScript::CScriptArray * getWaypoints(int x)
Definition: GameScript.cpp:1095
RoR::GameScript::setCameraDirection
void setCameraDirection(const Ogre::Vector3 &vec)
Sets the camera's direction vector.
Definition: GameScript.cpp:731
RoR::GameScript::setAIVehiclePositionScheme
void setAIVehiclePositionScheme(int scheme)
Definition: GameScript.cpp:1250
RoR::GameScript::loadImageResource
Ogre::Image loadImageResource(const std::string &filename, const std::string &resource_group)
Loads an image in any format recognized by OGRE.
Definition: GameScript.cpp:1805
RoR::GameScript::startTimer
void startTimer(int id)
Definition: GameScript.cpp:196
RoR::GameScript::getAIRepeatTimes
int getAIRepeatTimes()
Definition: GameScript.cpp:1226
RoR::GameScript::getGravity
float getGravity()
returns the currently set upo gravity
Definition: GameScript.cpp:245
RefCountingObjectPtr< Terrain >
RoR::GameScript::getAvgFPS
float getAvgFPS()
Definition: GameScript.cpp:1348
RoR::GameScript::clearEventCache
void clearEventCache()
Definition: GameScript.cpp:709
RoR::GameScript::getRegisteredEventsMask
BitMask_t getRegisteredEventsMask(ScriptUnitId_t nid)
Gets event mask for a specific running script.
Definition: GameScript.cpp:309
RoR::GameScript::removeVehicle
void removeVehicle(const Ogre::String &instance, const Ogre::String &box)
Definition: GameScript.cpp:387
RoR::GameScript::showChooser
void showChooser(const Ogre::String &type, const Ogre::String &instance, const Ogre::String &box)
Definition: GameScript.cpp:348
RoR::GameScript::spawnObject
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)
Definition: GameScript.cpp:418
RoR::GameScript::getCurrentTruck
ActorPtr getCurrentTruck()
returns the current selected truck, 0 if in person mode
Definition: GameScript.cpp:240
RoR::GameScript::HaveMainCamera
bool HaveMainCamera(const char *func_name)
Helper; Check if main camera exists, log warning if not.
Definition: GameScript.cpp:1866
RoR::GameScript::boostCurrentTruck
void boostCurrentTruck(float factor)
Definition: GameScript.cpp:938
RoR::GameScript::getCaelumTime
Ogre::String getCaelumTime()
gets the time of the day in seconds
Definition: GameScript.cpp:159
RoR::GameScript::getCameraOrientation
Ogre::Quaternion getCameraOrientation()
Gets the camera's orientation.
Definition: GameScript.cpp:790
RoR::GameScript::getAIVehicleSpeed
int getAIVehicleSpeed()
Definition: GameScript.cpp:1178
RoR::GameScript::setMaterialSpecular
int setMaterialSpecular(const Ogre::String &materialName, float red, float green, float blue, float alpha)
Definition: GameScript.cpp:541
RoR::GameScript::message
void message(Ogre::String &txt, Ogre::String &icon)
shows a message to the user over the console system
Definition: GameScript.cpp:328
RoR::GameScript::getCameraPosition
Ogre::Vector3 getCameraPosition()
Retrieves the camera's position.
Definition: GameScript.cpp:771
RoR::GameScript::getAIVehicleSectionConfig
Ogre::String getAIVehicleSectionConfig(int x)
Definition: GameScript.cpp:1198
RoR::GameScript::getScriptDetails
AngelScript::CScriptDictionary * getScriptDetails(ScriptUnitId_t nid)
Returns all info about running script; obtain the NID from getRunningScripts(), global var thisScript...
Definition: GameScript.cpp:997
RoR::GameScript::setTimeDiff
void setTimeDiff(float diff)
Definition: GameScript.cpp:201
RoR::GameScript::findResourceFileInfo
AngelScript::CScriptArray * findResourceFileInfo(const std::string &resource_group, const std::string &pattern, bool dirs=false)
Proxy to Ogre::ResourceGroupManager::findResourceFileInfo(), see https://ogrecave....
Definition: GameScript.cpp:1774
RoR::GameScript::setGravity
void setGravity(float value)
sets the gravity terrain wide.
Definition: GameScript.cpp:255
RoR::GameScript::setBestLapTime
void setBestLapTime(float time)
Definition: GameScript.cpp:206
RoR::GameScript::setMaterialAmbient
int setMaterialAmbient(const Ogre::String &materialName, float red, float green, float blue)
Definition: GameScript.cpp:507
RoR::ScriptUnitId_t
int ScriptUnitId_t
Unique sequentially generated ID of a loaded and running scriptin session. Use ScriptEngine::getScrip...
Definition: ForwardDeclarations.h:40
RoR::GameScript::showMessageBox
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)
Definition: GameScript.cpp:1314
RoR::GameScript::CheckFileAccess
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.
Definition: GameScript.cpp:1876
RoR::GameScript::useOnlineAPI
int useOnlineAPI(const Ogre::String &apiquery, const AngelScript::CScriptDictionary &dict, Ogre::String &result)
Definition: GameScript.cpp:806
RoR::GameScript::setPersonPosition
void setPersonPosition(const Ogre::Vector3 &vec)
sets the character position
Definition: GameScript.cpp:114
RoR::GameScript::destroyObject
void destroyObject(const Ogre::String &instanceName)
This destroys an object.
Definition: GameScript.cpp:396
RoR::GameScript::setCaelumTime
void setCaelumTime(float value)
sets the time of the day in seconds
Definition: GameScript.cpp:171
RoR::MsgType
MsgType
Global gameplay message loop, see struct Message in GameContext.h.
Definition: Application.h:74
RoR::GameScript::registerForEvent
void registerForEvent(int eventValue)
registers for a new event to be received by the scripting system
Definition: GameScript.cpp:285
Application.h
Central state/object manager and communications hub.
RoR::GameScript::setAIVehicleDistance
void setAIVehicleDistance(int dist)
Definition: GameScript.cpp:1245
RoR::GameScript::log
void log(const Ogre::String &msg)
writes a message to the games log (RoR.log)
Definition: GameScript.cpp:80
RoR::GameScript::getCameraDirection
Ogre::Vector3 getCameraDirection()
Gets the camera's direction.
Definition: GameScript.cpp:779
RoR::GameScript::setCameraYaw
void setCameraYaw(float angle)
Rotates the camera anticlockwise around it's local y axis.
Definition: GameScript.cpp:747
RoR::GameScript::spawnTruckAI
ActorPtr spawnTruckAI(Ogre::String &truckName, Ogre::Vector3 &pos, Ogre::String &truckSectionConfig, std::string &truckSkin, int x)
Definition: GameScript.cpp:1055
RoR::GameScript::fetchUrlAsStringAsync
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...
Definition: GameScript.cpp:922
RoR::GameScript::serializeMeshResource
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).
Definition: GameScript.cpp:1823
RoR::GameScript::createTextResourceFromString
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.
Definition: GameScript.cpp:1746
RoR::GameScript::getAllTrucks
AngelScript::CScriptArray * getAllTrucks()
returns an array of all currently existing actors.
Definition: GameScript.cpp:1118
RoR::GameScript::getPersonRotation
Ogre::Radian getPersonRotation()
gets the character rotation
Definition: GameScript.cpp:151
RoR::GameScript::getDisplaySize
Ogre::Vector2 getDisplaySize()
Gets screen size in pixels.
Definition: GameScript.cpp:495
RoR::GameScript::getChatFontSize
int getChatFontSize()
OBSOLETE, returns 0;.
Definition: GameScript.cpp:338
RoR::GameScript::setMaterialEmissive
int setMaterialEmissive(const Ogre::String &materialName, float red, float green, float blue)
Definition: GameScript.cpp:558
RoR::GameScript::scriptFunctionExists
int scriptFunctionExists(const Ogre::String &arg)
Checks if a global function exists in the script (Wrapper for ScriptEngine::functionExists)
Definition: GameScript.cpp:954
RoR::GameScript::getAllSoundScriptInstances
AngelScript::CScriptArray * getAllSoundScriptInstances()
Definition: GameScript.cpp:1646
RoR::GameScript::setAIVehicleSectionConfig
void setAIVehicleSectionConfig(int x, std::string config)
Definition: GameScript.cpp:1272
RoR::GameScript::hideDirectionArrow
void hideDirectionArrow()
Definition: GameScript.cpp:475
RoR::GameScript::deleteScriptFunction
int deleteScriptFunction(const Ogre::String &arg)
Deletes a global function from the script (Wrapper for ScriptEngine::deleteFunction)
Definition: GameScript.cpp:959
RoR::GameScript
Proxy class that can be called by script functions.
Definition: GameScript.h:41
instance
or anywhere else will not be considered a but parsed as regular data ! Each line is treated as values separated by separators Possible i e animators Multiline description Single instance
Definition: ReadMe.txt:53
RoR::GameScript::getTruckAIByNum
VehicleAIPtr getTruckAIByNum(int num)
Definition: GameScript.cpp:1035
RoR::GameScript::getRunningScripts
AngelScript::CScriptArray * getRunningScripts()
Returns array<int> with active ScriptUnitIDs; check agains global var thisScript or use getScriptDeta...
Definition: GameScript.cpp:987
RoR::GameScript::moveObjectVisuals
void moveObjectVisuals(const Ogre::String &instanceName, const Ogre::Vector3 &pos)
This moves an object to a new position.
Definition: GameScript.cpp:407
RoR::GameScript::addWaypoint
void addWaypoint(const Ogre::Vector3 &pos)
Definition: GameScript.cpp:1132
RoR::GameScript::getAIVehiclePositionScheme
int getAIVehiclePositionScheme()
Definition: GameScript.cpp:1172
RoR::GameScript::movePerson
void movePerson(const Ogre::Vector3 &vec)
moves the person relative
Definition: GameScript.cpp:135
RoR::GameScript::setCameraRoll
void setCameraRoll(float angle)
Rolls the camera anticlockwise, around its local z axis.
Definition: GameScript.cpp:763
BitMask_t
uint32_t BitMask_t
Definition: BitFlags.h:7
RoR::GameScript::checkResourceExists
bool checkResourceExists(const std::string &filename, const std::string &resource_group)
Checks if the resource file exists in the given group.
Definition: GameScript.cpp:1661
RoR::GameScript::getTextureUnitState
int getTextureUnitState(Ogre::TextureUnitState **tu, const Ogre::String materialName, int techniqueNum, int passNum, int textureUnitNum)
Definition: GameScript.cpp:575
RoR::GameScript::setAIVehicleSpeed
void setAIVehicleSpeed(int speed)
Definition: GameScript.cpp:1255
RoR::GameScript::setTrucksForcedAwake
void setTrucksForcedAwake(bool forceActive)
Definition: GameScript.cpp:104
RoR::GameScript::createSoundFromResource
SoundPtr createSoundFromResource(const std::string &filename, const std::string &resource_group_name)
Definition: GameScript.cpp:1651
RoR::GameScript::addScriptFunction
int addScriptFunction(const Ogre::String &arg)
Adds a global function to the script (Wrapper for ScriptEngine::addFunction)
Definition: GameScript.cpp:949
RoR::GameScript::setAIMode
void setAIMode(int mode)
Definition: GameScript.cpp:1309
RoR::GameScript::loadTextResourceAsString
std::string loadTextResourceAsString(const std::string &filename, const std::string &resource_group)
Loads a text file resource as string.
Definition: GameScript.cpp:1698
RoR::GameScript::setRegisteredEventsMask
void setRegisteredEventsMask(ScriptUnitId_t nid, BitMask_t eventMask)
Overwrites event mask for a specific running script.
Definition: GameScript.cpp:317
RoR::GameScript::getFPS
float getFPS()
Definition: GameScript.cpp:1343
RoR::GameScript::getScreenPosFromWorldPos
bool getScreenPosFromWorldPos(Ogre::Vector3 const &world_pos, Ogre::Vector2 &out_screen_pos)
Definition: GameScript.cpp:480
RoR::GameScript::repairVehicle
void repairVehicle(const Ogre::String &instance, const Ogre::String &box, bool keepPosition)
Definition: GameScript.cpp:382
RoR::GameScript::deleteResource
bool deleteResource(const std::string &filename, const std::string &resource_group)
Deletes a resource from the given group.
Definition: GameScript.cpp:1679
RoR
Definition: AppContext.h:36
RoR::GameScript::deleteScriptVariable
int deleteScriptVariable(const Ogre::String &arg)
Deletes a global variable from the script (Wrapper for ScriptEngine::deleteVariable)
Definition: GameScript.cpp:969
x
float x
Definition: (ValueTypes) quaternion.h:5
RoR::GameScript::setChatFontSize
void setChatFontSize(int size)
OBSOLETE, does nothing.
Definition: GameScript.cpp:343
RoR::GameScript::quitGame
void quitGame()
Definition: GameScript.cpp:1338
RoR::GameScript::spawnTruck
ActorPtr spawnTruck(Ogre::String &truckName, Ogre::Vector3 &pos, Ogre::Vector3 &rot)
Definition: GameScript.cpp:1046
RoR::GameScript::backToMenu
void backToMenu()
Definition: GameScript.cpp:1332
RoR::GameScript::unRegisterEvent
void unRegisterEvent(int eventValue)
unregisters from receiving event.
Definition: GameScript.cpp:297
RoR::GameScript::addScriptVariable
int addScriptVariable(const Ogre::String &arg)
Adds a global variable to the script (Wrapper for ScriptEngine::addVariable)
Definition: GameScript.cpp:964
RoR::GameScript::cameraLookAt
void cameraLookAt(const Ogre::Vector3 &targetPoint)
Points the camera at a location in worldspace.
Definition: GameScript.cpp:798
RoR::GameScript::setAIVehicleCount
void setAIVehicleCount(int count)
Definition: GameScript.cpp:1240
RoR::GameScript::getMouseScreenPosition
Ogre::Vector2 getMouseScreenPosition()
Gets mouse position in pixels.
Definition: GameScript.cpp:501
RoR::GameScript::logFormat
void logFormat(const char *fmt,...)
writes a message to the games log (RoR.log)
Definition: GameScript.cpp:85
RoR::GameScript::rangeRandom
float rangeRandom(float from, float to)
Definition: GameScript.cpp:686