diff --git a/.vscode/launch.json b/.vscode/launch.json index 543058728f5..fbb8bce4ad6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,12 +1,21 @@ { "version": "0.2.0", "configurations": [ + { "type": "byond", "request": "launch", "name": "Launch DreamSeeker", "preLaunchTask": "Build All", "dmb": "${workspaceFolder}/${command:CurrentDMB}" - } + }, + { + "type": "byond", + "request": "launch", + "name": "Launch DreamDaemon", + "preLaunchTask": "Build All", + "dmb": "${workspaceFolder}/${command:CurrentDMB}", + "dreamDaemon": true + } ] } diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 9c22eb59a6e..b619dd1181e 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -31,6 +31,9 @@ //#define VISUALIZE_ACTIVE_TURFS //Highlights atmos active turfs in green #endif //ifdef TESTING +// Enables a few verbs to help track down skin-related issues. Not production safe. +//#define MACROTEST + /// If this is uncommented, will profile mapload atom initializations // #define PROFILE_MAPLOAD_INIT_ATOM diff --git a/code/modules/admin/verbs/macro_debug.dm b/code/modules/admin/verbs/macro_debug.dm new file mode 100644 index 00000000000..63e5ef841d7 --- /dev/null +++ b/code/modules/admin/verbs/macro_debug.dm @@ -0,0 +1,68 @@ +//This file depends on #define MACROTEST. Otherwise it is not included. + +#warn !!UNSAFE!!: MacroTest Verbs Enabled, Do Not Merge. +/client + var/x_mt_watchingfocus = FALSE + var/x_mt_winmon_enabled = FALSE + var/list/x_mt_winmon_packet //Lazylist + +/// Dumps the list of all macros. This should almost always be just default +/client/verb/dump_macroset_ids() + set name = "mt Dump Macroset IDs" + set category = "_MACRO_TEST" + to_chat(usr, (winget(src, "", "macros") || "NULL (Bad. Incredibly. Incredibly bad.)")) + return + +/// List all children of default. Name for macros is their bound key. +/client/verb/dump_set() + set name = "mt Dump bindings" + set category = "_MACRO_TEST" + to_chat(usr, (winget(src, "default.*" , "name")|| "NULL (Bad. Real bad.)")) + +/// A slightly more pleasant way to execute free wingets. +/client/verb/arbitrary_winget(cmd as text) + set name = "awing" + set desc = "Run an arbitrary Winset call, Space-separated arguments." + set category = "_MACRO_TEST" + var/list/parts = splittext(cmd, " ") + to_chat(usr, (winget(src, parts[1], parts[2]) || "NULL (Bad Call?)")) + +/// A slightly more pleasant way to execute free winsets. +/client/verb/arbitrary_winset(cmd as text) + set name = "aswin" + set desc = "Run an arbitrary Winset call, Space-separated arguments." + set category = "_MACRO_TEST" + var/list/parts = splittext(cmd, " ") + winset(src, parts[1], parts[2]) + to_chat(usr, ("CALLED: winset({client:[src.ckey]}, \"[parts[1]]\",\"[parts[2]]\")")) + +/// Will dump the currently focused skin element to chat. Used for tracking down focus juggling issues. +/client/verb/focuswatch() + set name = "mt toggle focus watch" + set category = "_MACRO_TEST" + if(x_mt_watchingfocus) + x_mt_watchingfocus = FALSE + return + else + x_mt_watchingfocus = TRUE + while(x_mt_watchingfocus) + // Live-report the element with focus. + to_chat(usr, (winget(src, "", "focus") || "NULL (Entire game defocused?)")) + sleep(0.5 SECONDS) //Every half second + +/client/verb/winmon(cmd as text|null) + set name = "winmon" + set desc = "Repeatedly run a winget to monitor it's value" + set category = "_MACRO_TEST" + if(x_mt_winmon_enabled || isnull(cmd)) + x_mt_winmon_enabled = FALSE + return + else + x_mt_winmon_enabled = TRUE + var/list/parts = splittext(cmd, " ") + x_mt_winmon_packet = parts + while(x_mt_winmon_enabled) + // Repeatedly rerun the same winget to watch the value + var/winout = winget(src, x_mt_winmon_packet[1], x_mt_winmon_packet[2]) + to_chat(usr, ( winout ? "WINMON:[winout]": "WINMON: NULL (Bad Call?)")) + sleep(0.5 SECONDS) diff --git a/code/modules/keybindings/setup.dm b/code/modules/keybindings/setup.dm index 7051bf33533..5190bf82be3 100644 --- a/code/modules/keybindings/setup.dm +++ b/code/modules/keybindings/setup.dm @@ -36,6 +36,11 @@ erase_all_macros() + /// Is this client using Chat Relay/Legacy input mode. If so, + /// we need to be **VERY CAREFUL** about what keys we bind, + /// and we can't bind anything printable. -Francinum + var/using_chat_relay = !(prefs.toggles2 & PREFTOGGLE_2_HOTKEYS) + var/list/macro_sets = SSinput.macro_sets var/use_tgui_say = !prefs || (prefs.toggles2 & PREFTOGGLE_2_TGUI_SAY) var/say = use_tgui_say ? tgui_say_create_open_command(SAY_CHANNEL) : "\".winset \\\"command=\\\".start_typing say\\\";command=.init_say;saywindow.is-visible=true;saywindow.input.focus=true\\\"\"" @@ -52,13 +57,16 @@ var/key = macro_set[k] var/command = macro_set[key] winset(src, "[setname]-[REF(key)]", "parent=[setname];name=[key];command=[command]") - winset(src, "[setname]-say", "parent=[setname];name=T;command=[say]") - winset(src, "[setname]-me", "parent=[setname];name=M;command=[me]") - winset(src, "[setname]-ooc", "parent=[setname];name=O;command=[ooc]") - if(use_tgui_say) - winset(src, "[setname]-radio", "parent=[setname];name=Y;command=[radio]") - winset(src, "[setname]-looc", "parent=[setname];name=L;command=[looc]") // NSV13 - Moves LOOC keybind to L from U - winset(src, "[setname]-close-tgui-say", "parent=[setname];name=Escape;command=[tgui_say_create_close_command()]") + // If we bind these, we're going to break the default command bar input relay behaviour. + // This *does* mean we outright ignore the tgui-say pref, but I doubt players who want to use this mode care. -Francinum + if(!using_chat_relay) + winset(src, "[setname]-say", "parent=[setname];name=T;command=[say]") + winset(src, "[setname]-me", "parent=[setname];name=M;command=[me]") + winset(src, "[setname]-ooc", "parent=[setname];name=O;command=[ooc]") + if(use_tgui_say) + winset(src, "[setname]-radio", "parent=[setname];name=Y;command=[radio]") + winset(src, "[setname]-looc", "parent=[setname];name=L;command=[looc]") // NSV13 - Moves LOOC keybind to L from U + winset(src, "[setname]-close-tgui-say", "parent=[setname];name=Escape;command=[tgui_say_create_close_command()]") if(prefs.toggles2 & PREFTOGGLE_2_HOTKEYS) winset(src, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED] mainwindow.macro=default") diff --git a/nsv13.dme b/nsv13.dme index 0a08be885d3..1c51f7e70b8 100644 --- a/nsv13.dme +++ b/nsv13.dme @@ -4127,3 +4127,7 @@ #ifdef DONATOR_ITEMS #include "nsv13\code\modules\donator\donator.dm" #endif + +#ifdef MACROTEST +#include "code\modules\admin\verbs\macro_debug.dm" +#endif