From 07e4497320512d0fd6c14f32c2e04b0405bb0487 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 15 Mar 2023 17:21:13 -0700 Subject: [PATCH] Add COM_LUA to a bunch of commands These commands be run from Lua: - add - addfile - addfolder - archivetest - ban - banip - causecfail - cecho - cechoduration - cechoflags - changeteam - changeteam2 - charability - charspeed - cheats - clearbans - clearscores - connect - countmobjs - csay - demote - devmode - displayplayer - downloads - drop - droprate - dumplua - echo - exitgame - exitlevel - gametype - getallemeralds - getplayernum - god - gravflip - help - hurtme - isgamemodified - jumptoaxis - kick - listwad - login - manual - map - mapmd5 - masterserver_update - memdump - memfree - mod_details - motd - noclip - nodes - notarget - numnodes - numthinkers - objectplace - password - pause - ping - playintro - promote - quit - reloadbans - resendgamestate - resetcamera - resetemeralds - restartaudio - retry - rteleport - runsoc - savecheckpoint - say - sayteam - sayto - scale - screenshot - serverchangeteam - setcontinues - setlives - setrings - showbanlist - showmap - showscores - showtime - skynum - startmovie - stopdemo - stopmovie - suicide - teleport - toggle - togglemodified - toggletwod - tunes - version - vid_info - vid_modelist - vid_nummodes - weather --- src/command.c | 14 ++--- src/d_clisrv.c | 26 ++++----- src/d_netcmd.c | 132 +++++++++++++++++++++++----------------------- src/hu_stuff.c | 8 +-- src/m_menu.c | 2 +- src/mserv.c | 2 +- src/s_sound.c | 4 +- src/sdl/i_video.c | 6 +-- src/z_zone.c | 4 +- 9 files changed, 99 insertions(+), 99 deletions(-) diff --git a/src/command.c b/src/command.c index c2926c473..bef6e2cdd 100644 --- a/src/command.c +++ b/src/command.c @@ -334,15 +334,15 @@ void COM_Init(void) // add standard commands COM_AddCommand("alias", COM_Alias_f, 0); - COM_AddCommand("echo", COM_Echo_f, 0); - COM_AddCommand("cecho", COM_CEcho_f, 0); - COM_AddCommand("cechoflags", COM_CEchoFlags_f, 0); - COM_AddCommand("cechoduration", COM_CEchoDuration_f, 0); + COM_AddCommand("echo", COM_Echo_f, COM_LUA); + COM_AddCommand("cecho", COM_CEcho_f, COM_LUA); + COM_AddCommand("cechoflags", COM_CEchoFlags_f, COM_LUA); + COM_AddCommand("cechoduration", COM_CEchoDuration_f, COM_LUA); COM_AddCommand("exec", COM_Exec_f, 0); COM_AddCommand("wait", COM_Wait_f, 0); - COM_AddCommand("help", COM_Help_f, 0); - COM_AddCommand("toggle", COM_Toggle_f, 0); - COM_AddCommand("add", COM_Add_f, 0); + COM_AddCommand("help", COM_Help_f, COM_LUA); + COM_AddCommand("toggle", COM_Toggle_f, COM_LUA); + COM_AddCommand("add", COM_Add_f, COM_LUA); RegisterNetXCmd(XD_NETVAR, Got_NetVar); } diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 232b41bd0..9740c7f22 100755 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3537,22 +3537,22 @@ void D_ClientServerInit(void) VERSION/100, VERSION%100, SUBVERSION)); #ifndef NONET - COM_AddCommand("getplayernum", Command_GetPlayerNum, 0); - COM_AddCommand("kick", Command_Kick, 0); - COM_AddCommand("ban", Command_Ban, 0); - COM_AddCommand("banip", Command_BanIP, 0); - COM_AddCommand("clearbans", Command_ClearBans, 0); - COM_AddCommand("showbanlist", Command_ShowBan, 0); - COM_AddCommand("reloadbans", Command_ReloadBan, 0); - COM_AddCommand("connect", Command_connect, 0); - COM_AddCommand("nodes", Command_Nodes, 0); - COM_AddCommand("resendgamestate", Command_ResendGamestate, 0); + COM_AddCommand("getplayernum", Command_GetPlayerNum, COM_LUA); + COM_AddCommand("kick", Command_Kick, COM_LUA); + COM_AddCommand("ban", Command_Ban, COM_LUA); + COM_AddCommand("banip", Command_BanIP, COM_LUA); + COM_AddCommand("clearbans", Command_ClearBans, COM_LUA); + COM_AddCommand("showbanlist", Command_ShowBan, COM_LUA); + COM_AddCommand("reloadbans", Command_ReloadBan, COM_LUA); + COM_AddCommand("connect", Command_connect, COM_LUA); + COM_AddCommand("nodes", Command_Nodes, COM_LUA); + COM_AddCommand("resendgamestate", Command_ResendGamestate, COM_LUA); #ifdef PACKETDROP - COM_AddCommand("drop", Command_Drop, 0); - COM_AddCommand("droprate", Command_Droprate, 0); + COM_AddCommand("drop", Command_Drop, COM_LUA); + COM_AddCommand("droprate", Command_Droprate, COM_LUA); #endif #ifdef _DEBUG - COM_AddCommand("numnodes", Command_Numnodes, 0); + COM_AddCommand("numnodes", Command_Numnodes, COM_LUA); #endif #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ef00ec431..676b6e7a0 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -464,57 +464,57 @@ void D_RegisterServerCommands(void) RegisterNetXCmd(XD_LUAFILE, Got_LuaFile); // Remote Administration - COM_AddCommand("password", Command_Changepassword_f, 0); - COM_AddCommand("login", Command_Login_f, 0); // useful in dedicated to kick off remote admin - COM_AddCommand("promote", Command_Verify_f, 0); + COM_AddCommand("password", Command_Changepassword_f, COM_LUA); + COM_AddCommand("login", Command_Login_f, COM_LUA); // useful in dedicated to kick off remote admin + COM_AddCommand("promote", Command_Verify_f, COM_LUA); RegisterNetXCmd(XD_VERIFIED, Got_Verification); - COM_AddCommand("demote", Command_RemoveAdmin_f, 0); + COM_AddCommand("demote", Command_RemoveAdmin_f, COM_LUA); RegisterNetXCmd(XD_DEMOTED, Got_Removal); - COM_AddCommand("motd", Command_MotD_f, 0); + COM_AddCommand("motd", Command_MotD_f, COM_LUA); RegisterNetXCmd(XD_SETMOTD, Got_MotD_f); // For remote admin RegisterNetXCmd(XD_TEAMCHANGE, Got_Teamchange); - COM_AddCommand("serverchangeteam", Command_ServerTeamChange_f, 0); + COM_AddCommand("serverchangeteam", Command_ServerTeamChange_f, COM_LUA); RegisterNetXCmd(XD_CLEARSCORES, Got_Clearscores); - COM_AddCommand("clearscores", Command_Clearscores_f, 0); - COM_AddCommand("map", Command_Map_f, 0); + COM_AddCommand("clearscores", Command_Clearscores_f, COM_LUA); + COM_AddCommand("map", Command_Map_f, COM_LUA); - COM_AddCommand("exitgame", Command_ExitGame_f, 0); - COM_AddCommand("retry", Command_Retry_f, 0); - COM_AddCommand("exitlevel", Command_ExitLevel_f, 0); - COM_AddCommand("showmap", Command_Showmap_f, 0); - COM_AddCommand("mapmd5", Command_Mapmd5_f, 0); + COM_AddCommand("exitgame", Command_ExitGame_f, COM_LUA); + COM_AddCommand("retry", Command_Retry_f, COM_LUA); + COM_AddCommand("exitlevel", Command_ExitLevel_f, COM_LUA); + COM_AddCommand("showmap", Command_Showmap_f, COM_LUA); + COM_AddCommand("mapmd5", Command_Mapmd5_f, COM_LUA); - COM_AddCommand("addfolder", Command_Addfolder, 0); - COM_AddCommand("addfile", Command_Addfile, 0); - COM_AddCommand("listwad", Command_ListWADS_f, 0); + COM_AddCommand("addfolder", Command_Addfolder, COM_LUA); + COM_AddCommand("addfile", Command_Addfile, COM_LUA); + COM_AddCommand("listwad", Command_ListWADS_f, COM_LUA); - COM_AddCommand("runsoc", Command_RunSOC, 0); - COM_AddCommand("pause", Command_Pause, 0); - COM_AddCommand("suicide", Command_Suicide, 0); + COM_AddCommand("runsoc", Command_RunSOC, COM_LUA); + COM_AddCommand("pause", Command_Pause, COM_LUA); + COM_AddCommand("suicide", Command_Suicide, COM_LUA); - COM_AddCommand("gametype", Command_ShowGametype_f, 0); - COM_AddCommand("version", Command_Version_f, 0); + COM_AddCommand("gametype", Command_ShowGametype_f, COM_LUA); + COM_AddCommand("version", Command_Version_f, COM_LUA); #ifdef UPDATE_ALERT - COM_AddCommand("mod_details", Command_ModDetails_f, 0); + COM_AddCommand("mod_details", Command_ModDetails_f, COM_LUA); #endif - COM_AddCommand("quit", Command_Quit_f, 0); + COM_AddCommand("quit", Command_Quit_f, COM_LUA); COM_AddCommand("saveconfig", Command_SaveConfig_f, 0); COM_AddCommand("loadconfig", Command_LoadConfig_f, 0); COM_AddCommand("changeconfig", Command_ChangeConfig_f, 0); - COM_AddCommand("isgamemodified", Command_Isgamemodified_f, 0); // test - COM_AddCommand("showscores", Command_ShowScores_f, 0); - COM_AddCommand("showtime", Command_ShowTime_f, 0); - COM_AddCommand("cheats", Command_Cheats_f, 0); // test + COM_AddCommand("isgamemodified", Command_Isgamemodified_f, COM_LUA); // test + COM_AddCommand("showscores", Command_ShowScores_f, COM_LUA); + COM_AddCommand("showtime", Command_ShowTime_f, COM_LUA); + COM_AddCommand("cheats", Command_Cheats_f, COM_LUA); // test #ifdef _DEBUG - COM_AddCommand("togglemodified", Command_Togglemodified_f, 0); - COM_AddCommand("archivetest", Command_Archivetest_f, 0); + COM_AddCommand("togglemodified", Command_Togglemodified_f, COM_LUA); + COM_AddCommand("archivetest", Command_Archivetest_f, COM_LUA); #endif - COM_AddCommand("downloads", Command_Downloads_f, 0); + COM_AddCommand("downloads", Command_Downloads_f, COM_LUA); // for master server connection AddMServCommands(); @@ -601,7 +601,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_blamecfail); #endif - COM_AddCommand("ping", Command_Ping_f, 0); + COM_AddCommand("ping", Command_Ping_f, COM_LUA); CV_RegisterVar(&cv_nettimeout); CV_RegisterVar(&cv_jointimeout); @@ -645,25 +645,25 @@ void D_RegisterClientCommands(void) if (dedicated) return; - COM_AddCommand("numthinkers", Command_Numthinkers_f, 0); - COM_AddCommand("countmobjs", Command_CountMobjs_f, 0); + COM_AddCommand("numthinkers", Command_Numthinkers_f, COM_LUA); + COM_AddCommand("countmobjs", Command_CountMobjs_f, COM_LUA); - COM_AddCommand("changeteam", Command_Teamchange_f, 0); - COM_AddCommand("changeteam2", Command_Teamchange2_f, 0); + COM_AddCommand("changeteam", Command_Teamchange_f, COM_LUA); + COM_AddCommand("changeteam2", Command_Teamchange2_f, COM_LUA); COM_AddCommand("playdemo", Command_Playdemo_f, 0); COM_AddCommand("timedemo", Command_Timedemo_f, 0); - COM_AddCommand("stopdemo", Command_Stopdemo_f, 0); - COM_AddCommand("playintro", Command_Playintro_f, 0); + COM_AddCommand("stopdemo", Command_Stopdemo_f, COM_LUA); + COM_AddCommand("playintro", Command_Playintro_f, COM_LUA); - COM_AddCommand("resetcamera", Command_ResetCamera_f, 0); + COM_AddCommand("resetcamera", Command_ResetCamera_f, COM_LUA); COM_AddCommand("setcontrol", Command_Setcontrol_f, 0); COM_AddCommand("setcontrol2", Command_Setcontrol2_f, 0); - COM_AddCommand("screenshot", M_ScreenShot, 0); - COM_AddCommand("startmovie", Command_StartMovie_f, 0); - COM_AddCommand("stopmovie", Command_StopMovie_f, 0); + COM_AddCommand("screenshot", M_ScreenShot, COM_LUA); + COM_AddCommand("startmovie", Command_StartMovie_f, COM_LUA); + COM_AddCommand("stopmovie", Command_StopMovie_f, COM_LUA); CV_RegisterVar(&cv_screenshot_option); CV_RegisterVar(&cv_screenshot_folder); @@ -725,7 +725,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_ghost_last); CV_RegisterVar(&cv_ghost_guest); - COM_AddCommand("displayplayer", Command_Displayplayer_f, 0); + COM_AddCommand("displayplayer", Command_Displayplayer_f, COM_LUA); // FIXME: not to be here.. but needs be done for config loading CV_RegisterVar(&cv_globalgamma); @@ -881,7 +881,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_ps_descriptor); // ingame object placing - COM_AddCommand("objectplace", Command_ObjectPlace_f, 0); + COM_AddCommand("objectplace", Command_ObjectPlace_f, COM_LUA); //COM_AddCommand("writethings", Command_Writethings_f); CV_RegisterVar(&cv_speed); CV_RegisterVar(&cv_opflags); @@ -893,32 +893,32 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_freedemocamera); // add cheat commands - COM_AddCommand("noclip", Command_CheatNoClip_f, 0); - COM_AddCommand("god", Command_CheatGod_f, 0); - COM_AddCommand("notarget", Command_CheatNoTarget_f, 0); - COM_AddCommand("getallemeralds", Command_Getallemeralds_f, 0); - COM_AddCommand("resetemeralds", Command_Resetemeralds_f, 0); - COM_AddCommand("setrings", Command_Setrings_f, 0); - COM_AddCommand("setlives", Command_Setlives_f, 0); - COM_AddCommand("setcontinues", Command_Setcontinues_f, 0); - COM_AddCommand("devmode", Command_Devmode_f, 0); - COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f, 0); - COM_AddCommand("scale", Command_Scale_f, 0); - COM_AddCommand("gravflip", Command_Gravflip_f, 0); - COM_AddCommand("hurtme", Command_Hurtme_f, 0); - COM_AddCommand("jumptoaxis", Command_JumpToAxis_f, 0); - COM_AddCommand("charability", Command_Charability_f, 0); - COM_AddCommand("charspeed", Command_Charspeed_f, 0); - COM_AddCommand("teleport", Command_Teleport_f, 0); - COM_AddCommand("rteleport", Command_RTeleport_f, 0); - COM_AddCommand("skynum", Command_Skynum_f, 0); - COM_AddCommand("weather", Command_Weather_f, 0); - COM_AddCommand("toggletwod", Command_Toggletwod_f, 0); + COM_AddCommand("noclip", Command_CheatNoClip_f, COM_LUA); + COM_AddCommand("god", Command_CheatGod_f, COM_LUA); + COM_AddCommand("notarget", Command_CheatNoTarget_f, COM_LUA); + COM_AddCommand("getallemeralds", Command_Getallemeralds_f, COM_LUA); + COM_AddCommand("resetemeralds", Command_Resetemeralds_f, COM_LUA); + COM_AddCommand("setrings", Command_Setrings_f, COM_LUA); + COM_AddCommand("setlives", Command_Setlives_f, COM_LUA); + COM_AddCommand("setcontinues", Command_Setcontinues_f, COM_LUA); + COM_AddCommand("devmode", Command_Devmode_f, COM_LUA); + COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f, COM_LUA); + COM_AddCommand("scale", Command_Scale_f, COM_LUA); + COM_AddCommand("gravflip", Command_Gravflip_f, COM_LUA); + COM_AddCommand("hurtme", Command_Hurtme_f, COM_LUA); + COM_AddCommand("jumptoaxis", Command_JumpToAxis_f, COM_LUA); + COM_AddCommand("charability", Command_Charability_f, COM_LUA); + COM_AddCommand("charspeed", Command_Charspeed_f, COM_LUA); + COM_AddCommand("teleport", Command_Teleport_f, COM_LUA); + COM_AddCommand("rteleport", Command_RTeleport_f, COM_LUA); + COM_AddCommand("skynum", Command_Skynum_f, COM_LUA); + COM_AddCommand("weather", Command_Weather_f, COM_LUA); + COM_AddCommand("toggletwod", Command_Toggletwod_f, COM_LUA); #ifdef _DEBUG - COM_AddCommand("causecfail", Command_CauseCfail_f, 0); + COM_AddCommand("causecfail", Command_CauseCfail_f, COM_LUA); #endif #ifdef LUA_ALLOW_BYTECODE - COM_AddCommand("dumplua", Command_Dumplua_f, 0); + COM_AddCommand("dumplua", Command_Dumplua_f, COM_LUA); #endif } diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 2b1cbfcaf..9322770fa 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -328,10 +328,10 @@ void HU_LoadGraphics(void) void HU_Init(void) { #ifndef NONET - COM_AddCommand("say", Command_Say_f, 0); - COM_AddCommand("sayto", Command_Sayto_f, 0); - COM_AddCommand("sayteam", Command_Sayteam_f, 0); - COM_AddCommand("csay", Command_CSay_f, 0); + COM_AddCommand("say", Command_Say_f, COM_LUA); + COM_AddCommand("sayto", Command_Sayto_f, COM_LUA); + COM_AddCommand("sayteam", Command_Sayteam_f, COM_LUA); + COM_AddCommand("csay", Command_CSay_f, COM_LUA); RegisterNetXCmd(XD_SAY, Got_Saycmd); #endif diff --git a/src/m_menu.c b/src/m_menu.c index 9ca21841b..82d21bc55 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3909,7 +3909,7 @@ void M_Init(void) { int i; - COM_AddCommand("manual", Command_Manual_f, 0); + COM_AddCommand("manual", Command_Manual_f, COM_LUA); CV_RegisterVar(&cv_nextmap); CV_RegisterVar(&cv_newgametype); diff --git a/src/mserv.c b/src/mserv.c index 376774b23..64632016e 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -98,7 +98,7 @@ void AddMServCommands(void) CV_RegisterVar(&cv_servername); #ifdef MASTERSERVER COM_AddCommand("listserv", Command_Listserv_f, 0); - COM_AddCommand("masterserver_update", Update_parameters, 0); // allows people to updates manually in case you were delisted by accident + COM_AddCommand("masterserver_update", Update_parameters, COM_LUA); // allows people to updates manually in case you were delisted by accident #endif #endif } diff --git a/src/s_sound.c b/src/s_sound.c index c230ea3c4..c3e5626fa 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -289,8 +289,8 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_miditimiditypath); #endif - COM_AddCommand("tunes", Command_Tunes_f, 0); - COM_AddCommand("restartaudio", Command_RestartAudio_f, 0); + COM_AddCommand("tunes", Command_Tunes_f, COM_LUA); + COM_AddCommand("restartaudio", Command_RestartAudio_f, COM_LUA); } static void SetChannelsNum(void) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 2ad97108c..57c6e48e9 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1784,9 +1784,9 @@ void I_StartupGraphics(void) if (graphics_started) return; - COM_AddCommand ("vid_nummodes", VID_Command_NumModes_f, 0); - COM_AddCommand ("vid_info", VID_Command_Info_f, 0); - COM_AddCommand ("vid_modelist", VID_Command_ModeList_f, 0); + COM_AddCommand ("vid_nummodes", VID_Command_NumModes_f, COM_LUA); + COM_AddCommand ("vid_info", VID_Command_Info_f, COM_LUA); + COM_AddCommand ("vid_modelist", VID_Command_ModeList_f, COM_LUA); COM_AddCommand ("vid_mode", VID_Command_Mode_f, 0); CV_RegisterVar (&cv_vidwait); CV_RegisterVar (&cv_stretch); diff --git a/src/z_zone.c b/src/z_zone.c index d0722b84c..6ffe9aedd 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -116,10 +116,10 @@ void Z_Init(void) CONS_Printf("System memory: %uMB - Free: %uMB\n", total>>20, memfree); // Note: This allocates memory. Watch out. - COM_AddCommand("memfree", Command_Memfree_f, 0); + COM_AddCommand("memfree", Command_Memfree_f, COM_LUA); #ifdef ZDEBUG - COM_AddCommand("memdump", Command_Memdump_f, 0); + COM_AddCommand("memdump", Command_Memdump_f, COM_LUA); #endif }