RigsofRods
2023.09
Soft-body Physics Simulation
Go to the documentation of this file.
62 GravityCmd ():
ConsoleCmd (
"gravity" ,
"[<number> or <constant>]" ,
_L (
"Get or set terrain gravity. Constants: earth/moon/mars/jupiter." )) {}
64 void Run (Ogre::StringVector
const & args)
override
94 void Run (Ogre::StringVector
const & args)
override
101 reply << m_name <<
": " ;
105 reply <<
_L (
"This terrain does not have water." );
114 water->SetStaticWaterHeight(height);
127 void Run (Ogre::StringVector
const & args)
override
135 reply << m_name <<
": " ;
149 reply <<
_L (
"Terrain height at position: " )
150 <<
"x: " << pos.x <<
" z: " << pos.z <<
" = "
161 void Run (Ogre::StringVector
const & args)
override
170 reply << m_name <<
": " ;
175 if (args.size() == 1)
178 reply <<
_L (
"Missing parameter: " ) << m_usage;
183 if (
App::GetGameContext ()->GetTerrain()->getObjectManager()->LoadTerrainObject(args[1], pos, Ogre::Vector3::ZERO,
"Console" ,
"" ))
186 reply <<
_L (
"Spawned object at position: " ) <<
"x: " << pos.x <<
" z: " << pos.z;
191 reply <<
_L (
"Could not spawn object" );
195 catch (std::exception& e)
209 void Run (Ogre::StringVector
const & args)
override
212 reply << m_name <<
": " ;
217 const char * msg = (now_logging) ?
" logging to console enabled" :
" logging to console disabled" ;
230 void Run (Ogre::StringVector
const & args)
override
233 reply << m_name <<
": " ;
249 void Run (Ogre::StringVector
const & args)
override
255 reply << m_name <<
": " ;
262 reply <<
_L (
"Character position: " ) <<
"x: " << pos.x <<
" y: " << pos.y <<
" z: " << pos.z;
267 reply <<
_L (
"Vehicle position: " ) <<
"x: " << pos.x <<
" y: " << pos.y <<
" z: " << pos.z;
279 void Run (Ogre::StringVector
const & args)
override
285 reply << m_name <<
": " ;
288 if (args.size() != 4)
291 reply <<
_L (
"usage: goto x y z" );
302 reply <<
_L (
"Character position set to: " ) <<
"x: " << pos.x <<
" y: " << pos.y <<
" z: " << pos.z;
308 reply <<
_L (
"Vehicle position set to: " ) <<
"x: " << pos.x <<
" y: " << pos.y <<
" z: " << pos.z;
322 void Run (Ogre::StringVector
const & args)
override
328 reply << m_name <<
": " ;
331 #ifdef USE_ANGELSCRIPT
337 for (
int i = 1; i < args.size(); ++i)
339 code <<
" " << args[i];
344 reply <<
" >>> " << code.
ToCStr ();
351 reply <<
_L (
"Scripting disabled in this build" );
362 void Run (Ogre::StringVector
const & args)
override
368 reply << m_name <<
": " ;
372 if (sound_manager ==
nullptr )
374 reply <<
_L (
"unable to get sound manager" );
390 void Run (Ogre::StringVector
const & args)
override
401 void Run (Ogre::StringVector
const & args)
override
409 line.
Clear () << cmd_pair.second->getName() <<
" "
410 << cmd_pair.second->GetUsage() <<
" - " << cmd_pair.second->GetDoc();
428 void Run (Ogre::StringVector
const & args)
override
431 reply << m_name <<
": " ;
434 #ifdef USE_ANGELSCRIPT
435 if (args.size() == 1)
438 reply <<
_L (
"Missing parameter: " ) << m_usage;
446 reply <<
_L (
"Failed to load script. See 'Angelscript.log' or use console command `log` and retry." );
451 reply <<
fmt::format (
_L (
"Script '{}' running with ID '{}'" ), args[1],
id );
456 reply <<
_L (
"Scripting disabled in this build" );
471 void Run (Ogre::StringVector
const & args)
override
475 bool match = args.size() == 1;
476 for (
size_t i = 1; i < args.size(); ++i)
478 if (pair.first.find(args[i]) != std::string::npos)
488 reply <<
"vars: " << pair.first <<
"=" << pair.second->getStr() <<
" (" ;
491 else if (pair.second->hasFlag(
CVAR_TYPE_INT )) { reply <<
"int" ; }
493 else { reply <<
"string" ; }
495 if (pair.second->hasFlag(
CVAR_ARCHIVE )) { reply <<
", archive" ; }
496 if (pair.second->hasFlag(
CVAR_NO_LOG )) { reply <<
", no log" ; }
508 SetCmd ():
ConsoleCmd (
"set" ,
"<cvar> [<flags>] [<value>]" ,
_L (
"Get or set value of existing CVar" )) {}
510 void Run (Ogre::StringVector
const & args)
override
513 reply << m_name <<
": " ;
516 if (args.size() == 1)
519 reply << this->GetUsage() <<
" - " << this->GetDoc();
536 reply <<
_L (
"No such CVar: " ) << args[1];
547 SetCVarCmd (std::string
const & name, std::string
const & usage, std::string
const & doc,
int flag):
548 ConsoleCmd (name, usage, doc), m_cvar_flag(flag)
551 void Run (Ogre::StringVector
const & args)
override
554 reply << m_name <<
": " ;
557 if (args.size() == 1)
560 reply << this->GetUsage() <<
" - " << this->GetDoc() <<
"Switches: --autoapply/--allowstore/--autostore" ;
564 int flags = m_cvar_flag;
566 for (i = 1; i < args.size(); ++i)
572 if (i == args.size())
575 reply << this->GetUsage() <<
" - " << this->GetDoc() <<
"Switches: --archive" ;
580 if (args.size() > (i+1))
622 ClearCmd ():
ConsoleCmd (
"clear" ,
"[<type>]" ,
_L (
"Clear console history. Types: all/info/net/chat/terrn/actor/script" )) {}
624 void Run (Ogre::StringVector
const & args)
override
626 if (args.size() < 2 || args[1] ==
"all" )
635 if (args[1] ==
"chat" )
639 else if (args[1] ==
"net" )
665 auto erase_begin = std::remove_if(lock.
messages .begin(), lock.
messages .end(), filter_fn);
708 if (msg[0] ==
'/' || msg[0] ==
'\\' )
711 _L (
"Using slashes before commands are deprecated, you can now type command without any slashes" ));
712 msg.erase(msg.begin());
722 Ogre::StringVector args = Ogre::StringUtil::split(msg,
" " );
727 found->second->Run(args);
741 reply <<
_L (
"unknown command: " ) << msg;
757 reply <<
_L (
"Only allowed when simulation is running" );
761 reply <<
_L (
"Not allowed in current app state" );
#define ROR_ASSERT(_EXPR)
Game state manager and message-queue provider.
@ CVAR_NO_LOG
Will not be written to RoR.log.
void resetPosition(Ogre::Vector3 translation, bool setInitPosition)
Moves the actor to given world coords (pivot point is node 0).
void setPosition(Ogre::Vector3 position)
SoundScriptManager * GetSoundScriptManager()
CVar * cVarGet(std::string const &input_name, int flags)
Get cvar by short/long name, or create new one using input as short name.
void Run(Ogre::StringVector const &args) override
@ SE_ANGELSCRIPT_MANIPULATIONS
triggered when the user tries to dynamically use the scripting capabilities (prevent cheating) args: ...
void Run(Ogre::StringVector const &args) override
float GetSpeedOfSound() const
@ CONSOLE_MSGTYPE_TERRN
Parsing/spawn/simulation messages for terrain.
void Run(Ogre::StringVector const &args) override
static const ScriptUnitID_t SCRIPTUNITID_INVALID
ActorInstanceID_t ar_instance_id
Static attr; session-unique ID.
std::string const & getName() const
Truck file format(technical spec)
SetCVarCmd(std::string const &name, std::string const &usage, std::string const &doc, int flag)
Character * GetPlayerCharacter()
void setGravity(float value)
void TRIGGER_EVENT_ASYNC(scriptEvents type, int arg1, int arg2ex=0, int arg3ex=0, int arg4ex=0, std::string arg5ex="", std::string arg6ex="", std::string arg7ex="", std::string arg8ex="")
Asynchronously (via MSG_SIM_SCRIPT_EVENT_TRIGGERED) invoke script function eventCallbackEx(),...
SoundManager * getSoundManager()
CVar * cVarFind(std::string const &input_name)
Find cvar by short/long name.
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
void Run(Ogre::StringVector const &args) override
@ CVAR_ARCHIVE
Will be written to RoR.cfg.
std::vector< Message > & messages
ScriptEngine * GetScriptEngine()
void Run(Ogre::StringVector const &args) override
float getWaterHeight() const
std::string const & getStr() const
void cVarAssign(CVar *cvar, std::string const &value)
Parse value by cvar type.
float getHeightAt(float x, float z)
@ ASMANIP_CONSOLE_SNIPPET_EXECUTED
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void PushMessage(Message m)
Doesn't guarantee order! Use ChainMessage() if order matters.
void BroadcastChatMsg(const char *msg)
const char * ToCStr() const
Ogre::Vector3 getPosition()
Central state/object manager and communications hub.
GameContext * GetGameContext()
void Run(Ogre::StringVector const &args) override
void doCommand(std::string msg)
Identify and execute any console line.
Ogre::Vector3 getPosition()
void triggerEvent(scriptEvents eventnum, int arg1=0, int arg2ex=0, int arg3ex=0, int arg4ex=0, std::string arg5ex="", std::string arg6ex="", std::string arg7ex="", std::string arg8ex="")
triggers an event; Not to be used by the end-user.
@ CONSOLE_SYSTEM_REPLY
Success.
const char *const ROR_VERSION_STRING
Quake-style console variable, defined in RoR.cfg or crated via Console UI and scripts.
CVar * diag_log_console_echo
bool CheckAppState(AppState state)
std::string const & getName() const
Base (abstract) console command.
Unified game event system - all requests and state changes are reported using a message.
@ SE_TRUCK_TELEPORT
triggered when the user teleports the truck, the argument refers to the actor ID of the vehicle
void regBuiltinCommands()
Register builtin commands.
float GetStaticWaterHeight()
Returns static water level configured in 'terrn2'.
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
@ CONSOLE_MSGTYPE_ACTOR
Parsing/spawn/simulation messages for actors.
static const float DEFAULT_GRAVITY
earth gravity
ScriptUnitID_t loadScript(Ogre::String filename, ScriptCategory category=ScriptCategory::TERRAIN, ActorPtr associatedActor=nullptr, std::string buffer="")
Loads a script.
int ScriptUnitID_t
Unique sequentially generated ID of a loaded and running scriptin session. Use ScriptEngine::getScrip...
@ CONSOLE_MSGTYPE_INFO
Generic message.
@ CONSOLE_MSGTYPE_SCRIPT
Messages sent from scripts.
ScriptRetCode_t executeString(Ogre::String command)
executes a string (useful for the console)
void Run(Ogre::StringVector const &args) override
const char *const ROR_BUILD_DATE
const ActorPtr & GetPlayerActor()
void Run(Ogre::StringVector const &args) override
const char *const ROR_BUILD_TIME
void Run(Ogre::StringVector const &args) override
@ CUSTOM
Loaded by user via either: A) ingame console 'loadscript'; B) RoR.cfg 'app_custom_scripts'; C) comman...
@ MSG_APP_SHUTDOWN_REQUESTED
void Run(Ogre::StringVector const &args) override
const TerrainPtr & GetTerrain()