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  ScriptRetCode_t addScriptFunction(const Ogre::String& arg, ScriptUnitID_t nid);
225 
231  ScriptRetCode_t scriptFunctionExists(const Ogre::String& arg, ScriptUnitID_t nid);
232 
238  ScriptRetCode_t deleteScriptFunction(const Ogre::String& arg, ScriptUnitID_t nid);
239 
245  ScriptRetCode_t addScriptVariable(const Ogre::String& arg, ScriptUnitID_t nid);
246 
252  ScriptRetCode_t scriptVariableExists(const Ogre::String& arg, ScriptUnitID_t nid);
253 
259  ScriptRetCode_t deleteScriptVariable(const Ogre::String& arg, ScriptUnitID_t nid);
260 
269  ScriptRetCode_t getScriptVariable(const Ogre::String& varName, void *ref, int refTypeId, ScriptUnitID_t nid);
270 
271  void clearEventCache();
272 
276  int sendGameCmd(const Ogre::String& message);
277 
281  AngelScript::CScriptArray* getRunningScripts();
282 
291  AngelScript::CScriptDictionary* getScriptDetails(ScriptUnitID_t nid);
292 
294 
297 
298  void loadTerrain(const Ogre::String& terrain);
299 
304  int getLoadedTerrain(Ogre::String& result);
305 
306  bool getCaelumAvailable();
307 
312  Ogre::String getCaelumTime();
313 
318  void setCaelumTime(float value);
319 
324  float getGravity();
325 
330  void setGravity(float value);
331 
335  float getGroundHeight(Ogre::Vector3& v);
336 
341  float getWaterHeight();
342 
347  void setWaterHeight(float value);
348 
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);
359 
366  void moveObjectVisuals(const Ogre::String& instanceName, const Ogre::Vector3& pos);
367 
373  void destroyObject(const Ogre::String& instanceName);
374 
378  AngelScript::CScriptArray* getEditorObjects();
379 
385  bool getMousePositionOnTerrain(Ogre::Vector3& out_pos);
386 
390  AngelScript::CScriptArray* getMousePointedMovableObjects();
391 
393 
395 
398 
399  Ogre::Vector3 getPersonPosition();
400 
405  void setPersonPosition(const Ogre::Vector3& vec);
406 
411  void movePerson(const Ogre::Vector3& vec);
412 
417  void setPersonRotation(const Ogre::Radian& rot);
418 
423  Ogre::Radian getPersonRotation();
424 
426 
429 
430  void activateAllVehicles();
431 
432  void setTrucksForcedAwake(bool forceActive);
433 
434  //anglescript test
435  void boostCurrentTruck(float factor);
436 
442 
447  ActorPtr getTruckByNum(int num);
448 
453  AngelScript::CScriptArray* getAllTrucks();
454 
459  int getCurrentTruckNumber();
460 
461  ActorPtr spawnTruck(Ogre::String& truckName, Ogre::Vector3& pos, Ogre::Vector3& rot);
462 
463  void repairVehicle(const Ogre::String& instance, const Ogre::String& box, bool keepPosition);
464 
465  void removeVehicle(const Ogre::String& instance, const Ogre::String& box);
466 
467  int getNumTrucksByFlag(int flag);
468 
473 
475 
478 
483 
485 
488 
489  ActorPtr spawnTruckAI(Ogre::String& truckName, Ogre::Vector3& pos, Ogre::String& truckSectionConfig, std::string& truckSkin, int x);
490  AngelScript::CScriptArray* getWaypoints(int x);
491  AngelScript::CScriptArray* getWaypointsSpeed();
492  void addWaypoint(const Ogre::Vector3& pos);
493  int getAIVehicleCount();
494  int getAIVehicleDistance();
496  int getAIVehicleSpeed();
497  Ogre::String getAIVehicleName(int x);
498  Ogre::String getAIVehicleSectionConfig(int x);
499  std::string getAIVehicleSkin(int x);
500  int getAIRepeatTimes();
501  int getAIMode();
503  VehicleAIPtr getTruckAIByNum(int num);
504  // AI: set
505  void setAIVehicleCount(int count);
506  void setAIVehicleDistance(int dist);
507  void setAIVehiclePositionScheme(int scheme);
508  void setAIVehicleSpeed(int speed);
509  void setAIVehicleName(int x, std::string name);
510  void setAIVehicleSectionConfig(int x, std::string config);
511  void setAIVehicleSkin(int x, std::string skin);
512  void setAIRepeatTimes(int times);
513  void setAIMode(int mode);
514 
516 
519 
524  void setCameraPosition(const Ogre::Vector3& pos);
525 
530  void setCameraDirection(const Ogre::Vector3& vec);
531 
536  void setCameraOrientation(const Ogre::Quaternion& q);
537 
542  void setCameraRoll(float angle);
543 
548  void setCameraYaw(float angle);
549 
554  void setCameraPitch(float angle);
555 
560  Ogre::Vector3 getCameraPosition();
561 
566  Ogre::Vector3 getCameraDirection();
567 
572  Ogre::Quaternion getCameraOrientation();
573 
582  void cameraLookAt(const Ogre::Vector3& targetPoint);
583 
585 
588 
589  void stopTimer();
590  void startTimer(int id);
591  void setTimeDiff(float diff);
592  void setBestLapTime(float time);
593 
595 
598 
599  int setMaterialAmbient(const Ogre::String& materialName, float red, float green, float blue);
600  int setMaterialDiffuse(const Ogre::String& materialName, float red, float green, float blue, float alpha);
601  int setMaterialSpecular(const Ogre::String& materialName, float red, float green, float blue, float alpha);
602  int setMaterialEmissive(const Ogre::String& materialName, float red, float green, float blue);
603  int setMaterialTextureName(const Ogre::String& materialName, int techniqueNum, int passNum, int textureUnitNum, const Ogre::String& textureName);
604  int setMaterialTextureRotate(const Ogre::String& materialName, int techniqueNum, int passNum, int textureUnitNum, float rotation);
605  int setMaterialTextureScroll(const Ogre::String& materialName, int techniqueNum, int passNum, int textureUnitNum, float sx, float sy);
606  int setMaterialTextureScale(const Ogre::String& materialName, int techniqueNum, int passNum, int textureUnitNum, float u, float v);
607 
609 
612 
613  AngelScript::CScriptArray* getAllSoundScriptTemplates();
614  SoundScriptTemplatePtr getSoundScriptTemplate(const std::string& name);
615  AngelScript::CScriptArray* getAllSoundScriptInstances();
616 
621  SoundPtr createSoundFromResource(const std::string& filename, const std::string& resource_group_name);
622 
623  SoundScriptInstancePtr createSoundScriptInstance(const std::string& template_name, int actor_instance_id /*= SoundScriptInstance::ACTOR_ID_UNKNOWN*/);
624 
626 
627 private:
628 
629  bool HaveSimTerrain(const char* func_name);
630  bool HavePlayerAvatar(const char* func_name);
631  bool HaveMainCamera(const char* func_name);
632  std::string CheckFileAccess(const char* func_name, const std::string& filename, const std::string& resource_group);
633  int getTextureUnitState(Ogre::TextureUnitState** tu, const Ogre::String materialName, int techniqueNum, int passNum, int textureUnitNum);
634 
639  void logFormat(const char* fmt, ...);
640 };
641 
643 
644 } // 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:2020
RoR::GameScript::getAIVehicleSkin
std::string getAIVehicleSkin(int x)
Definition: GameScript.cpp:1247
RoR::GameScript::getSoundScriptTemplate
SoundScriptTemplatePtr getSoundScriptTemplate(const std::string &name)
Definition: GameScript.cpp:1805
RoR::GameScript::getAllSoundScriptTemplates
AngelScript::CScriptArray * getAllSoundScriptTemplates()
Definition: GameScript.cpp:1800
RoR::GameScript::getScriptVariable
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.
Definition: GameScript.cpp:1004
RoR::GameScript::stopTimer
void stopTimer()
Definition: GameScript.cpp:192
RoR::GameScript::getTerrain
TerrainPtr getTerrain()
Definition: GameScript.cpp:729
RoR::GameScript::setCameraPosition
void setCameraPosition(const Ogre::Vector3 &pos)
Sets the camera's position.
Definition: GameScript.cpp:748
RoR::GameScript::sendGameCmd
int sendGameCmd(const Ogre::String &message)
Multiplayer only: sends AngelScript snippet to all players.
Definition: GameScript.cpp:1009
RoR::GameScript::setAIRepeatTimes
void setAIRepeatTimes(int times)
Definition: GameScript.cpp:1339
RoR::GameScript::setMaterialTextureScale
int setMaterialTextureScale(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float u, float v)
Definition: GameScript.cpp:692
RoR::GameScript::getLoadedTerrain
int getLoadedTerrain(Ogre::String &result)
gets the name of current terrain.
Definition: GameScript.cpp:716
RoR::GameScript::getCurrentTruckNumber
int getCurrentTruckNumber()
returns the current truck number.
Definition: GameScript.cpp:280
RoR::GameScript::setMaterialTextureRotate
int setMaterialTextureRotate(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float rotation)
Definition: GameScript.cpp:654
RoR::GameScript::setMaterialTextureScroll
int setMaterialTextureScroll(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, float sx, float sy)
Definition: GameScript.cpp:673
RoR::GameScript::getAIMode
int getAIMode()
Definition: GameScript.cpp:1267
RoR::GameScript::createSoundScriptInstance
SoundScriptInstancePtr createSoundScriptInstance(const std::string &template_name, int actor_instance_id)
Definition: GameScript.cpp:1820
RoR::GameScript::setCameraOrientation
void setCameraOrientation(const Ogre::Quaternion &q)
Sets the camera's orientation.
Definition: GameScript.cpp:764
RoR::GameScript::setRegisteredEventsMask
void setRegisteredEventsMask(ScriptUnitID_t nid, BitMask_t eventMask)
Overwrites event mask for a specific running script.
Definition: GameScript.cpp:318
RoR::GameScript::getTime
float getTime()
returns the time in seconds since the game was started
Definition: GameScript.cpp:110
RoR::GameScript::setWaterHeight
void setWaterHeight(float value)
sets the base water height
Definition: GameScript.cpp:212
RoR::GameScript::setPersonRotation
void setPersonRotation(const Ogre::Radian &rot)
sets the character rotation
Definition: GameScript.cpp:144
RoR::GameScript::setMaterialDiffuse
int setMaterialDiffuse(const Ogre::String &materialName, float red, float green, float blue, float alpha)
Definition: GameScript.cpp:549
RoR::GameScript::addScriptVariable
ScriptRetCode_t addScriptVariable(const Ogre::String &arg, ScriptUnitID_t nid)
Adds a global variable to the script (Wrapper for ScriptEngine::addVariable)
Definition: GameScript.cpp:989
RoR::GameScript::pushMessage
bool pushMessage(MsgType type, AngelScript::CScriptDictionary *dict)
Pushes a message to internal message queue.
Definition: GameScript.cpp:1442
RoR::GameScript::setCameraPitch
void setCameraPitch(float angle)
Pitches the camera up/down anticlockwise around it's local z axis.
Definition: GameScript.cpp:780
RoR::GameScript::getWaterHeight
float getWaterHeight()
returns the current base water level (without waves)
Definition: GameScript.cpp:233
RoR::GameScript::getAIVehicleDistance
int getAIVehicleDistance()
Definition: GameScript.cpp:1201
RoR::GameScript::updateDirectionArrow
void updateDirectionArrow(Ogre::String &text, Ogre::Vector3 &vec)
set direction arrow
Definition: GameScript.cpp:334
RoR::GameScript::getWaypointsSpeed
AngelScript::CScriptArray * getWaypointsSpeed()
Definition: GameScript.cpp:1176
RoR::GameScript::flashMessage
void flashMessage(Ogre::String &txt, float time, float charHeight)
DEPRECATED: use message() shows a message to the user.
Definition: GameScript.cpp:324
RoR::GameScript::setAIVehicleName
void setAIVehicleName(int x, std::string name)
Definition: GameScript.cpp:1295
RoR::ScriptRetCode_t
int ScriptRetCode_t
see enum RoR::ScriptRetCode - combines AngelScript codes and RoR internal codes.
Definition: ForwardDeclarations.h:82
RoR::GameScript::getNumTrucksByFlag
int getNumTrucksByFlag(int flag)
Definition: GameScript.cpp:269
RoR::GameScript::setAIVehicleSkin
void setAIVehicleSkin(int x, std::string skin)
Definition: GameScript.cpp:1323
RoR::GameScript::getCaelumAvailable
bool getCaelumAvailable()
Definition: GameScript.cpp:182
RoR::GameScript::activateAllVehicles
void activateAllVehicles()
Definition: GameScript.cpp:100
RoR::GameScript::setMaterialTextureName
int setMaterialTextureName(const Ogre::String &materialName, int techniqueNum, int passNum, int textureUnitNum, const Ogre::String &textureName)
Definition: GameScript.cpp:634
RoR::GameScript::getCurrentTruckAI
VehicleAIPtr getCurrentTruckAI()
Definition: GameScript.cpp:1060
RoR::GameScript::getMousePositionOnTerrain
bool getMousePositionOnTerrain(Ogre::Vector3 &out_pos)
Calculates mouse cursor position on terrain.
Definition: GameScript.cpp:1388
RoR::GameScript::getPersonPosition
Ogre::Vector3 getPersonPosition()
Definition: GameScript.cpp:128
RoR::GameScript::loadTerrain
void loadTerrain(const Ogre::String &terrain)
Definition: GameScript.cpp:123
RoR::GameScript::getTruckByNum
ActorPtr getTruckByNum(int num)
returns a truck by index, get max index by calling getNumTrucks
Definition: GameScript.cpp:264
RoR::GameScript::getSceneManager
Ogre::SceneManager * getSceneManager()
Definition: GameScript.cpp:1437
RoR::GameScript::HaveSimTerrain
bool HaveSimTerrain(const char *func_name)
Helper; Check if SimController instance exists, log warning if not.
Definition: GameScript.cpp:2010
RoR::GameScript::getGroundHeight
float getGroundHeight(Ogre::Vector3 &v)
Gets terrain height at given coordinates.
Definition: GameScript.cpp:225
RoR::GameScript::getAIVehicleName
Ogre::String getAIVehicleName(int x)
Definition: GameScript.cpp:1219
RoR::GameScript::getAIVehicleCount
int getAIVehicleCount()
Definition: GameScript.cpp:1195
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:942
RoR::GameScript::getWaypoints
AngelScript::CScriptArray * getWaypoints(int x)
Definition: GameScript.cpp:1130
RoR::GameScript::setCameraDirection
void setCameraDirection(const Ogre::Vector3 &vec)
Sets the camera's direction vector.
Definition: GameScript.cpp:756
RoR::GameScript::setAIVehiclePositionScheme
void setAIVehiclePositionScheme(int scheme)
Definition: GameScript.cpp:1285
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:1969
RoR::GameScript::startTimer
void startTimer(int id)
Definition: GameScript.cpp:197
RoR::GameScript::getAIRepeatTimes
int getAIRepeatTimes()
Definition: GameScript.cpp:1261
RoR::GameScript::getGravity
float getGravity()
returns the currently set upo gravity
Definition: GameScript.cpp:246
RefCountingObjectPtr< Terrain >
RoR::GameScript::getAvgFPS
float getAvgFPS()
Definition: GameScript.cpp:1383
RoR::GameScript::scriptFunctionExists
ScriptRetCode_t scriptFunctionExists(const Ogre::String &arg, ScriptUnitID_t nid)
Checks if a global function exists in the script (Wrapper for ScriptEngine::functionExists)
Definition: GameScript.cpp:979
RoR::GameScript::getMousePointedMovableObjects
AngelScript::CScriptArray * getMousePointedMovableObjects()
Returns array<Ogre::MovableObjects@> in no particular order.
Definition: GameScript.cpp:1421
RoR::GameScript::clearEventCache
void clearEventCache()
Definition: GameScript.cpp:734
RoR::GameScript::removeVehicle
void removeVehicle(const Ogre::String &instance, const Ogre::String &box)
Definition: GameScript.cpp:388
RoR::GameScript::showChooser
void showChooser(const Ogre::String &type, const Ogre::String &instance, const Ogre::String &box)
Definition: GameScript.cpp:349
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:443
RoR::GameScript::getCurrentTruck
ActorPtr getCurrentTruck()
returns the current selected truck, 0 if in person mode
Definition: GameScript.cpp:241
RoR::GameScript::HaveMainCamera
bool HaveMainCamera(const char *func_name)
Helper; Check if main camera exists, log warning if not.
Definition: GameScript.cpp:2030
RoR::GameScript::boostCurrentTruck
void boostCurrentTruck(float factor)
Definition: GameScript.cpp:963
RoR::GameScript::getCaelumTime
Ogre::String getCaelumTime()
gets the time of the day in seconds
Definition: GameScript.cpp:160
RoR::ActorInstanceID_t
int ActorInstanceID_t
Unique sequentially generated ID of an actor in session. Use ActorManager::GetActorById()
Definition: ForwardDeclarations.h:38
RoR::GameScript::getCameraOrientation
Ogre::Quaternion getCameraOrientation()
Gets the camera's orientation.
Definition: GameScript.cpp:815
RoR::GameScript::getAIVehicleSpeed
int getAIVehicleSpeed()
Definition: GameScript.cpp:1213
RoR::GameScript::setMaterialSpecular
int setMaterialSpecular(const Ogre::String &materialName, float red, float green, float blue, float alpha)
Definition: GameScript.cpp:566
RoR::GameScript::message
void message(Ogre::String &txt, Ogre::String &icon)
shows a message to the user over the console system
Definition: GameScript.cpp:329
RoR::GameScript::getCameraPosition
Ogre::Vector3 getCameraPosition()
Retrieves the camera's position.
Definition: GameScript.cpp:796
RoR::GameScript::getAIVehicleSectionConfig
Ogre::String getAIVehicleSectionConfig(int x)
Definition: GameScript.cpp:1233
RoR::GameScript::setTimeDiff
void setTimeDiff(float diff)
Definition: GameScript.cpp:202
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:1938
RoR::GameScript::setGravity
void setGravity(float value)
sets the gravity terrain wide.
Definition: GameScript.cpp:256
RoR::GameScript::setBestLapTime
void setBestLapTime(float time)
Definition: GameScript.cpp:207
RoR::GameScript::setMaterialAmbient
int setMaterialAmbient(const Ogre::String &materialName, float red, float green, float blue)
Definition: GameScript.cpp:532
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:1349
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:2040
RoR::GameScript::useOnlineAPI
int useOnlineAPI(const Ogre::String &apiquery, const AngelScript::CScriptDictionary &dict, Ogre::String &result)
Definition: GameScript.cpp:831
RoR::FreeForceID_t
int FreeForceID_t
Unique sequentially generated ID of FreeForce; use ActorManager::GetFreeForceNextId().
Definition: ForwardDeclarations.h:67
RoR::GameScript::setPersonPosition
void setPersonPosition(const Ogre::Vector3 &vec)
sets the character position
Definition: GameScript.cpp:115
RoR::GameScript::destroyObject
void destroyObject(const Ogre::String &instanceName)
This destroys an object.
Definition: GameScript.cpp:421
RoR::GameScript::deleteScriptVariable
ScriptRetCode_t deleteScriptVariable(const Ogre::String &arg, ScriptUnitID_t nid)
Deletes a global variable from the script (Wrapper for ScriptEngine::deleteVariable)
Definition: GameScript.cpp:999
RoR::GameScript::setCaelumTime
void setCaelumTime(float value)
sets the time of the day in seconds
Definition: GameScript.cpp:172
RoR::GameScript::getRegisteredEventsMask
BitMask_t getRegisteredEventsMask(ScriptUnitID_t nid)
Gets event mask for a specific running script.
Definition: GameScript.cpp:310
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:286
Application.h
Central state/object manager and communications hub.
RoR::GameScript::setAIVehicleDistance
void setAIVehicleDistance(int dist)
Definition: GameScript.cpp:1280
RoR::GameScript::log
void log(const Ogre::String &msg)
writes a message to the games log (RoR.log)
Definition: GameScript.cpp:81
RoR::GameScript::getCameraDirection
Ogre::Vector3 getCameraDirection()
Gets the camera's direction.
Definition: GameScript.cpp:804
RoR::GameScript::setCameraYaw
void setCameraYaw(float angle)
Rotates the camera anticlockwise around it's local y axis.
Definition: GameScript.cpp:772
RoR::GameScript::spawnTruckAI
ActorPtr spawnTruckAI(Ogre::String &truckName, Ogre::Vector3 &pos, Ogre::String &truckSectionConfig, std::string &truckSkin, int x)
Definition: GameScript.cpp:1090
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:1032
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:947
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:1987
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:1910
RoR::GameScript::getActorNextInstanceId
ActorInstanceID_t getActorNextInstanceId()
Returns an unused (not reused) ID to use with MSG_SIM_SPAWN_ACTOR_REQUESTED; see game....
Definition: GameScript.cpp:1792
RoR::GameScript::getAllTrucks
AngelScript::CScriptArray * getAllTrucks()
returns an array of all currently existing actors.
Definition: GameScript.cpp:1153
RoR::GameScript::getPersonRotation
Ogre::Radian getPersonRotation()
gets the character rotation
Definition: GameScript.cpp:152
RoR::GameScript::getDisplaySize
Ogre::Vector2 getDisplaySize()
Gets screen size in pixels.
Definition: GameScript.cpp:520
RoR::GameScript::getChatFontSize
int getChatFontSize()
OBSOLETE, returns 0;.
Definition: GameScript.cpp:339
RoR::GameScript::setMaterialEmissive
int setMaterialEmissive(const Ogre::String &materialName, float red, float green, float blue)
Definition: GameScript.cpp:583
RoR::GameScript::getEditorObjects
AngelScript::CScriptArray * getEditorObjects()
Returns array<TerrainEditorObjectClassPtr@> with all static objects on map (from any source).
Definition: GameScript.cpp:397
RoR::GameScript::getAllSoundScriptInstances
AngelScript::CScriptArray * getAllSoundScriptInstances()
Definition: GameScript.cpp:1810
RoR::GameScript::setAIVehicleSectionConfig
void setAIVehicleSectionConfig(int x, std::string config)
Definition: GameScript.cpp:1307
RoR::GameScript::hideDirectionArrow
void hideDirectionArrow()
Definition: GameScript.cpp:500
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:1070
RoR::GameScript::getRunningScripts
AngelScript::CScriptArray * getRunningScripts()
Returns array<int> with active ScriptUnitIDs; check agains global var thisScript or use getScriptDeta...
Definition: GameScript.cpp:1022
RoR::GameScript::moveObjectVisuals
void moveObjectVisuals(const Ogre::String &instanceName, const Ogre::Vector3 &pos)
This moves an object to a new position.
Definition: GameScript.cpp:432
RoR::GameScript::addWaypoint
void addWaypoint(const Ogre::Vector3 &pos)
Definition: GameScript.cpp:1167
RoR::GameScript::getFreeForceNextId
FreeForceID_t getFreeForceNextId()
Returns an unused (not reused) ID to use with MSG_SIM_ADD_FREEFORCE_REQUESTED; see game....
Definition: GameScript.cpp:1787
RoR::GameScript::getAIVehiclePositionScheme
int getAIVehiclePositionScheme()
Definition: GameScript.cpp:1207
RoR::GameScript::movePerson
void movePerson(const Ogre::Vector3 &vec)
moves the person relative
Definition: GameScript.cpp:136
RoR::GameScript::addScriptFunction
ScriptRetCode_t addScriptFunction(const Ogre::String &arg, ScriptUnitID_t nid)
Adds a global function to the script (Wrapper for ScriptEngine::addFunction)
Definition: GameScript.cpp:974
RoR::GameScript::setCameraRoll
void setCameraRoll(float angle)
Rolls the camera anticlockwise, around its local z axis.
Definition: GameScript.cpp:788
RoR::GameScript::deleteScriptFunction
ScriptRetCode_t deleteScriptFunction(const Ogre::String &arg, ScriptUnitID_t nid)
Deletes a global function from the script (Wrapper for ScriptEngine::deleteFunction)
Definition: GameScript.cpp:984
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:1825
RoR::GameScript::getTextureUnitState
int getTextureUnitState(Ogre::TextureUnitState **tu, const Ogre::String materialName, int techniqueNum, int passNum, int textureUnitNum)
Definition: GameScript.cpp:600
RoR::ScriptUnitID_t
int ScriptUnitID_t
Unique sequentially generated ID of a loaded and running scriptin session. Use ScriptEngine::getScrip...
Definition: ForwardDeclarations.h:41
RoR::GameScript::setAIVehicleSpeed
void setAIVehicleSpeed(int speed)
Definition: GameScript.cpp:1290
RoR::GameScript::setTrucksForcedAwake
void setTrucksForcedAwake(bool forceActive)
Definition: GameScript.cpp:105
RoR::GameScript::createSoundFromResource
SoundPtr createSoundFromResource(const std::string &filename, const std::string &resource_group_name)
Definition: GameScript.cpp:1815
RoR::GameScript::setAIMode
void setAIMode(int mode)
Definition: GameScript.cpp:1344
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:1862
RoR::GameScript::getFPS
float getFPS()
Definition: GameScript.cpp:1378
RoR::GameScript::getScreenPosFromWorldPos
bool getScreenPosFromWorldPos(Ogre::Vector3 const &world_pos, Ogre::Vector2 &out_screen_pos)
Definition: GameScript.cpp:505
RoR::GameScript::repairVehicle
void repairVehicle(const Ogre::String &instance, const Ogre::String &box, bool keepPosition)
Definition: GameScript.cpp:383
RoR::GameScript::deleteResource
bool deleteResource(const std::string &filename, const std::string &resource_group)
Deletes a resource from the given group.
Definition: GameScript.cpp:1843
RoR
Definition: AppContext.h:36
x
float x
Definition: (ValueTypes) quaternion.h:5
RoR::GameScript::setChatFontSize
void setChatFontSize(int size)
OBSOLETE, does nothing.
Definition: GameScript.cpp:344
RoR::GameScript::quitGame
void quitGame()
Definition: GameScript.cpp:1373
RoR::GameScript::spawnTruck
ActorPtr spawnTruck(Ogre::String &truckName, Ogre::Vector3 &pos, Ogre::Vector3 &rot)
Definition: GameScript.cpp:1081
RoR::GameScript::backToMenu
void backToMenu()
Definition: GameScript.cpp:1367
RoR::GameScript::unRegisterEvent
void unRegisterEvent(int eventValue)
unregisters from receiving event.
Definition: GameScript.cpp:298
RoR::GameScript::cameraLookAt
void cameraLookAt(const Ogre::Vector3 &targetPoint)
Points the camera at a location in worldspace.
Definition: GameScript.cpp:823
RoR::GameScript::setAIVehicleCount
void setAIVehicleCount(int count)
Definition: GameScript.cpp:1275
RoR::GameScript::getMouseScreenPosition
Ogre::Vector2 getMouseScreenPosition()
Gets mouse position in pixels.
Definition: GameScript.cpp:526
RoR::GameScript::scriptVariableExists
ScriptRetCode_t scriptVariableExists(const Ogre::String &arg, ScriptUnitID_t nid)
Adds a global variable to the script (Wrapper for ScriptEngine::variableExists)
Definition: GameScript.cpp:994
RoR::GameScript::logFormat
void logFormat(const char *fmt,...)
writes a message to the games log (RoR.log)
Definition: GameScript.cpp:86
RoR::GameScript::rangeRandom
float rangeRandom(float from, float to)
Definition: GameScript.cpp:711