diff --git a/code/__DEFINES/plumbing.dm b/code/__DEFINES/plumbing.dm index 002c2c7c1e3..432f8ca4357 100644 --- a/code/__DEFINES/plumbing.dm +++ b/code/__DEFINES/plumbing.dm @@ -8,23 +8,5 @@ #define MACHINE_REAGENT_TRANSFER 10 //the default max plumbing machinery transfers -/// List of plumbing layers as name => bitflag -GLOBAL_LIST_INIT(plumbing_layers, list( - "First Layer" = FIRST_DUCT_LAYER, - "Second Layer" = SECOND_DUCT_LAYER, - "Default Layer" = THIRD_DUCT_LAYER, - "Fourth Layer" = FOURTH_DUCT_LAYER, - "Fifth Layer" = FIFTH_DUCT_LAYER, -)) - -/// Reverse of plumbing_layers, as "[bitflag]" => name -GLOBAL_LIST_INIT(plumbing_layer_names, list( - "[FIRST_DUCT_LAYER]" = "First Layer", - "[SECOND_DUCT_LAYER]" = "Second Layer", - "[THIRD_DUCT_LAYER]" = "Default Layer", - "[FOURTH_DUCT_LAYER]" = "Fourth Layer", - "[FIFTH_DUCT_LAYER]" = "Fifth Layer", -)) - /// Name of omni color #define DUCT_COLOR_OMNI "omni" diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index b668afc4d7f..56b9c1cea2c 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -45,45 +45,18 @@ #define SYNTHFLESH_UNHUSK_AMOUNT 100 //used by chem masters and pill presses -#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_1", \ - "bandaid_2", \ - "bandaid_3", \ - "bandaid_4", \ - "bandaid_blank", \ - "bandaid_both", \ - "bandaid_brute", \ - "bandaid_brute_2", \ - "bandaid_burn", \ - "bandaid_burn_2", \ - "bandaid_clown", \ - "bandaid_colonthree", \ - "bandaid_exclaimationpoint", \ - "bandaid_mix", \ - "bandaid_monke", \ - "bandaid_msic", \ - "bandaid_questionmark", \ - "bandaid_suffocation", \ - "bandaid_suffocation_2", \ - "bandaid_toxin", \ - "bandaid_toxin_2", \ -) //icon_state list +// The categories of reagent packaging +#define CAT_CONDIMENTS "condiments" +#define CAT_TUBES "tubes" +#define CAT_PILLS "pills" +#define CAT_PATCHES "patches" #define DEFAULT_PATCH_STYLE "bandaid_blank" - //used by chem master #define CONDIMASTER_STYLE_AUTO "auto" #define CONDIMASTER_STYLE_FALLBACK "_" #define ALLERGIC_REMOVAL_SKIP "Allergy" -/// the default temperature at which chemicals are added to reagent holders at -#define DEFAULT_REAGENT_TEMPERATURE 300 - //Used in holder.dm/equlibrium.dm to set values and volume limits ///the minimum volume of reagents than can be operated on. #define CHEMICAL_QUANTISATION_LEVEL 0.0001 @@ -97,9 +70,10 @@ #define BUFFER_IONIZING_STRENGTH 30 ///The maximum temperature a reagent holder can attain #define CHEMICAL_MAXIMUM_TEMPERATURE 99999 - ///The default purity of all non reacted reagents #define REAGENT_STANDARD_PURITY 0.75 +/// the default temperature at which chemicals are added to reagent holders at +#define DEFAULT_REAGENT_TEMPERATURE 300 //reagent bitflags, used for altering how they works ///allows on_mob_dead() if present in a dead body diff --git a/code/__DEFINES/~skyrat_defines/reagents.dm b/code/__DEFINES/~skyrat_defines/reagents.dm index b1bde762a54..ac8d72d5eb7 100644 --- a/code/__DEFINES/~skyrat_defines/reagents.dm +++ b/code/__DEFINES/~skyrat_defines/reagents.dm @@ -3,3 +3,8 @@ ///Amount of synthflesh required to unhusk someone #define SYNTHFLESH_LING_UNHUSK_AMOUNT 200 + +//used by chem masters and pill presses +// The categories of reagent packaging +#define CAT_HYPOS "hypos" +#define CAT_DARTS "darts" diff --git a/code/_globalvars/lists/plumbing.dm b/code/_globalvars/lists/plumbing.dm new file mode 100644 index 00000000000..10953d5ab24 --- /dev/null +++ b/code/_globalvars/lists/plumbing.dm @@ -0,0 +1,17 @@ +/// List of plumbing layers as name => bitflag +GLOBAL_LIST_INIT(plumbing_layers, list( + "First Layer" = FIRST_DUCT_LAYER, + "Second Layer" = SECOND_DUCT_LAYER, + "Default Layer" = THIRD_DUCT_LAYER, + "Fourth Layer" = FOURTH_DUCT_LAYER, + "Fifth Layer" = FIFTH_DUCT_LAYER, +)) + +/// Reverse of plumbing_layers, as "[bitflag]" => name +GLOBAL_LIST_INIT(plumbing_layer_names, list( + "[FIRST_DUCT_LAYER]" = "First Layer", + "[SECOND_DUCT_LAYER]" = "Second Layer", + "[THIRD_DUCT_LAYER]" = "Default Layer", + "[FOURTH_DUCT_LAYER]" = "Fourth Layer", + "[FIFTH_DUCT_LAYER]" = "Fifth Layer", +)) diff --git a/code/_globalvars/lists/reagents.dm b/code/_globalvars/lists/reagents.dm index dec2724cfeb..68d63d97934 100644 --- a/code/_globalvars/lists/reagents.dm +++ b/code/_globalvars/lists/reagents.dm @@ -1,3 +1,51 @@ +//Pills & Patches +/// List of containers the Chem Master machine can print +GLOBAL_LIST_INIT(reagent_containers, list( + CAT_CONDIMENTS = list( + /obj/item/reagent_containers/cup/bottle, + /obj/item/reagent_containers/condiment/flour, + /obj/item/reagent_containers/condiment/sugar, + /obj/item/reagent_containers/condiment/rice, + /obj/item/reagent_containers/condiment/cornmeal, + /obj/item/reagent_containers/condiment/milk, + /obj/item/reagent_containers/condiment/soymilk, + /obj/item/reagent_containers/condiment/yoghurt, + /obj/item/reagent_containers/condiment/saltshaker, + /obj/item/reagent_containers/condiment/peppermill, + /obj/item/reagent_containers/condiment/soysauce, + /obj/item/reagent_containers/condiment/bbqsauce, + /obj/item/reagent_containers/condiment/enzyme, + /obj/item/reagent_containers/condiment/hotsauce, + /obj/item/reagent_containers/condiment/coldsauce, + /obj/item/reagent_containers/condiment/mayonnaise, + /obj/item/reagent_containers/condiment/ketchup, + /obj/item/reagent_containers/condiment/olive_oil, + /obj/item/reagent_containers/condiment/vegetable_oil, + /obj/item/reagent_containers/condiment/peanut_butter, + /obj/item/reagent_containers/condiment/cherryjelly, + /obj/item/reagent_containers/condiment/honey, + /obj/item/reagent_containers/condiment/pack, + ), + CAT_TUBES = list( + /obj/item/reagent_containers/cup/tube + ), + CAT_PILLS = typecacheof(list( + /obj/item/reagent_containers/pill/style + )), + CAT_PATCHES = typecacheof(list( + /obj/item/reagent_containers/pill/patch/style + )), + // SKYRAT EDIT ADDITION START + CAT_HYPOS = list( + /obj/item/reagent_containers/cup/vial/small, + /obj/item/reagent_containers/cup/vial/large, + ), + CAT_DARTS = typecacheof(list( + /obj/item/reagent_containers/syringe/smartdart + )), + // SKYRAT EDIT ADDITION END +)) + /// list of all /datum/chemical_reaction datums indexed by their typepath. Use this for general lookup stuff GLOBAL_LIST(chemical_reactions_list) /// list of all /datum/chemical_reaction datums. Used during chemical reactions. Indexed by REACTANT types diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index 15c9f24833b..4d093da7ae2 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -75,7 +75,7 @@ if(!demand_connects || !reagents) return PROCESS_KILL - if(reagents.total_volume < reagents.maximum_volume) + if(!reagents.holder_full()) for(var/D in GLOB.cardinals) if(D & demand_connects) send_request(D) diff --git a/code/modules/asset_cache/assets/chemmaster.dm b/code/modules/asset_cache/assets/chemmaster.dm index d37e6de91a5..991d999b2cd 100644 --- a/code/modules/asset_cache/assets/chemmaster.dm +++ b/code/modules/asset_cache/assets/chemmaster.dm @@ -4,8 +4,8 @@ /datum/asset/spritesheet/chemmaster/create_spritesheets() var/list/ids = list() - for(var/category in GLOB.chem_master_containers) - for(var/obj/item/reagent_containers/container as anything in GLOB.chem_master_containers[category]) + for(var/category in GLOB.reagent_containers) + for(var/obj/item/reagent_containers/container as anything in GLOB.reagent_containers[category]) var/icon_file = initial(container.icon) var/icon_state = initial(container.icon_state) var/id = sanitize_css_class_name("[container]") diff --git a/code/modules/asset_cache/assets/patches.dm b/code/modules/asset_cache/assets/patches.dm deleted file mode 100644 index 0976bca7218..00000000000 --- a/code/modules/asset_cache/assets/patches.dm +++ /dev/null @@ -1,25 +0,0 @@ -/datum/asset/spritesheet/simple/patches - name = "patches" - assets = list( - "bandaid_1" = 'icons/ui_icons/patches/bandaid_1.png', - "bandaid_2" = 'icons/ui_icons/patches/bandaid_2.png', - "bandaid_3" = 'icons/ui_icons/patches/bandaid_3.png', - "bandaid_4" = 'icons/ui_icons/patches/bandaid_4.png', - "bandaid_blank" = 'icons/ui_icons/patches/bandaid_blank.png', - "bandaid_both" = 'icons/ui_icons/patches/bandaid_both.png', - "bandaid_brute" = 'icons/ui_icons/patches/bandaid_brute.png', - "bandaid_brute_2" = 'icons/ui_icons/patches/bandaid_brute_2.png', - "bandaid_burn" = 'icons/ui_icons/patches/bandaid_burn.png', - "bandaid_burn_2" = 'icons/ui_icons/patches/bandaid_burn_2.png', - "bandaid_clown" = 'icons/ui_icons/patches/bandaid_clown.png', - "bandaid_colonthree" = 'icons/ui_icons/patches/bandaid_colonthree.png', - "bandaid_exclaimationpoint" = 'icons/ui_icons/patches/bandaid_exclaimationpoint.png', - "bandaid_mix" = 'icons/ui_icons/patches/bandaid_mix.png', - "bandaid_monke" = 'icons/ui_icons/patches/bandaid_monke.png', - "bandaid_msic" = 'icons/ui_icons/patches/bandaid_msic.png', - "bandaid_questionmark" = 'icons/ui_icons/patches/bandaid_questionmark.png', - "bandaid_suffocation" = 'icons/ui_icons/patches/bandaid_suffocation.png', - "bandaid_suffocation_2" = 'icons/ui_icons/patches/bandaid_suffocation_2.png', - "bandaid_toxin" = 'icons/ui_icons/patches/bandaid_toxin.png', - "bandaid_toxin_2" = 'icons/ui_icons/patches/bandaid_toxin_2.png', - ) diff --git a/code/modules/asset_cache/assets/pills.dm b/code/modules/asset_cache/assets/pills.dm deleted file mode 100644 index bbc551e544d..00000000000 --- a/code/modules/asset_cache/assets/pills.dm +++ /dev/null @@ -1,26 +0,0 @@ -/datum/asset/spritesheet/simple/pills - name = "pills" - assets = list( - "pill1" = 'icons/ui_icons/pills/pill1.png', - "pill2" = 'icons/ui_icons/pills/pill2.png', - "pill3" = 'icons/ui_icons/pills/pill3.png', - "pill4" = 'icons/ui_icons/pills/pill4.png', - "pill5" = 'icons/ui_icons/pills/pill5.png', - "pill6" = 'icons/ui_icons/pills/pill6.png', - "pill7" = 'icons/ui_icons/pills/pill7.png', - "pill8" = 'icons/ui_icons/pills/pill8.png', - "pill9" = 'icons/ui_icons/pills/pill9.png', - "pill10" = 'icons/ui_icons/pills/pill10.png', - "pill11" = 'icons/ui_icons/pills/pill11.png', - "pill12" = 'icons/ui_icons/pills/pill12.png', - "pill13" = 'icons/ui_icons/pills/pill13.png', - "pill14" = 'icons/ui_icons/pills/pill14.png', - "pill15" = 'icons/ui_icons/pills/pill15.png', - "pill16" = 'icons/ui_icons/pills/pill16.png', - "pill17" = 'icons/ui_icons/pills/pill17.png', - "pill18" = 'icons/ui_icons/pills/pill18.png', - "pill19" = 'icons/ui_icons/pills/pill19.png', - "pill20" = 'icons/ui_icons/pills/pill20.png', - "pill21" = 'icons/ui_icons/pills/pill21.png', - "pill22" = 'icons/ui_icons/pills/pill22.png', - ) diff --git a/code/modules/plumbing/plumbers/bottler.dm b/code/modules/plumbing/plumbers/bottler.dm index 7ce4c2f5576..d0a33aebf4a 100644 --- a/code/modules/plumbing/plumbers/bottler.dm +++ b/code/modules/plumbing/plumbers/bottler.dm @@ -34,23 +34,24 @@ ///changes the tile array /obj/machinery/plumbing/bottler/setDir(newdir) . = ..() + var/turf/target_turf = get_turf(src) switch(dir) if(NORTH) - goodspot = get_step(get_turf(src), NORTH) - inputspot = get_step(get_turf(src), SOUTH) - badspot = get_step(get_turf(src), EAST) + goodspot = get_step(target_turf, NORTH) + inputspot = get_step(target_turf, SOUTH) + badspot = get_step(target_turf, EAST) if(SOUTH) - goodspot = get_step(get_turf(src), SOUTH) - inputspot = get_step(get_turf(src), NORTH) - badspot = get_step(get_turf(src), WEST) + goodspot = get_step(target_turf, SOUTH) + inputspot = get_step(target_turf, NORTH) + badspot = get_step(target_turf, WEST) if(WEST) - goodspot = get_step(get_turf(src), WEST) - inputspot = get_step(get_turf(src), EAST) - badspot = get_step(get_turf(src), NORTH) + goodspot = get_step(target_turf, WEST) + inputspot = get_step(target_turf, EAST) + badspot = get_step(target_turf, NORTH) if(EAST) - goodspot = get_step(get_turf(src), EAST) - inputspot = get_step(get_turf(src), WEST) - badspot = get_step(get_turf(src), SOUTH) + goodspot = get_step(target_turf, EAST) + inputspot = get_step(target_turf, WEST) + badspot = get_step(target_turf, SOUTH) //If by some miracle if( ( !valid_output_configuration ) && ( goodspot != null && inputspot != null && badspot != null ) ) @@ -63,7 +64,7 @@ if(!valid_output_configuration) to_chat(user, span_warning("A flashing notification on the screen reads: \"Output location error!\"")) return . - var/new_amount = tgui_input_number(user, "Set Amount to Fill", "Desired Amount", max_value = 100) + var/new_amount = tgui_input_number(user, "Set Amount to Fill", "Desired Amount", max_value = reagents.maximum_volume, round_value = TRUE) if(!new_amount || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return . wanted_amount = new_amount @@ -78,7 +79,7 @@ return PROCESS_KILL ///see if machine has enough to fill, is anchored down and has any inputspot objects to pick from - if(reagents.total_volume >= wanted_amount && anchored && length(inputspot.contents)) + if(reagents.total_volume + (CHEMICAL_QUANTISATION_LEVEL * 10) >= wanted_amount && anchored && length(inputspot.contents)) use_power(active_power_usage * seconds_per_tick) var/obj/AM = pick(inputspot.contents)///pick a reagent_container that could be used if((is_reagent_container(AM) && !istype(AM, /obj/item/reagent_containers/hypospray/medipen)) || istype(AM, /obj/item/ammo_casing/shotgun/dart)) diff --git a/code/modules/plumbing/plumbers/pill_press.dm b/code/modules/plumbing/plumbers/pill_press.dm index e04215e94e2..6218151cc04 100644 --- a/code/modules/plumbing/plumbers/pill_press.dm +++ b/code/modules/plumbing/plumbers/pill_press.dm @@ -1,3 +1,10 @@ +///the minimum size of a pill or patch +#define MIN_VOLUME 5 +///the maximum size a pill or patch can be +#define MAX_VOLUME 50 +///max amount of pills allowed on our tile before we start storing them instead +#define MAX_FLOOR_PRODUCTS 10 + ///We take a constant input of reagents, and produce a pill once a set volume is reached /obj/machinery/plumbing/pill_press name = "chemical press" @@ -5,114 +12,114 @@ icon_state = "pill_press" active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 - ///maximum size of a pill - var/max_pill_volume = 50 - ///maximum size of a patch - var/max_patch_volume = 40 - ///maximum size of a bottle - var/max_bottle_volume = 50 - ///current operating product (pills or patches) + /// current operating product (pills or patches) var/product = "pill" - ///the minimum size a pill or patch can be - var/min_volume = 5 - ///the maximum size a pill or patch can be - var/max_volume = 50 - ///selected size of the product + /// selected size of the product var/current_volume = 10 - ///prefix for the product name + /// prefix for the product name var/product_name = "factory" - ///the icon_state number for the pill. - 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 + /// All packaging types wrapped up in 1 big list + var/static/list/packaging_types = null + ///The type of packaging to use + var/packaging_type + ///Category of packaging + var/packaging_category + /// 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 - var/max_floor_products = 10 - -/obj/machinery/plumbing/pill_press/examine(mob/user) - . = ..() - . += span_notice("The [name] currently has [stored_products.len] stored. There needs to be less than [max_floor_products] on the floor to continue dispensing.") /obj/machinery/plumbing/pill_press/Initialize(mapload, bolt, layer) . = ..() + if(!packaging_types) + var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/chemmaster) + + var/list/types = list( + CAT_PILLS = GLOB.reagent_containers[CAT_PILLS], + CAT_PATCHES = GLOB.reagent_containers[CAT_PATCHES], + "Bottles" = list(/obj/item/reagent_containers/cup/bottle), + CAT_HYPOS = GLOB.reagent_containers[CAT_HYPOS], // SKYRAT EDIT ADDITION - Hypovials + + ) + + packaging_types = list() + for(var/category in types) + var/list/packages = types[category] + + var/list/category_item = list("cat_name" = category) + for(var/obj/item/reagent_containers/container as anything in packages) + var/list/package_item = list( + "class_name" = assets.icon_class_name(sanitize_css_class_name("[container]")), + "ref" = REF(container) + ) + category_item["products"] += list(package_item) + + packaging_types += list(category_item) + + packaging_type = REF(GLOB.reagent_containers[CAT_PILLS][1]) + decode_category() + AddComponent(/datum/component/plumbing/simple_demand, bolt, layer) +/obj/machinery/plumbing/pill_press/examine(mob/user) + . = ..() + . += span_notice("The [name] currently has [stored_products.len] stored. There needs to be less than [MAX_FLOOR_PRODUCTS] on the floor to continue dispensing.") + +/// decode product category from it's type path and returns the decoded typepath +/obj/machinery/plumbing/pill_press/proc/decode_category() + var/obj/item/reagent_containers/container = locate(packaging_type) + if(ispath(container, /obj/item/reagent_containers/pill/patch)) + packaging_category = CAT_PATCHES + else if(ispath(container, /obj/item/reagent_containers/pill)) + packaging_category = CAT_PILLS + // SKYRAT EDIT ADDITION START - HYPOVIALS + else if(ispath(container, /obj/item/reagent_containers/cup/vial)) + packaging_category = CAT_HYPOS + // SKYRAT EDIT ADDITION END + else + packaging_category = "Bottles" + return container + /obj/machinery/plumbing/pill_press/process(seconds_per_tick) if(machine_stat & NOPOWER) return - if(reagents.total_volume >= current_volume) - if (product == "pill") - var/obj/item/reagent_containers/pill/P = new(src) - reagents.trans_to(P, current_volume) - P.name = trim("[product_name] pill") - stored_products += P - if(pill_number == RANDOM_PILL_STYLE) - P.icon_state = "pill[rand(1,21)]" + + //shift & check to account for floating point inaccuracies + if(reagents.total_volume + (CHEMICAL_QUANTISATION_LEVEL * 10) >= current_volume) + var/obj/item/reagent_containers/container = locate(packaging_type) + container = new container(src) + var/suffix + switch(packaging_category) + if(CAT_PILLS) + suffix = "Pill" + if(CAT_PATCHES) + suffix = "Patch" + //SKYRAT EDIT ADDITION BEGIN - HYPOVIALS + if (CAT_HYPOS) + suffix = "Vial" + //SKYRAT EDIT ADDITION END - HYPOVIALS else - P.icon_state = "pill[pill_number]" - if(P.icon_state == "pill4") //mirrored from chem masters - P.desc = "A tablet or capsule, but not just any, a red one, one taken by the ones not scared of knowledge, freedom, uncertainty and the brutal truths of reality." - else if (product == "patch") - 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/cup/bottle/P = new(src) - reagents.trans_to(P, current_volume) - P.name = trim("[product_name] bottle") - stored_products += P - //SKYRAT EDIT ADDITION BEGIN - HYPOVIALS - else if (product == "vial") - var/obj/item/reagent_containers/cup/vial/small/P = new(src) - reagents.trans_to(P, current_volume) - P.name = trim("[product_name] vial") - stored_products += P - //SKYRAT EDIT ADDITION END - HYPOVIALS + suffix = "Bottle" + container.name = "[product_name] [suffix]" + reagents.trans_to(container, current_volume) + stored_products += container + + //dispense stored products on the floor if(stored_products.len) var/pill_amount = 0 - for(var/thing in loc) - if(!istype(thing, /obj/item/reagent_containers/cup/bottle) && !istype(thing, /obj/item/reagent_containers/pill) && !istype(thing, /obj/item/reagent_containers/cup/vial/small)) //SKYRAT EDIT - Hypovials from chem presses - continue + for(var/obj/item/reagent_containers/thing in loc) pill_amount++ - if(pill_amount >= max_floor_products) //too much so just stop + if(pill_amount >= MAX_FLOOR_PRODUCTS) //too much so just stop break - if(pill_amount < max_floor_products && anchored) + if(pill_amount < MAX_FLOOR_PRODUCTS && anchored) var/atom/movable/AM = stored_products[1] //AM because forceMove is all we need stored_products -= AM AM.forceMove(drop_location()) use_power(active_power_usage * seconds_per_tick) -/obj/machinery/plumbing/pill_press/proc/load_styles() - //expertly copypasted from chemmasters - var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/simple/pills) - pill_styles = list() - for (var/x in 1 to PILL_STYLE_COUNT) - var/list/SL = list() - 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/ui_assets(mob/user) return list( - get_asset_datum(/datum/asset/spritesheet/simple/pills), - get_asset_datum(/datum/asset/spritesheet/simple/patches), + get_asset_datum(/datum/asset/spritesheet/chemmaster) ) /obj/machinery/plumbing/pill_press/ui_interact(mob/user, datum/tgui/ui) @@ -121,45 +128,45 @@ ui = new(user, src, "ChemPress", name) ui.open() +/obj/machinery/plumbing/pill_press/ui_static_data(mob/user) + var/list/data = list() + + data["min_volume"] = MIN_VOLUME + data["max_volume"] = MAX_VOLUME + data["packaging_types"] = packaging_types + + return data + /obj/machinery/plumbing/pill_press/ui_data(mob/user) - if(!pill_styles || !patch_styles) - load_styles() var/list/data = list() - data["pill_style"] = pill_number + data["current_volume"] = current_volume data["product_name"] = product_name - data["pill_styles"] = pill_styles - data["product"] = product - data["min_volume"] = min_volume - data["max_volume"] = max_volume - data["patch_style"] = patch_style - data["patch_styles"] = patch_styles + data["packaging_type"] = packaging_type + data["packaging_category"] = packaging_category + return data /obj/machinery/plumbing/pill_press/ui_act(action, params) . = ..() if(.) return + . = TRUE switch(action) - if("change_pill_style") - pill_number = clamp(text2num(params["id"]), 1 , PILL_STYLE_COUNT) if("change_current_volume") - current_volume = clamp(text2num(params["volume"]), min_volume, max_volume) + current_volume = round(clamp(text2num(params["volume"]), MIN_VOLUME, MAX_VOLUME)) if("change_product_name") - product_name = html_encode(params["name"]) + var/formatted_name = html_encode(params["name"]) + if (length(formatted_name) > MAX_NAME_LEN) + product_name = copytext(formatted_name, 1, MAX_NAME_LEN + 1) + else + product_name = formatted_name if("change_product") - product = params["product"] - if (product == "pill") - max_volume = max_pill_volume - else if (product == "patch") - max_volume = max_patch_volume - else if (product == "bottle") - max_volume = max_bottle_volume - //SKYRAT EDIT ADDITION BEGIN - HYPOVIALS - else if (product == "vial") - max_volume = max_bottle_volume - //SKYRAT EDIT ADDITION END - HYPOVIALS - current_volume = clamp(current_volume, min_volume, max_volume) - if("change_patch_style") - patch_style = params["patch_style"] + packaging_type = params["ref"] + var/obj/item/reagent_containers/container = decode_category() + current_volume = clamp(current_volume, MIN_VOLUME, initial(container.volume)) + +#undef MIN_VOLUME +#undef MAX_VOLUME +#undef MAX_FLOOR_PRODUCTS diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 9d33cccd56c..39146c12d0e 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -2,59 +2,6 @@ #define TRANSFER_MODE_MOVE 1 #define TARGET_BEAKER "beaker" #define TARGET_BUFFER "buffer" -#define CAT_CONDIMENTS "condiments" -#define CAT_TUBES "tubes" -#define CAT_PILLS "pills" -#define CAT_PATCHES "patches" -#define CAT_HYPOS "hypos" // SKYRAT EDIT ADDITION -#define CAT_DARTS "darts" // SKYRAT EDIT ADDITION - -/// List of containers the Chem Master machine can print -GLOBAL_LIST_INIT(chem_master_containers, list( - CAT_CONDIMENTS = list( - /obj/item/reagent_containers/cup/bottle, - /obj/item/reagent_containers/condiment/flour, - /obj/item/reagent_containers/condiment/sugar, - /obj/item/reagent_containers/condiment/rice, - /obj/item/reagent_containers/condiment/cornmeal, - /obj/item/reagent_containers/condiment/milk, - /obj/item/reagent_containers/condiment/soymilk, - /obj/item/reagent_containers/condiment/yoghurt, - /obj/item/reagent_containers/condiment/saltshaker, - /obj/item/reagent_containers/condiment/peppermill, - /obj/item/reagent_containers/condiment/soysauce, - /obj/item/reagent_containers/condiment/bbqsauce, - /obj/item/reagent_containers/condiment/enzyme, - /obj/item/reagent_containers/condiment/hotsauce, - /obj/item/reagent_containers/condiment/coldsauce, - /obj/item/reagent_containers/condiment/mayonnaise, - /obj/item/reagent_containers/condiment/ketchup, - /obj/item/reagent_containers/condiment/olive_oil, - /obj/item/reagent_containers/condiment/vegetable_oil, - /obj/item/reagent_containers/condiment/peanut_butter, - /obj/item/reagent_containers/condiment/cherryjelly, - /obj/item/reagent_containers/condiment/honey, - /obj/item/reagent_containers/condiment/pack, - ), - CAT_TUBES = list( - /obj/item/reagent_containers/cup/tube - ), - CAT_PILLS = typecacheof(list( - /obj/item/reagent_containers/pill/style - )), - CAT_PATCHES = typecacheof(list( - /obj/item/reagent_containers/pill/patch/style - )), - // SKYRAT EDIT ADDITION START - CAT_HYPOS = list( - /obj/item/reagent_containers/cup/vial/small, - /obj/item/reagent_containers/cup/vial/large, - ), - CAT_DARTS = typecacheof(list( - /obj/item/reagent_containers/syringe/smartdart - )) - // SKYRAT EDIT ADDITION END -)) /obj/machinery/chem_master name = "ChemMaster 3000" @@ -70,7 +17,7 @@ GLOBAL_LIST_INIT(chem_master_containers, list( /// Icons for different percentages of buffer reagents var/fill_icon = 'icons/obj/medical/reagent_fillings.dmi' var/fill_icon_state = "chemmaster" - var/list/fill_icon_thresholds = list(10,20,30,40,50,60,70,80,90,100) + var/static/list/fill_icon_thresholds = list(10, 20, 30, 40, 50, 60, 70, 80, 90, 100) /// Inserted reagent container var/obj/item/reagent_containers/beaker /// Whether separated reagents should be moved back to container or destroyed. @@ -225,11 +172,11 @@ GLOBAL_LIST_INIT(chem_master_containers, list( /obj/machinery/chem_master/proc/load_printable_containers() printable_containers = list( - CAT_TUBES = GLOB.chem_master_containers[CAT_TUBES], - CAT_PILLS = GLOB.chem_master_containers[CAT_PILLS], - CAT_PATCHES = GLOB.chem_master_containers[CAT_PATCHES], - CAT_HYPOS = GLOB.chem_master_containers[CAT_HYPOS], // SKYRAT EDIT ADDITION - CAT_DARTS = GLOB.chem_master_containers[CAT_DARTS], // SKYRAT EDIT ADDITION + CAT_TUBES = GLOB.reagent_containers[CAT_TUBES], + CAT_PILLS = GLOB.reagent_containers[CAT_PILLS], + CAT_PATCHES = GLOB.reagent_containers[CAT_PATCHES], + CAT_HYPOS = GLOB.reagent_containers[CAT_HYPOS], // SKYRAT EDIT ADDITION + CAT_DARTS = GLOB.reagent_containers[CAT_DARTS], // SKYRAT EDIT ADDITION ) /obj/machinery/chem_master/ui_assets(mob/user) @@ -503,16 +450,10 @@ GLOBAL_LIST_INIT(chem_master_containers, list( /obj/machinery/chem_master/condimaster/load_printable_containers() printable_containers = list( - CAT_CONDIMENTS = GLOB.chem_master_containers[CAT_CONDIMENTS], + CAT_CONDIMENTS = GLOB.reagent_containers[CAT_CONDIMENTS], ) #undef TRANSFER_MODE_DESTROY #undef TRANSFER_MODE_MOVE #undef TARGET_BEAKER #undef TARGET_BUFFER -#undef CAT_CONDIMENTS -#undef CAT_TUBES -#undef CAT_PILLS -#undef CAT_PATCHES -#undef CAT_HYPOS // SKYRAT EDIT ADDITION -#undef CAT_DARTS // SKYRAT EDIT ADDITION diff --git a/icons/ui_icons/patches/bandaid_1.png b/icons/ui_icons/patches/bandaid_1.png deleted file mode 100644 index f752da706a9..00000000000 Binary files a/icons/ui_icons/patches/bandaid_1.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_2.png b/icons/ui_icons/patches/bandaid_2.png deleted file mode 100644 index 50ad473ba5d..00000000000 Binary files a/icons/ui_icons/patches/bandaid_2.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_3.png b/icons/ui_icons/patches/bandaid_3.png deleted file mode 100644 index cee1dd19b83..00000000000 Binary files a/icons/ui_icons/patches/bandaid_3.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_4.png b/icons/ui_icons/patches/bandaid_4.png deleted file mode 100644 index 3061235434c..00000000000 Binary files a/icons/ui_icons/patches/bandaid_4.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_blank.png b/icons/ui_icons/patches/bandaid_blank.png deleted file mode 100644 index ddd3882922e..00000000000 Binary files a/icons/ui_icons/patches/bandaid_blank.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_both.png b/icons/ui_icons/patches/bandaid_both.png deleted file mode 100644 index 94245e560fe..00000000000 Binary files a/icons/ui_icons/patches/bandaid_both.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_brute.png b/icons/ui_icons/patches/bandaid_brute.png deleted file mode 100644 index bf6350f6ced..00000000000 Binary files a/icons/ui_icons/patches/bandaid_brute.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_brute_2.png b/icons/ui_icons/patches/bandaid_brute_2.png deleted file mode 100644 index 66c2d8494d5..00000000000 Binary files a/icons/ui_icons/patches/bandaid_brute_2.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_burn.png b/icons/ui_icons/patches/bandaid_burn.png deleted file mode 100644 index 67c6fb0dcbb..00000000000 Binary files a/icons/ui_icons/patches/bandaid_burn.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_burn_2.png b/icons/ui_icons/patches/bandaid_burn_2.png deleted file mode 100644 index db5df4f1e60..00000000000 Binary files a/icons/ui_icons/patches/bandaid_burn_2.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_clown.png b/icons/ui_icons/patches/bandaid_clown.png deleted file mode 100644 index 0912ee04eac..00000000000 Binary files a/icons/ui_icons/patches/bandaid_clown.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_colonthree.png b/icons/ui_icons/patches/bandaid_colonthree.png deleted file mode 100644 index ffc7146cca4..00000000000 Binary files a/icons/ui_icons/patches/bandaid_colonthree.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_exclaimationpoint.png b/icons/ui_icons/patches/bandaid_exclaimationpoint.png deleted file mode 100644 index a6a423aa20b..00000000000 Binary files a/icons/ui_icons/patches/bandaid_exclaimationpoint.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_mix.png b/icons/ui_icons/patches/bandaid_mix.png deleted file mode 100644 index 1d5c03bfef6..00000000000 Binary files a/icons/ui_icons/patches/bandaid_mix.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_monke.png b/icons/ui_icons/patches/bandaid_monke.png deleted file mode 100644 index d1083aa932f..00000000000 Binary files a/icons/ui_icons/patches/bandaid_monke.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_msic.png b/icons/ui_icons/patches/bandaid_msic.png deleted file mode 100644 index ab7860c080c..00000000000 Binary files a/icons/ui_icons/patches/bandaid_msic.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_questionmark.png b/icons/ui_icons/patches/bandaid_questionmark.png deleted file mode 100644 index 99382b208ae..00000000000 Binary files a/icons/ui_icons/patches/bandaid_questionmark.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_suffocation.png b/icons/ui_icons/patches/bandaid_suffocation.png deleted file mode 100644 index 802baa07a8d..00000000000 Binary files a/icons/ui_icons/patches/bandaid_suffocation.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_suffocation_2.png b/icons/ui_icons/patches/bandaid_suffocation_2.png deleted file mode 100644 index 20d4223ecd7..00000000000 Binary files a/icons/ui_icons/patches/bandaid_suffocation_2.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_toxin.png b/icons/ui_icons/patches/bandaid_toxin.png deleted file mode 100644 index 3a2fce33f0f..00000000000 Binary files a/icons/ui_icons/patches/bandaid_toxin.png and /dev/null differ diff --git a/icons/ui_icons/patches/bandaid_toxin_2.png b/icons/ui_icons/patches/bandaid_toxin_2.png deleted file mode 100644 index c40331e789d..00000000000 Binary files a/icons/ui_icons/patches/bandaid_toxin_2.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill1.png b/icons/ui_icons/pills/pill1.png deleted file mode 100644 index e5545302761..00000000000 Binary files a/icons/ui_icons/pills/pill1.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill10.png b/icons/ui_icons/pills/pill10.png deleted file mode 100644 index bb0c5f1df71..00000000000 Binary files a/icons/ui_icons/pills/pill10.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill11.png b/icons/ui_icons/pills/pill11.png deleted file mode 100644 index d07d604b34d..00000000000 Binary files a/icons/ui_icons/pills/pill11.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill12.png b/icons/ui_icons/pills/pill12.png deleted file mode 100644 index 912ce1c19e0..00000000000 Binary files a/icons/ui_icons/pills/pill12.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill13.png b/icons/ui_icons/pills/pill13.png deleted file mode 100644 index 4920af9e248..00000000000 Binary files a/icons/ui_icons/pills/pill13.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill14.png b/icons/ui_icons/pills/pill14.png deleted file mode 100644 index aff03f20610..00000000000 Binary files a/icons/ui_icons/pills/pill14.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill15.png b/icons/ui_icons/pills/pill15.png deleted file mode 100644 index 041b5be4b6b..00000000000 Binary files a/icons/ui_icons/pills/pill15.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill16.png b/icons/ui_icons/pills/pill16.png deleted file mode 100644 index 745151051b2..00000000000 Binary files a/icons/ui_icons/pills/pill16.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill17.png b/icons/ui_icons/pills/pill17.png deleted file mode 100644 index fcd92288ad9..00000000000 Binary files a/icons/ui_icons/pills/pill17.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill18.png b/icons/ui_icons/pills/pill18.png deleted file mode 100644 index 9d730172a8e..00000000000 Binary files a/icons/ui_icons/pills/pill18.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill19.png b/icons/ui_icons/pills/pill19.png deleted file mode 100644 index 1e3773404d6..00000000000 Binary files a/icons/ui_icons/pills/pill19.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill2.png b/icons/ui_icons/pills/pill2.png deleted file mode 100644 index e8ed754a6d3..00000000000 Binary files a/icons/ui_icons/pills/pill2.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill20.png b/icons/ui_icons/pills/pill20.png deleted file mode 100644 index aa77c3e41be..00000000000 Binary files a/icons/ui_icons/pills/pill20.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill21.png b/icons/ui_icons/pills/pill21.png deleted file mode 100644 index 37a4512d15d..00000000000 Binary files a/icons/ui_icons/pills/pill21.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill22.png b/icons/ui_icons/pills/pill22.png deleted file mode 100644 index 374de4d58fc..00000000000 Binary files a/icons/ui_icons/pills/pill22.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill3.png b/icons/ui_icons/pills/pill3.png deleted file mode 100644 index e0c812fd0a4..00000000000 Binary files a/icons/ui_icons/pills/pill3.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill4.png b/icons/ui_icons/pills/pill4.png deleted file mode 100644 index 5e02dd0d3e0..00000000000 Binary files a/icons/ui_icons/pills/pill4.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill5.png b/icons/ui_icons/pills/pill5.png deleted file mode 100644 index f9025d0995f..00000000000 Binary files a/icons/ui_icons/pills/pill5.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill6.png b/icons/ui_icons/pills/pill6.png deleted file mode 100644 index 2dbf3720142..00000000000 Binary files a/icons/ui_icons/pills/pill6.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill7.png b/icons/ui_icons/pills/pill7.png deleted file mode 100644 index 7c1ff90c43f..00000000000 Binary files a/icons/ui_icons/pills/pill7.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill8.png b/icons/ui_icons/pills/pill8.png deleted file mode 100644 index 88280ecd045..00000000000 Binary files a/icons/ui_icons/pills/pill8.png and /dev/null differ diff --git a/icons/ui_icons/pills/pill9.png b/icons/ui_icons/pills/pill9.png deleted file mode 100644 index 732cd4ef4c8..00000000000 Binary files a/icons/ui_icons/pills/pill9.png and /dev/null differ diff --git a/tgstation.dme b/tgstation.dme index fd85c81a531..1ae1bcaa6c1 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -608,6 +608,7 @@ #include "code\_globalvars\lists\mobs.dm" #include "code\_globalvars\lists\names.dm" #include "code\_globalvars\lists\objects.dm" +#include "code\_globalvars\lists\plumbing.dm" #include "code\_globalvars\lists\poll_ignore.dm" #include "code\_globalvars\lists\quirks.dm" #include "code\_globalvars\lists\rcd.dm" @@ -3238,10 +3239,8 @@ #include "code\modules\asset_cache\assets\orbit.dm" #include "code\modules\asset_cache\assets\paper.dm" #include "code\modules\asset_cache\assets\particle_editor.dm" -#include "code\modules\asset_cache\assets\patches.dm" #include "code\modules\asset_cache\assets\pda.dm" #include "code\modules\asset_cache\assets\permissions.dm" -#include "code\modules\asset_cache\assets\pills.dm" #include "code\modules\asset_cache\assets\pipes.dm" #include "code\modules\asset_cache\assets\plane_debug.dm" #include "code\modules\asset_cache\assets\plumbing.dm" diff --git a/tgui/packages/tgui/interfaces/ChemPress.tsx b/tgui/packages/tgui/interfaces/ChemPress.tsx new file mode 100644 index 00000000000..d2a7f0ef885 --- /dev/null +++ b/tgui/packages/tgui/interfaces/ChemPress.tsx @@ -0,0 +1,112 @@ +import { useBackend, useLocalState } from '../backend'; +import { Box, Button, Input, LabeledList, NumberInput, Section } from '../components'; +import { capitalizeAll } from 'common/string'; +import { Window } from '../layouts'; + +type Product = { + ref: string; + class_name: string; +}; + +type Category = { + cat_name: string; + products: Product[]; +}; + +type Data = { + current_volume: Number; + product_name: string; + min_volume: Number; + max_volume: Number; + packaging_category: string; + packaging_types: Category[]; + packaging_type: string; +}; + +export const ChemPress = (props, context) => { + const { act, data } = useBackend(context); + const { + current_volume, + product_name, + min_volume, + max_volume, + packaging_category, + packaging_types, + packaging_type, + } = data; + const [categoryName, setCategoryName] = useLocalState( + context, + 'categoryName', + packaging_category + ); + const shownCategory = + packaging_types.find((category) => category.cat_name === categoryName) || + packaging_types[0]; + return ( + + +
+ + + {packaging_types.map((category, i) => ( + setCategoryName(category.cat_name)} + /> + ))} + + + + act('change_current_volume', { + volume: value, + }) + } + /> + + + + act('change_product_name', { + name: value, + }) + } + /> + + + {shownCategory.products.map((design, j) => ( + + ))} + + +
+
+
+ ); +};