From ed6780159053450cbc1b51c82cf1ba8f8bc51da4 Mon Sep 17 00:00:00 2001 From: Letter N <24603524+LetterN@users.noreply.github.com> Date: Wed, 5 Aug 2020 09:21:19 +0800 Subject: [PATCH] what if the tgui actualy recives it's topic? --- code/__HELPERS/_logging.dm | 15 ++++++++++++--- code/game/objects/items/implants/implant_radio.dm | 2 +- .../clockcult/clock_items/clockwork_slab.dm | 8 +++----- code/modules/client/client_procs.dm | 5 +++++ code/modules/tgui/tgui.dm | 6 +++--- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index 733cbcfd8d..62e6c4daf9 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -201,9 +201,18 @@ WRITE_LOG(log, "Starting up round ID [GLOB.round_id].\n-------------------------") /* ui logging */ - -/proc/log_tgui(text) - WRITE_LOG(GLOB.tgui_log, text) +/proc/log_tgui(user_or_client, text) + var/entry = "" + if(!user_or_client) + entry += "no user" + else if(istype(user_or_client, /mob)) + var/mob/user = user_or_client + entry += "[user.ckey] (as [user])" + else if(istype(user_or_client, /client)) + var/client/client = user_or_client + entry += "[client.ckey]" + entry += ":\n[text]" + WRITE_LOG(GLOB.tgui_log, entry) /* Close open log handles. This should be called as late as possible, and no logging should hapen after. */ /proc/shutdown_logging() diff --git a/code/game/objects/items/implants/implant_radio.dm b/code/game/objects/items/implants/implant_radio.dm index 5d3d579a4e..6f42547004 100644 --- a/code/game/objects/items/implants/implant_radio.dm +++ b/code/game/objects/items/implants/implant_radio.dm @@ -10,7 +10,7 @@ /obj/item/implant/radio/activate() . = ..() // needs to be GLOB.deep_inventory_state otherwise it won't open - radio.ui_interact(usr, "main", null, FALSE, null, GLOB.deep_inventory_state) + radio.ui_interact(usr, state = GLOB.deep_inventory_state) /obj/item/implant/radio/implant(mob/living/target, mob/user, silent = FALSE) . = ..() diff --git a/code/modules/antagonists/clockcult/clock_items/clockwork_slab.dm b/code/modules/antagonists/clockcult/clock_items/clockwork_slab.dm index dd31542785..c6a03b0cd2 100644 --- a/code/modules/antagonists/clockcult/clock_items/clockwork_slab.dm +++ b/code/modules/antagonists/clockcult/clock_items/clockwork_slab.dm @@ -255,10 +255,8 @@ else return null //error text handled tgui side. should not cause BSOD -/obj/item/clockwork/slab/ui_state(mob/user) - return GLOB.hands_state - /obj/item/clockwork/slab/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "ClockworkSlab", name) ui.open() @@ -330,8 +328,6 @@ "requirement" = "Unlock powerful equipment and structures by converting five servants or if [DisplayPower(JUDGEMENT_UNLOCK_THRESHOLD)] of power is reached..", "ready" = SSticker.scripture_states[SCRIPTURE_JUDGEMENT] ) - - generate_all_scripture() .["recollection_categories"] = list() if(GLOB.ratvar_awakens) return @@ -345,6 +341,8 @@ list("name" = "Conversion", "desc" = "Converting the crew, cyborgs, and very walls to your cause.") ) .["rec_section"] = get_recollection(recollection_category) + generate_all_scripture() + //needs a new place to live, preferably when clockcult unlocks/downgrades a tier. Smart enough to earlyreturn. /obj/item/clockwork/slab/ui_act(action, params) switch(action) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 5c9b1eec2e..9b7e928852 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -41,6 +41,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( if(!asset_cache_job) return + // Rate limiting var/mtl = CONFIG_GET(number/minute_topic_limit) if (!holder && mtl) var/minute = round(world.time, 600) @@ -98,6 +99,10 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( keyUp(keycode) return + // Tgui Topic middleware + if(!tgui_Topic(href_list)) + return + // Admin PM if(href_list["priv_msg"]) cmd_admin_pm(href_list["priv_msg"],null) diff --git a/code/modules/tgui/tgui.dm b/code/modules/tgui/tgui.dm index 5eacfd07fe..d0d5ff8ebb 100644 --- a/code/modules/tgui/tgui.dm +++ b/code/modules/tgui/tgui.dm @@ -199,13 +199,13 @@ "key" = window_key, "size" = window_size, "fancy" = user.client.prefs.tgui_fancy, - "locked" = user.client.prefs.tgui_lock, + "locked" = user.client.prefs.tgui_lock ), "user" = list( "name" = "[user]", "ckey" = "[user.ckey]", - "observer" = isobserver(user), - ), + "observer" = isobserver(user) + ) ) var/data = custom_data || with_data && src_object.ui_data(user) if(data)