Skip to content

Commit

Permalink
[MIRROR] [NO GBP] RCD & RTD ui updates when switching between root ca…
Browse files Browse the repository at this point in the history
…tegories [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 <[email protected]>
Co-authored-by: SyncIt21 <[email protected]>
  • Loading branch information
3 people authored Oct 20, 2023
1 parent 542a6de commit 46e0508
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion code/game/objects/items/rcd/RCD.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -318,7 +319,6 @@
var/list/data = ..()

//main categories
data["selected_root"] = root_category
data["selected_category"] = design_category
data["selected_design"] = design_title

Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion code/game/objects/items/rcd/RTD.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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"])
Expand Down

0 comments on commit 46e0508

Please sign in to comment.