From 46e05082f38de3accfac54dafbd2b05aaff82f19 Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+AnArgonianLizardThatStealsPRs@users.noreply.github.com> Date: Fri, 20 Oct 2023 20:59:49 +0300 Subject: [PATCH] [MIRROR] [NO GBP] RCD & RTD ui updates when switching between root categories [MDB IGNORE] (#24466) (#180) * [NO GBP] RCD & RTD ui updates when switching between root categories (#79021) ## About The Pull Request When switching between "Construction" & "Airlocks" tab the UI would not update unless you closed & reopened the UI. This was annoying so I fixed it & now the UI updates properly. Same applies for RTD when switching between floor types ## Changelog :cl: fix: RCD & RTD ui updates when switching between root categories /:cl: * [NO GBP] RCD & RTD ui updates when switching between root categories --------- Co-authored-by: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> --- code/game/objects/items/rcd/RCD.dm | 3 ++- code/game/objects/items/rcd/RTD.dm | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/rcd/RCD.dm b/code/game/objects/items/rcd/RCD.dm index e2a391a2278..297c8a1eabd 100644 --- a/code/game/objects/items/rcd/RCD.dm +++ b/code/game/objects/items/rcd/RCD.dm @@ -290,6 +290,7 @@ data["root_categories"] = list() for(var/category in GLOB.rcd_designs) data["root_categories"] += category + data["selected_root"] = root_category data["categories"] = list() for(var/sub_category as anything in GLOB.rcd_designs[root_category]) @@ -318,7 +319,6 @@ var/list/data = ..() //main categories - data["selected_root"] = root_category data["selected_category"] = design_category data["selected_design"] = design_title @@ -336,6 +336,7 @@ var/new_root = params["root_category"] if(GLOB.rcd_designs[new_root] != null) //is a valid category root_category = new_root + update_static_data_for_all_viewers() if("design") //read and validate params from UI diff --git a/code/game/objects/items/rcd/RTD.dm b/code/game/objects/items/rcd/RTD.dm index 69000054f86..e38b283631f 100644 --- a/code/game/objects/items/rcd/RTD.dm +++ b/code/game/objects/items/rcd/RTD.dm @@ -171,6 +171,7 @@ data["root_categories"] = list() for(var/category in GLOB.floor_designs) data["root_categories"] += category + data["selected_root"] = root_category data["categories"] = list() for(var/sub_category as anything in GLOB.floor_designs[root_category]) @@ -188,19 +189,20 @@ /obj/item/construction/rtd/ui_data(mob/user) var/list/data = ..() - data["selected_root"] = root_category data["selected_category"] = design_category selected_design.fill_ui_data(data) return data /obj/item/construction/rtd/handle_ui_act(action, params, datum/tgui/ui, datum/ui_state/state) + var/floor_designs = GLOB.floor_designs switch(action) if("root_category") var/new_root = params["root_category"] if(floor_designs[new_root] != null) //is a valid category root_category = new_root + update_static_data_for_all_viewers() if("set_dir") var/direction = text2dir(params["dir"])