mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
[MIRROR] Nullchecks Client on tgui_alert() and siblings [MDB IGNORE] (#24703)
* Nullchecks Client on `tgui_alert()` and siblings (#79322) ## About The Pull Request Fixes #79321 ```dm /datum/tgui/proc/open() if(!user.client) return FALSE ``` The TGUI window won't even `open()` and do any work if we don't have a client, so let's just explicitly get the hell out of dodge if we don't have a client associated with a mob in these procs. Adding a `?` to handle the runtime in the linked issue only obfuscates the deeper issue because of the aforementioned code snippet. ## Why It's Good For The Game Clientless monkeys will still somehow be able to interact with stuff through their random behavior, and this is still plausible enough to show up on live servers every so often, so let's just patch it out early. These alerts are meant for player user input, so if we don't have a player, let's bounce. ## Changelog A player would never ever notice this. * Nullchecks Client on `tgui_alert()` and siblings --------- Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
@@ -18,7 +18,11 @@
|
||||
var/client/client = user
|
||||
user = client.mob
|
||||
else
|
||||
return
|
||||
return null
|
||||
|
||||
if(isnull(user.client))
|
||||
return null
|
||||
|
||||
// A gentle nudge - you should not be using TGUI alert for anything other than a simple message.
|
||||
if(length(buttons) > 3)
|
||||
log_tgui(user, "Error: TGUI Alert initiated with too many buttons. Use a list.", "TguiAlert")
|
||||
|
||||
@@ -14,13 +14,17 @@
|
||||
if (!user)
|
||||
user = usr
|
||||
if(!length(items))
|
||||
return
|
||||
return null
|
||||
if (!istype(user))
|
||||
if (istype(user, /client))
|
||||
var/client/client = user
|
||||
user = client.mob
|
||||
else
|
||||
return
|
||||
return null
|
||||
|
||||
if(isnull(user.client))
|
||||
return null
|
||||
|
||||
if(!user.client.prefs.read_preference(/datum/preference/toggle/tgui_input))
|
||||
return input(user, message, title) as null|anything in items
|
||||
var/datum/tgui_checkbox_input/input = new(user, message, title, items, min_checked, max_checked, timeout, ui_state)
|
||||
|
||||
@@ -14,13 +14,17 @@
|
||||
if (!user)
|
||||
user = usr
|
||||
if(!length(items))
|
||||
return
|
||||
return null
|
||||
if (!istype(user))
|
||||
if (istype(user, /client))
|
||||
var/client/client = user
|
||||
user = client.mob
|
||||
else
|
||||
return
|
||||
return null
|
||||
|
||||
if(isnull(user.client))
|
||||
return null
|
||||
|
||||
/// Client does NOT have tgui_input on: Returns regular input
|
||||
if(!user.client.prefs.read_preference(/datum/preference/toggle/tgui_input))
|
||||
return input(user, message, title, default) as null|anything in items
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
var/client/client = user
|
||||
user = client.mob
|
||||
else
|
||||
return
|
||||
return null
|
||||
|
||||
if (isnull(user.client))
|
||||
return null
|
||||
|
||||
// Client does NOT have tgui_input on: Returns regular input
|
||||
if(!user.client.prefs.read_preference(/datum/preference/toggle/tgui_input))
|
||||
var/input_number = input(user, message, title, default) as null|num
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
var/client/client = user
|
||||
user = client.mob
|
||||
else
|
||||
return
|
||||
return null
|
||||
|
||||
if(isnull(user.client))
|
||||
return null
|
||||
|
||||
// Client does NOT have tgui_input on: Returns regular input
|
||||
if(!user.client.prefs.read_preference(/datum/preference/toggle/tgui_input))
|
||||
if(encode)
|
||||
|
||||
Reference in New Issue
Block a user