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
64 void Run(Ogre::StringVector
const& args)
override {
…}
94 void Run(Ogre::StringVector
const& args)
override
105 reply <<
_L(
"This terrain does not have water.");
114 water->SetStaticWaterHeight(height);
94 void Run(Ogre::StringVector
const& args)
override {
…}
127 void Run(Ogre::StringVector
const& args)
override
149 reply <<
_L(
"Terrain height at position: ")
150 <<
"x: " << pos.x <<
" z: " << pos.z <<
" = "
127 void Run(Ogre::StringVector
const& args)
override {
…}
161 void Run(Ogre::StringVector
const& args)
override
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)
161 void Run(Ogre::StringVector
const& args)
override {
…}
209 void Run(Ogre::StringVector
const& args)
override
217 const char* msg = (now_logging) ?
" logging to console enabled" :
" logging to console disabled";
209 void Run(Ogre::StringVector
const& args)
override {
…}
230 void Run(Ogre::StringVector
const& args)
override
230 void Run(Ogre::StringVector
const& args)
override {
…}
249 void Run(Ogre::StringVector
const& args)
override
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;
249 void Run(Ogre::StringVector
const& args)
override {
…}
279 void Run(Ogre::StringVector
const& args)
override
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;
279 void Run(Ogre::StringVector
const& args)
override {
…}
322 void Run(Ogre::StringVector
const& args)
override
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");
322 void Run(Ogre::StringVector
const& args)
override {
…}
362 void Run(Ogre::StringVector
const& args)
override
372 if (sound_manager ==
nullptr)
374 reply <<
_L(
"unable to get sound manager");
362 void Run(Ogre::StringVector
const& args)
override {
…}
390 void Run(Ogre::StringVector
const& args)
override
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();
401 void Run(Ogre::StringVector
const& args)
override {
…}
428 void Run(Ogre::StringVector
const& args)
override
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");
428 void Run(Ogre::StringVector
const& args)
override {
…}
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"; }
471 void Run(Ogre::StringVector
const& args)
override {
…}
508 SetCmd():
ConsoleCmd(
"set",
"<cvar> [<flags>] [<value>]",
_L(
"Get or set value of existing CVar")) {}
510 void Run(Ogre::StringVector
const& args)
override
516 if (args.size() == 1)
536 reply <<
_L(
"No such CVar: ") << args[1];
510 void Run(Ogre::StringVector
const& args)
override {
…}
547 SetCVarCmd(std::string
const& name, std::string
const& usage, std::string
const& doc,
int flag):
547 SetCVarCmd(std::string
const& name, std::string
const& usage, std::string
const& doc,
int flag): {
…}
551 void Run(Ogre::StringVector
const& args)
override
557 if (args.size() == 1)
560 reply << this->
GetUsage() <<
" - " << this->
GetDoc() <<
"Switches: --autoapply/--allowstore/--autostore";
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))
551 void Run(Ogre::StringVector
const& args)
override {
…}
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")
659 fmt::format(
_L(
"No such message type: {}"), args[1]));
665 auto erase_begin = std::remove_if(lock.
messages.begin(), lock.
messages.end(), filter_fn);
624 void Run(Ogre::StringVector
const& args)
override {
…}
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");
Central state/object manager and communications hub.
#define ROR_ASSERT(_EXPR)
Game state manager and message-queue provider.
const char *const ROR_BUILD_DATE
const char *const ROR_VERSION_STRING
const char *const ROR_BUILD_TIME
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
Ogre::Vector3 getPosition()
ActorInstanceID_t ar_instance_id
Static attr; session-unique ID.
void resetPosition(Ogre::Vector3 translation, bool setInitPosition)
Moves the actor to given world coords (pivot point is node 0).
Quake-style console variable, defined in RoR.cfg or crated via Console UI and scripts.
std::string const & getName() const
std::string const & getStr() const
void setPosition(Ogre::Vector3 position)
Ogre::Vector3 getPosition()
Base (abstract) console command.
std::string const & GetDoc() const
std::string const & GetUsage() const
std::string const & getName() const
void cVarAssign(CVar *cvar, std::string const &value)
Parse value by cvar type.
CommandPtrMap & getCommands()
@ CONSOLE_MSGTYPE_ACTOR
Parsing/spawn/simulation messages for actors.
@ CONSOLE_MSGTYPE_SCRIPT
Messages sent from scripts.
@ CONSOLE_MSGTYPE_INFO
Generic message.
@ CONSOLE_MSGTYPE_TERRN
Parsing/spawn/simulation messages for terrain.
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
CVar * cVarFind(std::string const &input_name)
Find cvar by short/long name.
@ CONSOLE_SYSTEM_REPLY
Success.
CVar * cVarGet(std::string const &input_name, int flags)
Get cvar by short/long name, or create new one using input as short name.
Character * GetPlayerCharacter()
const ActorPtr & GetPlayerActor()
const TerrainPtr & GetTerrain()
void PushMessage(Message m)
Doesn't guarantee order! Use ChainMessage() if order matters.
void BroadcastChatMsg(const char *msg)
ScriptUnitID_t loadScript(Ogre::String filename, ScriptCategory category=ScriptCategory::TERRAIN, ActorPtr associatedActor=nullptr, std::string buffer="")
Loads a script.
ScriptRetCode_t executeString(Ogre::String command)
executes a string (useful for the console)
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.
float GetSpeedOfSound() const
SoundManager * getSoundManager()
Wrapper for classic c-string (local buffer) Refresher: strlen() excludes '\0' terminator; strncat() A...
const char * ToCStr() const
void setGravity(float value)
float getWaterHeight() const
float getHeightAt(float x, float z)
float GetStaticWaterHeight()
Returns static water level configured in 'terrn2'.
void Run(Ogre::StringVector const &args) override
SetCVarCmd(std::string const &name, std::string const &usage, std::string const &doc, int flag)
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void Run(Ogre::StringVector const &args) override
void regBuiltinCommands()
Register builtin commands.
void doCommand(std::string msg)
Identify and execute any console line.
bool CheckAppState(AppState state)
@ CVAR_ARCHIVE
Will be written to RoR.cfg.
@ CVAR_NO_LOG
Will not be written to RoR.log.
@ MSG_APP_SHUTDOWN_REQUESTED
static const float DEFAULT_GRAVITY
earth gravity
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(),...
SoundScriptManager * GetSoundScriptManager()
GameContext * GetGameContext()
ScriptEngine * GetScriptEngine()
CVar * diag_log_console_echo
@ ASMANIP_CONSOLE_SNIPPET_EXECUTED
int ScriptUnitID_t
Unique sequentially generated ID of a loaded and running scriptin session. Use ScriptEngine::getScrip...
static const ScriptUnitID_t SCRIPTUNITID_INVALID
@ SE_ANGELSCRIPT_MANIPULATIONS
triggered when the user tries to dynamically use the scripting capabilities (prevent cheating) args: ...
@ SE_TRUCK_TELEPORT
triggered when the user teleports the truck, the argument refers to the actor ID of the vehicle
std::vector< Message > & messages
Unified game event system - all requests and state changes are reported using a message.