From d80ea26df0c4e7b49b692124c5ba8eb2a939eb40 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 18 Jan 2022 18:42:55 +0300 Subject: [PATCH] Patch icon choosing in the chem dispenser and chem press (#64137) * patch style for chem master, chem press --- code/__DEFINES/reagents.dm | 5 +++++ code/modules/asset_cache/asset_list_items.dm | 9 ++++++++ code/modules/plumbing/plumbers/pill_press.dm | 18 +++++++++++++++ .../chemistry/machinery/chem_master.dm | 21 ++++++++++++++++++ icons/ui_icons/patches/bandaid.png | Bin 0 -> 182 bytes icons/ui_icons/patches/bandaid_both.png | Bin 0 -> 199 bytes icons/ui_icons/patches/bandaid_brute.png | Bin 0 -> 181 bytes icons/ui_icons/patches/bandaid_burn.png | Bin 0 -> 191 bytes tgui/packages/tgui/interfaces/ChemMaster.js | 16 +++++++++++++ tgui/packages/tgui/interfaces/ChemPress.js | 18 +++++++++++++++ 10 files changed, 87 insertions(+) create mode 100644 icons/ui_icons/patches/bandaid.png create mode 100644 icons/ui_icons/patches/bandaid_both.png create mode 100644 icons/ui_icons/patches/bandaid_brute.png create mode 100644 icons/ui_icons/patches/bandaid_burn.png diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index 79fe50e2da9..347fdf27b49 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -41,6 +41,11 @@ #define PILL_STYLE_COUNT 22 //Update this if you add more pill icons or you die #define RANDOM_PILL_STYLE 22 //Dont change this one though +//used by chem masters and pill presses +//update this if you add more patch icons +#define PATCH_STYLE_LIST list("bandaid", "bandaid_brute", "bandaid_burn", "bandaid_both") //icon_state list +#define DEFAULT_PATCH_STYLE "bandaid" + //used by chem master #define CONDIMASTER_STYLE_AUTO "auto" #define CONDIMASTER_STYLE_FALLBACK "_" diff --git a/code/modules/asset_cache/asset_list_items.dm b/code/modules/asset_cache/asset_list_items.dm index ed89f08798e..7b24cebfdff 100644 --- a/code/modules/asset_cache/asset_list_items.dm +++ b/code/modules/asset_cache/asset_list_items.dm @@ -237,6 +237,15 @@ "pill22" = 'icons/ui_icons/pills/pill22.png', ) +/datum/asset/spritesheet/simple/patches + name = "patches" + assets = list( + "bandaid" = 'icons/ui_icons/patches/bandaid.png', + "bandaid_brute" = 'icons/ui_icons/patches/bandaid_brute.png', + "bandaid_burn" = 'icons/ui_icons/patches/bandaid_burn.png', + "bandaid_both" = 'icons/ui_icons/patches/bandaid_both.png' + ) + /datum/asset/spritesheet/simple/condiments name = "condiments" assets = list( diff --git a/code/modules/plumbing/plumbers/pill_press.dm b/code/modules/plumbing/plumbers/pill_press.dm index 6f27d61e0c6..04ffa775373 100644 --- a/code/modules/plumbing/plumbers/pill_press.dm +++ b/code/modules/plumbing/plumbers/pill_press.dm @@ -24,6 +24,10 @@ var/pill_number = RANDOM_PILL_STYLE ///list of id's and icons for the pill selection of the ui var/list/pill_styles + /// Currently selected patch style + var/patch_style = DEFAULT_PATCH_STYLE + /// List of available patch styles for UI + var/list/patch_styles ///list of products stored in the machine, so we dont have 610 pills on one tile var/list/stored_products = list() ///max amount of pills allowed on our tile before we start storing them instead @@ -46,6 +50,14 @@ SL["id"] = x SL["class_name"] = assets.icon_class_name("pill[x]") pill_styles += list(SL) + var/datum/asset/spritesheet/simple/patches_assets = get_asset_datum(/datum/asset/spritesheet/simple/patches) + patch_styles = list() + for (var/raw_patch_style in PATCH_STYLE_LIST) + //adding class_name for use in UI + var/list/patch_style = list() + patch_style["style"] = raw_patch_style + patch_style["class_name"] = patches_assets.icon_class_name(raw_patch_style) + patch_styles += list(patch_style) /obj/machinery/plumbing/pill_press/process() if(machine_stat & NOPOWER) @@ -66,6 +78,7 @@ var/obj/item/reagent_containers/pill/patch/P = new(src) reagents.trans_to(P, current_volume) P.name = trim("[product_name] patch") + P.icon_state = patch_style stored_products += P else if (product == "bottle") var/obj/item/reagent_containers/glass/bottle/P = new(src) @@ -89,6 +102,7 @@ /obj/machinery/plumbing/pill_press/ui_assets(mob/user) return list( get_asset_datum(/datum/asset/spritesheet/simple/pills), + get_asset_datum(/datum/asset/spritesheet/simple/patches), ) /obj/machinery/plumbing/pill_press/ui_interact(mob/user, datum/tgui/ui) @@ -106,6 +120,8 @@ data["product"] = product data["min_volume"] = min_volume data["max_volume"] = max_volume + data["patch_style"] = patch_style + data["patch_styles"] = patch_styles return data /obj/machinery/plumbing/pill_press/ui_act(action, params) @@ -129,3 +145,5 @@ else if (product == "bottle") max_volume = max_bottle_volume current_volume = clamp(current_volume, min_volume, max_volume) + if("change_patch_style") + patch_style = params["patch_style"] diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 1305bdfba10..fe6f92dc2d0 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -37,6 +37,10 @@ var/list/pill_styles /// List of available condibottle styles for UI var/list/condi_styles + /// Currently selected patch style + var/patch_style = DEFAULT_PATCH_STYLE + /// List of available patch styles for UI + var/list/patch_styles /obj/machinery/chem_master/Initialize(mapload) create_reagents(100) @@ -50,6 +54,15 @@ SL["className"] = assets.icon_class_name("pill[x]") pill_styles += list(SL) + var/datum/asset/spritesheet/simple/patches_assets = get_asset_datum(/datum/asset/spritesheet/simple/patches) + patch_styles = list() + for (var/raw_patch_style in PATCH_STYLE_LIST) + //adding class_name for use in UI + var/list/patch_style = list() + patch_style["style"] = raw_patch_style + patch_style["class_name"] = patches_assets.icon_class_name(raw_patch_style) + patch_styles += list(patch_style) + condi_styles = strip_condi_styles_to_icons(get_condi_styles()) . = ..() @@ -184,6 +197,7 @@ return list( get_asset_datum(/datum/asset/spritesheet/simple/pills), get_asset_datum(/datum/asset/spritesheet/simple/condiments), + get_asset_datum(/datum/asset/spritesheet/simple/patches), ) /obj/machinery/chem_master/ui_interact(mob/user, datum/tgui/ui) @@ -225,6 +239,8 @@ //Calculated at init time as it never changes data["pillStyles"] = pill_styles data["condiStyles"] = condi_styles + data["patch_style"] = patch_style + data["patch_styles"] = patch_styles return data /obj/machinery/chem_master/ui_act(action, params) @@ -382,6 +398,7 @@ for(var/i in 1 to amount) P = new/obj/item/reagent_containers/pill/patch(drop_location()) P.name = trim("[name] patch") + P.icon_state = patch_style adjust_item_drop_location(P) reagents.trans_to(P, vol_each, transfered_by = usr) return TRUE @@ -434,6 +451,10 @@ screen = params["screen"] return TRUE + if(action == "change_patch_style") + patch_style = params["patch_style"] + return TRUE + return FALSE /obj/machinery/chem_master/adjust_item_drop_location(atom/movable/AM) // Special version for chemmasters and condimasters diff --git a/icons/ui_icons/patches/bandaid.png b/icons/ui_icons/patches/bandaid.png new file mode 100644 index 0000000000000000000000000000000000000000..66d2a0217da3db8f13cc5ff27ecbed37406d6a4a GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@I3?$8F6>L*wC98!nVPUZ$NKW+ z%bU7`9z1x^v*%j3W86!i8pe_!zhDN3XE)M-93M{?#}J9BrRM`V85lX31GFO&MZ*qq zg+;KwzF)`pj^*zJbAgK;HQJ9}`!u*7c$mK6ZCOO#swW$Kyp$)N4mCA?cl!FDt^apD e-|_#)cgD|NI`#8ktknXV%i!ti=d#Wzp$P!8YDZxJ literal 0 HcmV?d00001 diff --git a/icons/ui_icons/patches/bandaid_both.png b/icons/ui_icons/patches/bandaid_both.png new file mode 100644 index 0000000000000000000000000000000000000000..b7639b505b8e6d3067fbdc825e0fbf48d5bb5122 GIT binary patch literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@I3?$8F6>iW*8>L*wC98!nVPUZ$NIs8 z2b;Qs{u}>)6K8Sx@?~R&|Nl>xl<%v{1}bJO3GxeOaCmkj4af=cba4!kn3|j*(89>Z zma=WZf=L^@ySq0EO=vz8#%0RZ7@%shZDV27tisCnjfPUURddxQ#J+pfbkJ`$XUg>C vO^sP$iJKJDrYXVS)*8>L*wC98!nVPUZ$NIs8 z2b;QsE?>U<-}t{V!+%A6=4(J@j3q&S!3+-1ZlnP@9-c0aAre!Q69ifq+1OIHEm$yV zV|RD=MxhDKhr+m6H#<+gaO2pq%%@MEW*$41kt06+6Q4p!;lUKVS)*8>L*wC98!nVPUZ$NIs8 z2b;QsE?>U { autoCondiStyle, pillStyles = [], condiStyles = [], + patch_style, + patch_styles = [], } = data; const autoCondiStyleChosen = autoCondiStyle === chosenCondiStyle; return ( @@ -273,6 +275,20 @@ const PackagingControls = (props, context) => { volume: 'auto', })} /> )} + {!condi && ( + + {patch_styles.map(patch => ( + + ))} + + )} {!condi && ( { product, min_volume, max_volume, + patch_style, + patch_styles = [], } = data; return ( { ))} )} + {product === "patch" && ( + + {patch_styles.map(patch => ( + + ))} + + )}