Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Nitpicks #2741

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
3 changes: 3 additions & 0 deletions code/_compile_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
68 changes: 68 additions & 0 deletions code/modules/admin/verbs/macro_debug.dm
Original file line number Diff line number Diff line change
@@ -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)
22 changes: 15 additions & 7 deletions code/modules/keybindings/setup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
francinum marked this conversation as resolved.
Show resolved Hide resolved

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\\\"\""
Expand All @@ -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 disable input relay.
// This *does* silently break TGUI-Say, but I doubt players who want to use this mode care. -Francinum
if(!using_chat_relay)
francinum marked this conversation as resolved.
Show resolved Hide resolved
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")
Expand Down
4 changes: 4 additions & 0 deletions nsv13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading