Add eval command, calls LUA_EvalMath

This commit is contained in:
James R 2023-03-02 22:56:32 -08:00
parent a2493bb9db
commit ceab0399de

View file

@ -226,6 +226,8 @@ static void Command_Schedule_List(void);
static void Command_Automate_Set(void);
static void Command_Eval(void);
// =========================================================================
// CLIENT VARIABLES
// =========================================================================
@ -745,6 +747,8 @@ void D_RegisterServerCommands(void)
COM_AddCommand("automate_set", Command_Automate_Set);
COM_AddCommand("eval", Command_Eval);
// for master server connection
AddMServCommands();
@ -6128,6 +6132,18 @@ static void Command_Automate_Set(void)
SendNetXCmd(XD_AUTOMATE, buf, buf_p - buf);
}
static void Command_Eval(void)
{
const char *args = COM_Args();
if (args)
{
const fixed_t n = LUA_EvalMath(args);
CONS_Printf("%f (%d)\n", FixedToFloat(n), n);
}
}
/** Makes a change to ::cv_forceskin take effect immediately.
*
* \sa Command_SetForcedSkin_f, cv_forceskin, forcedskin