mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
Patch icon choosing in the chem dispenser and chem press (#64137)
* patch style for chem master, chem press
This commit is contained in:
@@ -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 "_"
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 182 B |
Binary file not shown.
|
After Width: | Height: | Size: 199 B |
Binary file not shown.
|
After Width: | Height: | Size: 181 B |
Binary file not shown.
|
After Width: | Height: | Size: 191 B |
@@ -241,6 +241,8 @@ const PackagingControls = (props, context) => {
|
||||
autoCondiStyle,
|
||||
pillStyles = [],
|
||||
condiStyles = [],
|
||||
patch_style,
|
||||
patch_styles = [],
|
||||
} = data;
|
||||
const autoCondiStyleChosen = autoCondiStyle === chosenCondiStyle;
|
||||
return (
|
||||
@@ -273,6 +275,20 @@ const PackagingControls = (props, context) => {
|
||||
volume: 'auto',
|
||||
})} />
|
||||
)}
|
||||
{!condi && (
|
||||
<LabeledList.Item label="Patch type">
|
||||
{patch_styles.map(patch => (
|
||||
<Button
|
||||
key={patch.style}
|
||||
selected={patch.style === patch_style}
|
||||
textAlign="center"
|
||||
color="transparent"
|
||||
onClick={() => act('change_patch_style', { patch_style: patch.style })}>
|
||||
<Box mb={0} mt={1} className={patch.class_name} />
|
||||
</Button>
|
||||
))}
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
{!condi && (
|
||||
<PackagingControlsItem
|
||||
label="Patches"
|
||||
|
||||
@@ -12,6 +12,8 @@ export const ChemPress = (props, context) => {
|
||||
product,
|
||||
min_volume,
|
||||
max_volume,
|
||||
patch_style,
|
||||
patch_styles = [],
|
||||
} = data;
|
||||
return (
|
||||
<Window
|
||||
@@ -84,6 +86,22 @@ export const ChemPress = (props, context) => {
|
||||
))}
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
{product === "patch" && (
|
||||
<LabeledList.Item label="Style">
|
||||
{patch_styles.map(patch => (
|
||||
<Button
|
||||
key={patch.style}
|
||||
selected={patch.style === patch_style}
|
||||
textAlign="center"
|
||||
color="transparent"
|
||||
onClick={() => act('change_patch_style', {
|
||||
patch_style: patch.style,
|
||||
})}>
|
||||
<Box mb={0} mt={1} className={patch.class_name} />
|
||||
</Button>
|
||||
))}
|
||||
</LabeledList.Item>
|
||||
)}
|
||||
</LabeledList>
|
||||
</Section>
|
||||
</Window.Content>
|
||||
|
||||
Reference in New Issue
Block a user