diff --git a/modules/client/cl_focus.txt b/modules/client/cl_focus.txt new file mode 100644 index 0000000..b36c2dd --- /dev/null +++ b/modules/client/cl_focus.txt @@ -0,0 +1,9 @@ +--@name +--@author +--@client + +net.receive("LSFT-Get-Focused", function(data) + net.start("LSFT-Get-Focused-Resp") + net.writeBool(game.hasFocus()) + net.send() +end) diff --git a/modules/server/sv_focus.txt b/modules/server/sv_focus.txt new file mode 100644 index 0000000..cef7eef --- /dev/null +++ b/modules/server/sv_focus.txt @@ -0,0 +1,27 @@ +--@name +--@author +--@server + +do + function getFocused() + net.start("LSFT-Get-Focused") + net.send() + end + + net.receive("LSFT-Get-Focused-Resp", function(data, ply) + print(ply:getName(), net.readBool()) + end) + + core.modules.getfocus = { + version = 1, + desc = "Queries all players to see if their game is focused.", + commands = { + focus = { + func = getFocused, + usage = "focus", + desc = "Prints a list of what the current state of getFocused() is for each player on the server", + }, + }, + } +end +