From 522b8383d8addd4f1503768b7d0ad92f1fe4a53b Mon Sep 17 00:00:00 2001 From: ACCount Date: Tue, 19 Dec 2017 07:55:01 +0300 Subject: [PATCH] [READY]Refactors reagent container types --- code/__DEFINES/reagents.dm | 41 ++- code/game/atoms.dm | 60 +-- code/game/machinery/limbgrower.dm | 2 +- code/game/objects/items/cigs_lighters.dm | 4 +- code/game/objects/items/extinguisher.dm | 7 +- .../objects/items/implants/implant_chem.dm | 2 +- code/game/objects/items/tanks/watertank.dm | 4 +- code/game/objects/items/tools/weldingtool.dm | 347 ++++++++++++++++++ code/game/objects/structures/janicart.dm | 2 +- code/game/objects/structures/mop_bucket.dm | 20 + code/game/objects/structures/watercloset.dm | 6 +- code/modules/crafting/craft.dm | 2 +- .../detectivework/footprints_and_rag.dm | 2 +- code/modules/food_and_drinks/drinks/drinks.dm | 51 +-- code/modules/food_and_drinks/food.dm | 2 +- .../modules/food_and_drinks/food/condiment.dm | 6 +- .../food_and_drinks/food/customizables.dm | 2 +- code/modules/food_and_drinks/food/snacks.dm | 2 +- .../kitchen_machinery/deep_fryer.dm | 2 +- .../kitchen_machinery/food_cart.dm | 4 +- .../kitchen_machinery/icecream_vat.dm | 4 +- .../kitchen_machinery/microwave.dm | 6 +- code/modules/hydroponics/hydroitemdefines.dm | 12 - code/modules/hydroponics/hydroponics.dm | 4 +- .../integrated_electronics/passive/power.dm | 2 +- .../subtypes/reagents.dm | 23 +- code/modules/mob/living/living.dm | 9 +- code/modules/paperwork/pen.dm | 2 +- .../projectiles/ammunition/ammo_casings.dm | 6 + .../projectiles/guns/energy/special.dm | 1 - code/modules/reagents/chemistry/holder.dm | 13 + .../chemistry/machinery/chem_dispenser.dm | 2 +- .../chemistry/machinery/chem_heater.dm | 2 +- .../chemistry/machinery/chem_master.dm | 2 +- .../reagents/chemistry/machinery/pandemic.dm | 2 +- .../chemistry/machinery/reagentgrinder.dm | 2 +- code/modules/reagents/reagent_containers.dm | 13 +- .../reagents/reagent_containers/borghydro.dm | 2 +- .../reagents/reagent_containers/dropper.dm | 2 +- .../reagents/reagent_containers/glass.dm | 40 +- .../reagents/reagent_containers/hypospray.dm | 4 +- .../reagents/reagent_containers/pill.dm | 11 +- .../reagents/reagent_containers/spray.dm | 16 +- .../reagents/reagent_containers/syringes.dm | 9 +- code/modules/reagents/reagent_dispenser.dm | 12 +- code/modules/research/circuitprinter.dm | 2 +- .../departmental_circuit_imprinter.dm | 2 +- code/modules/research/departmental_lathe.dm | 2 +- code/modules/research/protolathe.dm | 2 +- code/modules/research/rdmachines.dm | 2 +- .../research/xenobiology/xenobiology.dm | 2 +- 51 files changed, 577 insertions(+), 204 deletions(-) diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index c85365db90..d9e6225eb7 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -1,19 +1,30 @@ -#define SOLID 1 -#define LIQUID 2 -#define GAS 3 +#define SOLID 1 +#define LIQUID 2 +#define GAS 3 -#define INJECTABLE_1 1024 //Makes reagents addable through droppers and syringes -#define DRAWABLE_1 2048 //If a syringe can draw from it -#define OPENCONTAINER_1 4096 //Is an open container for chemistry purposes -#define TRANSPARENT_1 8192 //Used for non-open containers which you still want to be able to see the reagents off. -#define TOUCH 1 //splashing -#define INGEST 2 //ingestion -#define VAPOR 3 //foam, spray, blob attack -#define PATCH 4 //patches -#define INJECT 5 //injection +// container_type defines +#define INJECTABLE 1 // Makes it possible to add reagents through droppers and syringes. +#define DRAWABLE 2 // Makes it possible to remove reagents through syringes. + +#define REFILLABLE 4 // Makes it possible to add reagents through any reagent container. +#define DRAINABLE 8 // Makes it possible to remove reagents through any reagent container. + +#define TRANSPARENT 16 // Used on containers which you want to be able to see the reagents off. +#define AMOUNT_VISIBLE 32 // For non-transparent containers that still have the general amount of reagents in them visible. + +// Is an open container for all intents and purposes. +#define OPENCONTAINER REFILLABLE | DRAINABLE | TRANSPARENT + + +#define TOUCH 1 // splashing +#define INGEST 2 // ingestion +#define VAPOR 3 // foam, spray, blob attack +#define PATCH 4 // patches +#define INJECT 5 // injection + //defines passed through to the on_reagent_change proc -#define DEL_REAGENT 1 //reagent deleted (fully cleared) -#define ADD_REAGENT 2 // reagent added -#define REM_REAGENT 3 // reagent removed (may still exist) +#define DEL_REAGENT 1 // reagent deleted (fully cleared) +#define ADD_REAGENT 2 // reagent added +#define REM_REAGENT 3 // reagent removed (may still exist) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index b7d377fb61..211f9dea59 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -194,27 +194,22 @@ set waitfor = FALSE return -// Convenience proc to see if a container is open for chemistry handling -// returns true if open -// false if closed +// Convenience procs to see if a container is open for chemistry handling /atom/proc/is_open_container() - return container_type & OPENCONTAINER_1 - -/atom/proc/is_transparent() - return container_type & TRANSPARENT_1 + return is_refillable() && is_drainable() /atom/proc/is_injectable(allowmobs = TRUE) - if(isliving(src) && allowmobs) - var/mob/living/L = src - return L.can_inject() - if(container_type & OPENCONTAINER_1) - return TRUE - return container_type & INJECTABLE_1 + return reagents && (container_type & (INJECTABLE | REFILLABLE)) /atom/proc/is_drawable(allowmobs = TRUE) - if(is_injectable(allowmobs)) //Everything that can be injected can also be drawn from, but not vice versa - return TRUE - return container_type & DRAWABLE_1 + return reagents && (container_type & (DRAWABLE | DRAINABLE)) + +/atom/proc/is_refillable() + return reagents && (container_type & REFILLABLE) + +/atom/proc/is_drainable() + return reagents && (container_type & DRAINABLE) + /atom/proc/AllowDrop() return FALSE @@ -256,19 +251,26 @@ if(desc) to_chat(user, desc) - if(reagents && (is_open_container() || is_transparent())) //is_open_container() isn't really the right proc for this, but w/e - to_chat(user, "It contains:") - if(reagents.reagent_list.len) - if(user.can_see_reagents()) //Show each individual reagent - for(var/datum/reagent/R in reagents.reagent_list) - to_chat(user, "[R.volume] units of [R.name]") - else //Otherwise, just show the total volume - var/total_volume = 0 - for(var/datum/reagent/R in reagents.reagent_list) - total_volume += R.volume - to_chat(user, "[total_volume] units of various reagents") - else - to_chat(user, "Nothing.") + if(reagents) + if(container_type & TRANSPARENT) + to_chat(user, "It contains:") + if(reagents.reagent_list.len) + if(user.can_see_reagents()) //Show each individual reagent + for(var/datum/reagent/R in reagents.reagent_list) + to_chat(user, "[R.volume] units of [R.name]") + else //Otherwise, just show the total volume + var/total_volume = 0 + for(var/datum/reagent/R in reagents.reagent_list) + total_volume += R.volume + to_chat(user, "[total_volume] units of various reagents") + else + to_chat(user, "Nothing.") + else if(container_type & AMOUNT_VISIBLE) + if(reagents.total_volume) + to_chat(user, "It has [reagents.total_volume] unit\s left.") + else + to_chat(user, "It's empty.") + SendSignal(COMSIG_PARENT_EXAMINE, user) /atom/proc/relaymove(mob/user) diff --git a/code/game/machinery/limbgrower.dm b/code/game/machinery/limbgrower.dm index 47fee66b9e..e661bc24c5 100644 --- a/code/game/machinery/limbgrower.dm +++ b/code/game/machinery/limbgrower.dm @@ -10,7 +10,7 @@ icon = 'icons/obj/machines/limbgrower.dmi' icon_state = "limbgrower_idleoff" density = TRUE - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER anchored = TRUE use_power = IDLE_POWER_USE idle_power_usage = 10 diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index 9c7c34510c..ee0aa2c63c 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -102,7 +102,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "cigoff" throw_speed = 0.5 item_state = "cigoff" - container_type = INJECTABLE_1 + container_type = INJECTABLE w_class = WEIGHT_CLASS_TINY body_parts_covered = null grind_results = list() @@ -659,7 +659,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM item_state = "[param_color]_vape" /obj/item/clothing/mask/vape/attackby(obj/item/O, mob/user, params) - if(istype(O, /obj/item/reagent_containers) && (O.container_type & OPENCONTAINER_1)) + if(O.is_drainable()) if(reagents.total_volume < chem_volume) if(O.reagents.total_volume > 0) O.reagents.trans_to(src,25) diff --git a/code/game/objects/items/extinguisher.dm b/code/game/objects/items/extinguisher.dm index d334d12193..5f582b9e15 100644 --- a/code/game/objects/items/extinguisher.dm +++ b/code/game/objects/items/extinguisher.dm @@ -16,6 +16,7 @@ attack_verb = list("slammed", "whacked", "bashed", "thunked", "battered", "bludgeoned", "thrashed") dog_fashion = /datum/dog_fashion/back resistance_flags = FIRE_PROOF + container_type = AMOUNT_VISIBLE var/max_water = 50 var/last_use = 1 var/safety = TRUE @@ -48,7 +49,6 @@ /obj/item/extinguisher/attack_self(mob/user) safety = !safety src.icon_state = "[sprite_name][!safety]" - src.desc = "The safety is [safety ? "on" : "off"]." to_chat(user, "The safety is [safety ? "on" : "off"].") return @@ -67,11 +67,10 @@ /obj/item/extinguisher/examine(mob/user) ..() + to_chat(user, "The safety is [safety ? "on" : "off"].") + if(reagents.total_volume) - to_chat(user, "It contains [round(reagents.total_volume)] unit\s.") to_chat(user, "Alt-click to empty it.") - else - to_chat(user, "It is empty.") /obj/item/extinguisher/proc/AttemptRefill(atom/target, mob/user) if(istype(target, /obj/structure/reagent_dispensers/watertank) && target.Adjacent(user)) diff --git a/code/game/objects/items/implants/implant_chem.dm b/code/game/objects/items/implants/implant_chem.dm index 509784a699..e266f3ab09 100644 --- a/code/game/objects/items/implants/implant_chem.dm +++ b/code/game/objects/items/implants/implant_chem.dm @@ -2,7 +2,7 @@ name = "chem implant" desc = "Injects things." icon_state = "reagents" - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER /obj/item/implant/chem/get_data() var/dat = {"Implant Specifications:
diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index fa7d14d572..8a3dc21dbe 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -114,7 +114,7 @@ possible_transfer_amounts = list(25,50,100) volume = 500 flags_1 = NOBLUDGEON_1 - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER slot_flags = 0 var/obj/item/watertank/tank @@ -351,7 +351,7 @@ var/usage_ratio = 5 //5 unit added per 1 removed var/injection_amount = 1 amount_per_transfer_from_this = 5 - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER spillable = FALSE possible_transfer_amounts = list(5,10,15) diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index 1c20c95e93..a09f0d2a1a 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD #define WELDER_FUEL_BURN_INTERVAL 13 /obj/item/weldingtool name = "welding tool" @@ -336,4 +337,350 @@ if(get_fuel() < max_fuel && nextrefueltick < world.time) nextrefueltick = world.time + 10 reagents.add_reagent("welding_fuel", 1) +======= +#define WELDER_FUEL_BURN_INTERVAL 13 +/obj/item/weldingtool + name = "welding tool" + desc = "A standard edition welder provided by Nanotrasen." + icon = 'icons/obj/tools.dmi' + icon_state = "welder" + item_state = "welder" + lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi' + righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi' + flags_1 = CONDUCT_1 + slot_flags = SLOT_BELT + force = 3 + throwforce = 5 + hitsound = "swing_hit" + usesound = 'sound/items/welder.ogg' + var/acti_sound = 'sound/items/welderactivate.ogg' + var/deac_sound = 'sound/items/welderdeactivate.ogg' + throw_speed = 3 + throw_range = 5 + w_class = WEIGHT_CLASS_SMALL + armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 100, acid = 30) + resistance_flags = FIRE_PROOF + + materials = list(MAT_METAL=70, MAT_GLASS=30) + var/welding = 0 //Whether or not the welding tool is off(0), on(1) or currently welding(2) + var/status = TRUE //Whether the welder is secured or unsecured (able to attach rods to it to make a flamethrower) + var/max_fuel = 20 //The max amount of fuel the welder can hold + var/change_icons = 1 + var/can_off_process = 0 + var/light_intensity = 2 //how powerful the emitted light is when used. + var/burned_fuel_for = 0 //when fuel was last removed + heat = 3800 + toolspeed = 1 + +/obj/item/weldingtool/Initialize() + . = ..() + create_reagents(max_fuel) + reagents.add_reagent("welding_fuel", max_fuel) + update_icon() + + +/obj/item/weldingtool/proc/update_torch() + if(welding) + add_overlay("[initial(icon_state)]-on") + item_state = "[initial(item_state)]1" + else + item_state = "[initial(item_state)]" + + +/obj/item/weldingtool/update_icon() + cut_overlays() + if(change_icons) + var/ratio = get_fuel() / max_fuel + ratio = CEILING(ratio*4, 1) * 25 + add_overlay("[initial(icon_state)][ratio]") + update_torch() + return + + +/obj/item/weldingtool/process() + switch(welding) + if(0) + force = 3 + damtype = "brute" + update_icon() + if(!can_off_process) + STOP_PROCESSING(SSobj, src) + return + //Welders left on now use up fuel, but lets not have them run out quite that fast + if(1) + force = 15 + damtype = "fire" + ++burned_fuel_for + if(burned_fuel_for >= WELDER_FUEL_BURN_INTERVAL) + remove_fuel(1) + update_icon() + + //This is to start fires. process() is only called if the welder is on. + open_flame() + + +/obj/item/weldingtool/suicide_act(mob/user) + user.visible_message("[user] welds [user.p_their()] every orifice closed! It looks like [user.p_theyre()] trying to commit suicide!") + return (FIRELOSS) + + +/obj/item/weldingtool/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/screwdriver)) + flamethrower_screwdriver(I, user) + else if(istype(I, /obj/item/stack/rods)) + flamethrower_rods(I, user) + else + . = ..() + update_icon() + +/obj/item/weldingtool/proc/explode() + var/turf/T = get_turf(loc) + var/plasmaAmount = reagents.get_reagent_amount("plasma") + dyn_explosion(T, plasmaAmount/5)//20 plasma in a standard welder has a 4 power explosion. no breaches, but enough to kill/dismember holder + qdel(src) + +/obj/item/weldingtool/attack(mob/living/carbon/human/H, mob/user) + if(!istype(H)) + return ..() + + var/obj/item/bodypart/affecting = H.get_bodypart(check_zone(user.zone_selected)) + + if(affecting && affecting.status == BODYPART_ROBOTIC && user.a_intent != INTENT_HARM) + if(src.remove_fuel(1)) + playsound(loc, usesound, 50, 1) + if(user == H) + user.visible_message("[user] starts to fix some of the dents on [H]'s [affecting.name].", "You start fixing some of the dents on [H]'s [affecting.name].") + if(!do_mob(user, H, 50)) + return + item_heal_robotic(H, user, 15, 0) + else + return ..() + + +/obj/item/weldingtool/afterattack(atom/O, mob/user, proximity) + if(!proximity) + return + if(!status && O.is_refillable()) + reagents.trans_to(O, reagents.total_volume) + to_chat(user, "You empty [src]'s fuel tank into [O].") + update_icon() + if(welding) + remove_fuel(1) + var/turf/location = get_turf(user) + location.hotspot_expose(700, 50, 1) + if(get_fuel() <= 0) + set_light(0) + + if(isliving(O)) + var/mob/living/L = O + if(L.IgniteMob()) + message_admins("[key_name_admin(user)] set [key_name_admin(L)] on fire") + log_game("[key_name(user)] set [key_name(L)] on fire") + + +/obj/item/weldingtool/attack_self(mob/user) + if(src.reagents.has_reagent("plasma")) + message_admins("[key_name_admin(user)] activated a rigged welder.") + explode() + switched_on(user) + if(welding) + set_light(light_intensity) + + update_icon() + + +//Returns the amount of fuel in the welder +/obj/item/weldingtool/proc/get_fuel() + return reagents.get_reagent_amount("welding_fuel") + + +//Removes fuel from the welding tool. If a mob is passed, it will try to flash the mob's eyes. This should probably be renamed to use() +/obj/item/weldingtool/proc/remove_fuel(amount = 1, mob/living/M = null) + if(!welding || !check_fuel()) + return 0 + if(amount) + burned_fuel_for = 0 + if(get_fuel() >= amount) + reagents.remove_reagent("welding_fuel", amount) + check_fuel() + if(M) + M.flash_act(light_intensity) + return TRUE + else + if(M) + to_chat(M, "You need more welding fuel to complete this task!") + return FALSE + + +//Turns off the welder if there is no more fuel (does this really need to be its own proc?) +/obj/item/weldingtool/proc/check_fuel(mob/user) + if(get_fuel() <= 0 && welding) + switched_on(user) + update_icon() + //mob icon update + if(ismob(loc)) + var/mob/M = loc + M.update_inv_hands(0) + + return 0 + return 1 + +//Switches the welder on +/obj/item/weldingtool/proc/switched_on(mob/user) + if(!status) + to_chat(user, "[src] can't be turned on while unsecured!") + return + welding = !welding + if(welding) + if(get_fuel() >= 1) + to_chat(user, "You switch [src] on.") + playsound(loc, acti_sound, 50, 1) + force = 15 + damtype = "fire" + hitsound = 'sound/items/welder.ogg' + update_icon() + START_PROCESSING(SSobj, src) + else + to_chat(user, "You need more fuel!") + switched_off(user) + else + to_chat(user, "You switch [src] off.") + playsound(loc, deac_sound, 50, 1) + switched_off(user) + +//Switches the welder off +/obj/item/weldingtool/proc/switched_off(mob/user) + welding = 0 + set_light(0) + + force = 3 + damtype = "brute" + hitsound = "swing_hit" + update_icon() + + +/obj/item/weldingtool/examine(mob/user) + ..() + to_chat(user, "It contains [get_fuel()] unit\s of fuel out of [max_fuel].") + +/obj/item/weldingtool/is_hot() + return welding * heat + +//Returns whether or not the welding tool is currently on. +/obj/item/weldingtool/proc/isOn() + return welding + + +/obj/item/weldingtool/proc/flamethrower_screwdriver(obj/item/I, mob/user) + if(welding) + to_chat(user, "Turn it off first!") + return + status = !status + if(status) + to_chat(user, "You resecure [src] and close the fuel tank.") + container_type = NONE + else + to_chat(user, "[src] can now be attached, modified, and refuelled.") + container_type = OPENCONTAINER + add_fingerprint(user) + +/obj/item/weldingtool/proc/flamethrower_rods(obj/item/I, mob/user) + if(!status) + var/obj/item/stack/rods/R = I + if (R.use(1)) + var/obj/item/flamethrower/F = new /obj/item/flamethrower(user.loc) + if(!remove_item_from_storage(F)) + user.transferItemToLoc(src, F, TRUE) + F.weldtool = src + add_fingerprint(user) + to_chat(user, "You add a rod to a welder, starting to build a flamethrower.") + user.put_in_hands(F) + else + to_chat(user, "You need one rod to start building a flamethrower!") + +/obj/item/weldingtool/ignition_effect(atom/A, mob/user) + if(welding && remove_fuel(1, user)) + . = "[user] casually lights [A] with [src], what a badass." + else + . = "" + +/obj/item/weldingtool/largetank + name = "industrial welding tool" + desc = "A slightly larger welder with a larger tank." + icon_state = "indwelder" + max_fuel = 40 + materials = list(MAT_GLASS=60) + +/obj/item/weldingtool/largetank/cyborg + name = "integrated welding tool" + desc = "An advanced welder designed to be used in robotic systems." + toolspeed = 0.5 + +/obj/item/weldingtool/largetank/flamethrower_screwdriver() + return + + +/obj/item/weldingtool/mini + name = "emergency welding tool" + desc = "A miniature welder used during emergencies." + icon_state = "miniwelder" + max_fuel = 10 + w_class = WEIGHT_CLASS_TINY + materials = list(MAT_METAL=30, MAT_GLASS=10) + change_icons = 0 + +/obj/item/weldingtool/mini/flamethrower_screwdriver() + return + +/obj/item/weldingtool/abductor + name = "alien welding tool" + desc = "An alien welding tool. Whatever fuel it uses, it never runs out." + icon = 'icons/obj/abductor.dmi' + icon_state = "welder" + toolspeed = 0.1 + light_intensity = 0 + change_icons = 0 + +/obj/item/weldingtool/abductor/process() + if(get_fuel() <= max_fuel) + reagents.add_reagent("welding_fuel", 1) + ..() + +/obj/item/weldingtool/hugetank + name = "upgraded industrial welding tool" + desc = "An upgraded welder based of the industrial welder." + icon_state = "upindwelder" + item_state = "upindwelder" + max_fuel = 80 + materials = list(MAT_METAL=70, MAT_GLASS=120) + +/obj/item/weldingtool/experimental + name = "experimental welding tool" + desc = "An experimental welder capable of self-fuel generation and less harmful to the eyes." + icon_state = "exwelder" + item_state = "exwelder" + max_fuel = 40 + materials = list(MAT_METAL=70, MAT_GLASS=120) + var/last_gen = 0 + change_icons = 0 + can_off_process = 1 + light_intensity = 1 + toolspeed = 0.5 + var/nextrefueltick = 0 + +/obj/item/weldingtool/experimental/brass + name = "brass welding tool" + desc = "A brass welder that seems to constantly refuel itself. It is faintly warm to the touch." + resistance_flags = FIRE_PROOF | ACID_PROOF + icon_state = "brasswelder" + item_state = "brasswelder" + + +/obj/item/weldingtool/experimental/process() + ..() + if(get_fuel() < max_fuel && nextrefueltick < world.time) + nextrefueltick = world.time + 10 + reagents.add_reagent("welding_fuel", 1) + +>>>>>>> 40699a8... [READY]Refactors reagent container types (#33470) #undef WELDER_FUEL_BURN_INTERVAL \ No newline at end of file diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index b6332492dd..0f12f847d7 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -5,7 +5,7 @@ icon_state = "cart" anchored = FALSE density = TRUE - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER //copypaste sorry var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite var/obj/item/storage/bag/trash/mybag = null diff --git a/code/game/objects/structures/mop_bucket.dm b/code/game/objects/structures/mop_bucket.dm index b2dc64fec7..43da5073ed 100644 --- a/code/game/objects/structures/mop_bucket.dm +++ b/code/game/objects/structures/mop_bucket.dm @@ -4,6 +4,7 @@ icon = 'icons/obj/janitor.dmi' icon_state = "mopbucket" density = TRUE +<<<<<<< HEAD container_type = OPENCONTAINER_1 var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite @@ -21,4 +22,23 @@ to_chat(user, "You wet [I] in [src].") playsound(loc, 'sound/effects/slosh.ogg', 25, 1) else +======= + container_type = OPENCONTAINER + var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite + + +/obj/structure/mopbucket/New() + create_reagents(100) + ..() + +/obj/structure/mopbucket/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/mop)) + if(reagents.total_volume < 1) + to_chat(user, "[src] is out of water!") + else + reagents.trans_to(I, 5) + to_chat(user, "You wet [I] in [src].") + playsound(loc, 'sound/effects/slosh.ogg', 25, 1) + else +>>>>>>> 40699a8... [READY]Refactors reagent container types (#33470) return ..() \ No newline at end of file diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 9009a7171d..77b992704a 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -483,9 +483,9 @@ if(istype(O, /obj/item/reagent_containers)) var/obj/item/reagent_containers/RG = O - if(RG.container_type & OPENCONTAINER_1) + if(RG.is_refillable()) if(!RG.reagents.holder_full()) - RG.reagents.add_reagent("[dispensedreagent]", min(RG.volume - RG.reagents.total_volume, RG.amount_per_transfer_from_this)) + RG.reagents.add_reagent(dispensedreagent, min(RG.volume - RG.reagents.total_volume, RG.amount_per_transfer_from_this)) to_chat(user, "You fill [RG] from [src].") return TRUE to_chat(user, "\The [RG] is full.") @@ -533,7 +533,7 @@ O.clean_blood() O.acid_level = 0 create_reagents(5) - reagents.add_reagent("[dispensedreagent]", 5) + reagents.add_reagent(dispensedreagent, 5) reagents.reaction(O, TOUCH) user.visible_message("[user] washes [O] using [src].", \ "You wash [O] using [src].") diff --git a/code/modules/crafting/craft.dm b/code/modules/crafting/craft.dm index 3e4e93ca4c..85ae7c3b18 100644 --- a/code/modules/crafting/craft.dm +++ b/code/modules/crafting/craft.dm @@ -98,7 +98,7 @@ else if(istype(I, /obj/item/reagent_containers)) var/obj/item/reagent_containers/RC = I - if(RC.container_type & OPENCONTAINER_1) + if(RC.is_drainable()) for(var/datum/reagent/A in RC.reagents.reagent_list) .[A.type] += A.volume .[I.type] += 1 diff --git a/code/modules/detectivework/footprints_and_rag.dm b/code/modules/detectivework/footprints_and_rag.dm index 9415bef33d..793805977c 100644 --- a/code/modules/detectivework/footprints_and_rag.dm +++ b/code/modules/detectivework/footprints_and_rag.dm @@ -13,7 +13,7 @@ icon = 'icons/obj/toy.dmi' icon_state = "rag" flags_1 = NOBLUDGEON_1 - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER amount_per_transfer_from_this = 5 possible_transfer_amounts = list() volume = 5 diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 6fb712ea41..c03b183ecc 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -8,7 +8,7 @@ icon_state = null lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi' righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi' - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER var/gulp_size = 5 //This is now officially broken ... need to think of a nice way to fix it. possible_transfer_amounts = list(5,10,15,20,25,30,50) volume = 50 @@ -30,7 +30,7 @@ if(!canconsume(M, user)) return 0 - if (!is_open_container()) + if (!is_drainable()) to_chat(user, "[src]'s lid hasn't been opened!") return 0 @@ -44,7 +44,7 @@ if(!reagents || !reagents.total_volume) return // The drink might be empty after the delay, such as by spam-feeding M.visible_message("[user] feeds the contents of [src] to [M].", "[user] feeds the contents of [src] to [M].") - add_logs(user, M, "fed", reagentlist(src)) + add_logs(user, M, "fed", reagents.log_list()) var/fraction = min(gulp_size/reagents.total_volume, 1) checkLiked(fraction, M) @@ -56,31 +56,16 @@ /obj/item/reagent_containers/food/drinks/afterattack(obj/target, mob/user , proximity) if(!proximity) return - if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us. - if (!is_open_container()) - to_chat(user, "[target]'s tab isn't open!") - return - - if(!target.reagents.total_volume) - to_chat(user, "[target] is empty.") - return - - if(reagents.total_volume >= reagents.maximum_volume) - to_chat(user, "[src] is full.") - return - - var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) - to_chat(user, "You fill [src] with [trans] units of the contents of [target].") - - else if(target.is_open_container()) //Something like a glass. Player probably wants to transfer TO it. + if(target.is_refillable()) //Something like a glass. Player probably wants to transfer TO it. if(!reagents.total_volume) to_chat(user, "[src] is empty.") return - if(target.reagents.total_volume >= target.reagents.maximum_volume) + if(target.reagents.holder_full()) to_chat(user, "[target] is full.") return + var/refill = reagents.get_master_reagent_id() var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this) to_chat(user, "You transfer [trans] units of the solution to [target].") @@ -90,6 +75,24 @@ bro.cell.use(30) addtimer(CALLBACK(reagents, /datum/reagents.proc/add_reagent, refill, trans), 600) + else if(target.is_drainable()) //A dispenser. Transfer FROM it TO us. + if (!is_refillable()) + to_chat(user, "[src]'s tab isn't open!") + return + + if(!target.reagents.total_volume) + to_chat(user, "[target] is empty.") + return + + if(reagents.holder_full()) + to_chat(user, "[src] is full.") + return + + var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) + to_chat(user, "You fill [src] with [trans] units of the contents of [target].") + + else + /obj/item/reagent_containers/food/drinks/attackby(obj/item/I, mob/user, params) if(I.is_hot()) var/added_heat = (I.is_hot() / 100) //ishot returns a temperature @@ -142,7 +145,7 @@ possible_transfer_amounts = list() volume = 5 flags_1 = CONDUCT_1 - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER spillable = TRUE resistance_flags = FIRE_PROOF isGlass = FALSE @@ -406,9 +409,9 @@ /obj/item/reagent_containers/food/drinks/soda_cans/attack_self(mob/user) - if(!is_open_container()) + if(!is_drainable()) to_chat(user, "You pull back the tab of \the [src] with a satisfying pop.") //Ahhhhhhhh - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER playsound(src, "can_open", 50, 1) spillable = TRUE return diff --git a/code/modules/food_and_drinks/food.dm b/code/modules/food_and_drinks/food.dm index e23f6b98a9..765f118c5e 100644 --- a/code/modules/food_and_drinks/food.dm +++ b/code/modules/food_and_drinks/food.dm @@ -4,7 +4,7 @@ /obj/item/reagent_containers/food possible_transfer_amounts = list() volume = 50 //Sets the default container amount for all food items. - container_type = INJECTABLE_1 + container_type = INJECTABLE resistance_flags = FLAMMABLE var/foodtype = NONE var/last_check_time diff --git a/code/modules/food_and_drinks/food/condiment.dm b/code/modules/food_and_drinks/food/condiment.dm index 3e6e2e8450..445e8e6534 100644 --- a/code/modules/food_and_drinks/food/condiment.dm +++ b/code/modules/food_and_drinks/food/condiment.dm @@ -10,7 +10,7 @@ desc = "Just your average condiment container." icon = 'icons/obj/food/containers.dmi' icon_state = "emptycondiment" - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER possible_transfer_amounts = list(1, 5, 10, 15, 20, 25, 30, 50) volume = 50 //Possible_states has the reagent id as key and a list of, in order, the icon_state, the name and the desc as values. Used in the on_reagent_change(changetype) to change names, descs and sprites. @@ -45,7 +45,7 @@ if(!reagents || !reagents.total_volume) return // The condiment might be empty after the delay. user.visible_message("[user] feeds [M] from [src].") - add_logs(user, M, "fed", reagentlist(src)) + add_logs(user, M, "fed", reagents.log_list()) var/fraction = min(10/reagents.total_volume, 1) reagents.reaction(M, INGEST, fraction) @@ -70,7 +70,7 @@ to_chat(user, "You fill [src] with [trans] units of the contents of [target].") //Something like a glass or a food item. Player probably wants to transfer TO it. - else if(target.is_open_container() || istype(target, /obj/item/reagent_containers/food/snacks)) + else if(target.is_drainable() || istype(target, /obj/item/reagent_containers/food/snacks)) if(!reagents.total_volume) to_chat(user, "[src] is empty!") return diff --git a/code/modules/food_and_drinks/food/customizables.dm b/code/modules/food_and_drinks/food/customizables.dm index 3351a67d39..f3460edcaa 100644 --- a/code/modules/food_and_drinks/food/customizables.dm +++ b/code/modules/food_and_drinks/food/customizables.dm @@ -291,7 +291,7 @@ desc = "A simple bowl, used for soups and salads." icon = 'icons/obj/food/soupsalad.dmi' icon_state = "bowl" - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER materials = list(MAT_GLASS = 500) w_class = WEIGHT_CLASS_NORMAL diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index 7f574e0313..08b09124d5 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -94,7 +94,7 @@ if(!do_mob(user, M)) return - add_logs(user, M, "fed", reagentlist(src)) + add_logs(user, M, "fed", reagents.log_list()) M.visible_message("[user] forces [M] to eat [src].", \ "[user] forces [M] to eat [src].") diff --git a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm index a336d77404..40eae1b570 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm @@ -29,7 +29,7 @@ God bless America. anchored = TRUE use_power = IDLE_POWER_USE idle_power_usage = 5 - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER var/obj/item/reagent_containers/food/snacks/deepfryholder/frying //What's being fried RIGHT NOW? var/cook_time = 0 var/oil_use = 0.05 //How much cooking oil is used per tick diff --git a/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm b/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm index 8573a84c9b..26a2bec76f 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm @@ -15,7 +15,7 @@ var/portion = 10 var/selected_drink var/list/stored_food = list() - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER var/obj/item/reagent_containers/mixer /obj/machinery/food_cart/Initialize() @@ -100,7 +100,7 @@ stored_food[sanitize(S.name)]++ else stored_food[sanitize(S.name)] = 1 - else if(O.is_open_container()) + else if(O.is_drainable()) return else . = ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm b/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm index 1b00de1842..f2f288fe7a 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm @@ -14,7 +14,7 @@ anchored = FALSE use_power = NO_POWER_USE layer = BELOW_OBJ_LAYER - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER max_integrity = 300 var/list/product_types = list() var/dispense_flavour = ICECREAM_VANILLA @@ -112,7 +112,7 @@ else to_chat(user, "[O] already has ice cream in it.") return 1 - else if(O.is_open_container()) + else if(O.is_drainable()) return else return ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index dfa249c04d..52ee5ebd2b 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -81,7 +81,7 @@ src.icon_state = "mw" src.broken = 0 // Fix it! src.dirty = 0 // just to be sure - src.container_type = OPENCONTAINER_1 + src.container_type = OPENCONTAINER return 0 //to use some fuel else to_chat(user, "It's broken!") @@ -98,7 +98,7 @@ src.dirty = 0 // It's clean! src.broken = 0 // just to be sure src.icon_state = "mw" - src.container_type = OPENCONTAINER_1 + src.container_type = OPENCONTAINER src.updateUsrDialog() return 1 // Disables the after-attack so we don't spray the floor/user. else @@ -119,7 +119,7 @@ src.dirty = 0 // It's clean! src.broken = 0 // just to be sure src.icon_state = "mw" - src.container_type = OPENCONTAINER_1 + src.container_type = OPENCONTAINER else if(src.dirty==100) // The microwave is all dirty so can't be used! to_chat(user, "It's dirty!") diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm index 42a927f4e9..c72d9e5c28 100644 --- a/code/modules/hydroponics/hydroitemdefines.dm +++ b/code/modules/hydroponics/hydroitemdefines.dm @@ -24,12 +24,6 @@ lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi' volume = 100 - container_type = OPENCONTAINER_1 - slot_flags = SLOT_BELT - throwforce = 0 - w_class = WEIGHT_CLASS_SMALL - throw_speed = 3 - throw_range = 10 /obj/item/reagent_containers/spray/weedspray/Initialize() . = ..() @@ -48,12 +42,6 @@ lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi' volume = 100 - container_type = OPENCONTAINER_1 - slot_flags = SLOT_BELT - throwforce = 0 - w_class = WEIGHT_CLASS_SMALL - throw_speed = 3 - throw_range = 10 /obj/item/reagent_containers/spray/pestspray/Initialize() . = ..() diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 5c1fafc1c4..08cb712542 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -712,8 +712,8 @@ else if(transfer_amount) // Droppers, cans, beakers, what have you. visi_msg="[user] uses [reagent_source] on [target]" irrigate = 1 - // Beakers, bottles, buckets, etc. Can't use is_open_container though. - if(istype(reagent_source, /obj/item/reagent_containers/glass/)) + // Beakers, bottles, buckets, etc. + if(reagent_source.is_drainable()) playsound(loc, 'sound/effects/slosh.ogg', 25, 1) if(irrigate && transfer_amount > 30 && reagent_source.reagents.total_volume >= 30 && using_irrigation) diff --git a/code/modules/integrated_electronics/passive/power.dm b/code/modules/integrated_electronics/passive/power.dm index 0941c033f6..2acce3d450 100644 --- a/code/modules/integrated_electronics/passive/power.dm +++ b/code/modules/integrated_electronics/passive/power.dm @@ -90,7 +90,7 @@ icon_state = "chemical_cell" extended_desc = "This is effectively an internal beaker. It will consume and produce power from plasma, slime jelly, welding fuel, carbon,\ ethanol, nutriments and blood , in order of decreasing efficiency. It will consume fuel only if the battery can take more energy." - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER complexity = 4 inputs = list() outputs = list("volume used" = IC_PINTYPE_NUMBER, "self reference" = IC_PINTYPE_REF) diff --git a/code/modules/integrated_electronics/subtypes/reagents.dm b/code/modules/integrated_electronics/subtypes/reagents.dm index 564c3a4851..b6307471f4 100644 --- a/code/modules/integrated_electronics/subtypes/reagents.dm +++ b/code/modules/integrated_electronics/subtypes/reagents.dm @@ -17,7 +17,7 @@ extended_desc = "This smoke generator creates clouds of smoke on command. It can also hold liquids inside, which will go \ into the smoke clouds when activated. The reagents are consumed when smoke is made." - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER volume = 100 complexity = 20 @@ -66,7 +66,7 @@ extended_desc = "This autoinjector can push reagents into another container or someone else outside of the machine. The target \ must be adjacent to the machine, and if it is a person, they cannot be wearing thick clothing. Negative given amount makes injector suck out reagents." - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER volume = 30 complexity = 20 @@ -145,7 +145,7 @@ return if(direction_mode == SYRINGE_INJECT) - if(!reagents.total_volume || !AM.is_injectable() || AM.reagents.total_volume >= AM.reagents.maximum_volume) + if(!reagents.total_volume || !AM.is_injectable() || AM.reagents.holder_full()) activate_pin(3) return @@ -156,12 +156,8 @@ return //Always log attemped injections for admins - var/list/rinject = list() - for(var/datum/reagent/R in reagents.reagent_list) - rinject += R.name - var/contained = english_list(rinject) - - add_logs(src, L, "attemped to inject", addition="which had [contained]") //TODO: proper logging (maybe last touched and assembled) + var/contained = reagents.log_list() + add_logs(src, L, "attemped to inject", addition="which had [contained]") L.visible_message("[acting_object] is trying to inject [L]!", \ "[acting_object] is trying to inject you!") busy = TRUE @@ -169,6 +165,7 @@ var/fraction = min(transfer_amount/reagents.total_volume, 1) reagents.reaction(L, INJECT, fraction) reagents.trans_to(L, transfer_amount) + add_logs(src, L, "injected", addition="which had [contained]") L.visible_message("[acting_object] injects [L] with its needle!", \ "[acting_object] injects you with its needle!") else @@ -263,8 +260,7 @@ activate_pin(2) return - // FALSE in those procs makes mobs invalid targets. - if(!source.is_drawable(FALSE) || !target.is_injectable(FALSE)) + if(!source.is_drainable() || !target.is_refillable()) return source.reagents.trans_to(target, transfer_amount) @@ -276,7 +272,7 @@ icon_state = "reagent_storage" extended_desc = "This is effectively an internal beaker." - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER volume = 60 complexity = 4 @@ -398,8 +394,7 @@ if(!source.reagents || !target.reagents) return - // FALSE in those procs makes mobs invalid targets. - if(!source.is_drawable(FALSE) || !target.is_injectable(FALSE)) + if(!source.is_drainable() || !target.is_refillable()) return if(target.reagents.maximum_volume - target.reagents.total_volume <= 0) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index f589ecbb20..f07eecd998 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -343,8 +343,15 @@ return 1 return 0 +// Living mobs use can_inject() to make sure that the mob is not syringe-proof in general. /mob/living/proc/can_inject() - return 1 + return TRUE + +/mob/living/is_injectable(allowmobs = TRUE) + return (allowmobs && reagents && can_inject()) + +/mob/living/is_drawable(allowmobs = TRUE) + return (allowmobs && reagents && can_inject()) /mob/living/proc/get_organ_target() var/mob/shooter = src diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm index fd52d8f0ac..cde600186f 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -162,7 +162,7 @@ * Sleepypens */ /obj/item/pen/sleepy - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER /obj/item/pen/sleepy/attack(mob/living/M, mob/user) diff --git a/code/modules/projectiles/ammunition/ammo_casings.dm b/code/modules/projectiles/ammunition/ammo_casings.dm index d51ea36e15..d3ca08dc85 100644 --- a/code/modules/projectiles/ammunition/ammo_casings.dm +++ b/code/modules/projectiles/ammunition/ammo_casings.dm @@ -284,9 +284,15 @@ icon_state = "cshell" projectile_type = /obj/item/projectile/bullet/dart +<<<<<<< HEAD /obj/item/ammo_casing/shotgun/dart/New() ..() container_type |= OPENCONTAINER_1 +======= +/obj/item/ammo_casing/shotgun/dart/Initialize() + . = ..() + container_type |= OPENCONTAINER +>>>>>>> 40699a8... [READY]Refactors reagent container types (#33470) create_reagents(30) reagents.set_reacting(TRUE) diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 06bda36c66..a4ae8cae13 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -121,7 +121,6 @@ item_state = "plasmacutter" ammo_type = list(/obj/item/ammo_casing/energy/plasma) flags_1 = CONDUCT_1 - container_type = OPENCONTAINER_1 attack_verb = list("attacked", "slashed", "cut", "sliced") force = 12 sharpness = IS_SHARP diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 9c4bff72cb..5958dc0eab 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -59,6 +59,19 @@ if(my_atom && my_atom.reagents == src) my_atom.reagents = null + +// Used in attack logs for reagents in pills and such +/datum/reagents/proc/log_list() + if(!length(reagent_list)) + return "no reagents" + + var/list/data = list() + for(var/r in reagent_list) //no reagents will be left behind + var/datum/reagent/R = r + data += "[R.id] ([round(R.volume, 0.1)]u)" + //Using IDs because SOME chemicals (I'm looking at you, chlorhydrate-beer) have the same names as other chemicals. + return english_list(data) + /datum/reagents/proc/remove_any(amount = 1) var/list/cached_reagents = reagent_list var/total_transfered = 0 diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 745843474e..a0e1e64207 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -184,7 +184,7 @@ if(default_unfasten_wrench(user, I)) return - if(istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER_1)) + if(istype(I, /obj/item/reagent_containers) && I.is_open_container()) var/obj/item/reagent_containers/B = I . = 1 //no afterattack if(beaker) diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index a6d958220a..dc21eec6c0 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -64,7 +64,7 @@ if(default_deconstruction_crowbar(I)) return - if(istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER_1)) + if(istype(I, /obj/item/reagent_containers) && I.is_open_container()) . = 1 //no afterattack if(beaker) to_chat(user, "A container is already loaded into [src]!") diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 3e06449e3a..e0c3b23c5a 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -88,7 +88,7 @@ if(default_unfasten_wrench(user, I)) return - if(istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER_1)) + if(istype(I, /obj/item/reagent_containers) && I.is_open_container()) . = 1 // no afterattack if(panel_open) to_chat(user, "You can't use the [src.name] while its panel is opened!") diff --git a/code/modules/reagents/chemistry/machinery/pandemic.dm b/code/modules/reagents/chemistry/machinery/pandemic.dm index f6b0f464fd..ef186d8a79 100644 --- a/code/modules/reagents/chemistry/machinery/pandemic.dm +++ b/code/modules/reagents/chemistry/machinery/pandemic.dm @@ -225,7 +225,7 @@ /obj/machinery/computer/pandemic/attackby(obj/item/I, mob/user, params) - if(istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER_1)) + if(istype(I, /obj/item/reagent_containers) && I.is_open_container()) . = TRUE //no afterattack if(stat & (NOPOWER|BROKEN)) return diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index 223259f6f3..b5d715f5ff 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -62,7 +62,7 @@ if(default_unfasten_wrench(user, I)) return - if (istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER_1) ) + if (istype(I, /obj/item/reagent_containers) && I.is_open_container()) if (!beaker) if(!user.transferItemToLoc(I, src)) to_chat(user, "[I] is stuck to your hand!") diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 8698c10b05..842d2dc2c3 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -48,15 +48,6 @@ /obj/item/reagent_containers/afterattack(obj/target, mob/user , flag) return -/obj/item/reagent_containers/proc/reagentlist(obj/item/reagent_containers/snack) //Attack logs for regents in pills - var/data - if(snack.reagents.reagent_list && snack.reagents.reagent_list.len) //find a reagent list if there is and check if it has entries - for (var/datum/reagent/R in snack.reagents.reagent_list) //no reagents will be left behind - data += "[R.id]([R.volume] units); " //Using IDs because SOME chemicals(I'm looking at you, chlorhydrate-beer) have the same names as other chemicals. - return data - else - return "No reagents" - /obj/item/reagent_containers/proc/canconsume(mob/eater, mob/user) if(!iscarbon(eater)) return 0 @@ -127,7 +118,11 @@ reagents.clear_reagents() /obj/item/reagent_containers/microwave_act(obj/machinery/microwave/M) +<<<<<<< HEAD if(is_open_container()) reagents.chem_temp = max(reagents.chem_temp, 1000) reagents.handle_reactions() +======= + reagents.expose_temperature(1000) +>>>>>>> 40699a8... [READY]Refactors reagent container types (#33470) ..() diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index 28a07d5862..0a99d9da6e 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -173,7 +173,7 @@ Borg Shaker if(!proximity) return - else if(target.is_open_container() && target.reagents) + else if(target.is_refillable()) var/datum/reagents/R = reagent_list[mode] if(!R.total_volume) to_chat(user, "[src] is currently out of this ingredient! Please allow some time for the synthesizer to produce more.") diff --git a/code/modules/reagents/reagent_containers/dropper.dm b/code/modules/reagents/reagent_containers/dropper.dm index 30aa67e91a..144db32a6c 100644 --- a/code/modules/reagents/reagent_containers/dropper.dm +++ b/code/modules/reagents/reagent_containers/dropper.dm @@ -6,7 +6,7 @@ amount_per_transfer_from_this = 5 possible_transfer_amounts = list(1, 2, 3, 4, 5) volume = 5 - container_type = TRANSPARENT_1 + container_type = TRANSPARENT /obj/item/reagent_containers/dropper/afterattack(obj/target, mob/user , proximity) if(!proximity) diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index df2df7c171..33a45fd27b 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -3,7 +3,7 @@ amount_per_transfer_from_this = 10 possible_transfer_amounts = list(5, 10, 15, 20, 25, 30, 50) volume = 50 - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER spillable = TRUE resistance_flags = ACID_PROOF @@ -44,7 +44,7 @@ if(!reagents || !reagents.total_volume) return // The drink might be empty after the delay, such as by spam-feeding M.visible_message("[user] feeds something to [M].", "[user] feeds something to you.") - add_logs(user, M, "fed", reagentlist(src)) + add_logs(user, M, "fed", reagents.log_list()) else to_chat(user, "You swallow a gulp of [src].") var/fraction = min(5/reagents.total_volume, 1) @@ -56,32 +56,30 @@ if((!proximity) || !check_allowed_items(target,target_self=1)) return - else if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us. - - if(target.reagents && !target.reagents.total_volume) - to_chat(user, "[target] is empty and can't be refilled!") - return - - if(reagents.total_volume >= reagents.maximum_volume) - to_chat(user, "[src] is full.") - return - - var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) - to_chat(user, "You fill [src] with [trans] unit\s of the contents of [target].") - - else if(target.is_open_container() && target.reagents) //Something like a glass. Player probably wants to transfer TO it. + if(target.is_refillable()) //Something like a glass. Player probably wants to transfer TO it. if(!reagents.total_volume) to_chat(user, "[src] is empty!") return - if(target.reagents.total_volume >= target.reagents.maximum_volume) - to_chat(user, "[target] is full.") + if(target.reagents.holder_full()) + to_chat(user, "[target] is full.") return - var/trans = reagents.trans_to(target, amount_per_transfer_from_this) to_chat(user, "You transfer [trans] unit\s of the solution to [target].") + else if(target.is_drainable()) //A dispenser. Transfer FROM it TO us. + if(!target.reagents.total_volume) + to_chat(user, "[target] is empty and can't be refilled!") + return + + if(reagents.holder_full()) + to_chat(user, "[src] is full.") + return + + var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) + to_chat(user, "You fill [src] with [trans] unit\s of the contents of [target].") + else if(reagents.total_volume) if(user.a_intent == INTENT_HARM) user.visible_message("[user] splashes the contents of [src] onto [target]!", \ @@ -169,7 +167,6 @@ volume = 100 amount_per_transfer_from_this = 10 possible_transfer_amounts = list(5,10,15,20,25,30,50,100) - flags_1 = OPENCONTAINER_1 /obj/item/reagent_containers/glass/beaker/noreact name = "cryostasis beaker" @@ -179,7 +176,6 @@ materials = list(MAT_METAL=3000) volume = 50 amount_per_transfer_from_this = 10 - flags_1 = OPENCONTAINER_1 /obj/item/reagent_containers/glass/beaker/noreact/Initialize() . = ..() @@ -195,7 +191,6 @@ volume = 300 amount_per_transfer_from_this = 10 possible_transfer_amounts = list(5,10,15,20,25,30,50,100,300) - flags_1 = OPENCONTAINER_1 /obj/item/reagent_containers/glass/beaker/cryoxadone list_reagents = list("cryoxadone" = 30) @@ -238,7 +233,6 @@ amount_per_transfer_from_this = 20 possible_transfer_amounts = list(10,15,20,25,30,50,70) volume = 70 - flags_1 = OPENCONTAINER_1 flags_inv = HIDEHAIR slot_flags = SLOT_HEAD resistance_flags = NONE diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index dff0869322..53e0c9bfb6 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -10,7 +10,7 @@ volume = 30 possible_transfer_amounts = list() resistance_flags = ACID_PROOF - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER slot_flags = SLOT_BELT var/ignore_flags = 0 var/infinite = FALSE @@ -88,7 +88,7 @@ amount_per_transfer_from_this = 10 volume = 10 ignore_flags = 1 //so you can medipen through hardsuits - container_type = DRAWABLE_1 + container_type = DRAWABLE flags_1 = null list_reagents = list("epinephrine" = 10) diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index 5a2e888210..4908a55911 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -46,7 +46,7 @@ "[user] forces [M] to [apply_method] [src].") - add_logs(user, M, "fed", reagentlist(src)) + add_logs(user, M, "fed", reagents.log_list()) if(reagents.total_volume) reagents.reaction(M, apply_type) reagents.trans_to(M, reagents.total_volume) @@ -57,10 +57,15 @@ /obj/item/reagent_containers/pill/afterattack(obj/target, mob/user , proximity) if(!proximity) return - if(target.is_open_container() != 0 && target.reagents) - if(!target.reagents.total_volume) + if(target.is_refillable()) + if(target.is_drainable() && !target.reagents.total_volume) to_chat(user, "[target] is empty! There's nothing to dissolve [src] in.") return + + if(target.reagents.holder_full()) + to_chat(user, "[target] is full.") + return + to_chat(user, "You dissolve [src] in [target].") for(var/mob/O in viewers(2, user)) //viewers is necessary here because of the small radius to_chat(O, "[user] slips something into [target]!") diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 789345ca77..f8158ba948 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -7,7 +7,7 @@ lefthand_file = 'icons/mob/inhands/equipment/custodial_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/custodial_righthand.dmi' flags_1 = NOBLUDGEON_1 - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER slot_flags = SLOT_BELT throwforce = 0 w_class = WEIGHT_CLASS_SMALL @@ -23,17 +23,17 @@ possible_transfer_amounts = list(5,10,15,20,25,30,50,100) -/obj/item/reagent_containers/spray/afterattack(atom/A as mob|obj, mob/user) +/obj/item/reagent_containers/spray/afterattack(atom/A, mob/user) if(istype(A, /obj/structure/sink) || istype(A, /obj/structure/janitorialcart) || istype(A, /obj/machinery/hydroponics)) return - if(istype(A, /obj/structure/reagent_dispensers) && get_dist(src,A) <= 1) //this block copypasted from reagent_containers/glass, for lack of a better solution - if(!A.reagents.total_volume && A.reagents) - to_chat(user, "\The [A] is empty.") + if((A.is_drainable() && !A.is_refillable()) && get_dist(src,A) <= 1) + if(!A.reagents.total_volume) + to_chat(user, "[A] is empty.") return - if(reagents.total_volume >= reagents.maximum_volume) - to_chat(user, "\The [src] is full.") + if(reagents.holder_full()) + to_chat(user, "[src] is full.") return var/trans = A.reagents.trans_to(src, 50) //transfer 50u , using the spray's transfer amount would take too long to refill @@ -41,7 +41,7 @@ return if(reagents.total_volume < amount_per_transfer_from_this) - to_chat(user, "\The [src] is empty!") + to_chat(user, "[src] is empty!") return spray(A) diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 87fb2b8a9e..17a671569f 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -13,7 +13,7 @@ var/busy = FALSE // needed for delayed drawing of blood var/proj_piercing = 0 //does it pierce through thick clothes when shot with syringe gun materials = list(MAT_METAL=10, MAT_GLASS=20) - container_type = TRANSPARENT_1 + container_type = TRANSPARENT /obj/item/reagent_containers/syringe/Initialize() . = ..() @@ -107,11 +107,8 @@ update_icon() if(SYRINGE_INJECT) - //Always log attemped injections for admins - var/list/rinject = list() - for(var/datum/reagent/R in reagents.reagent_list) - rinject += R.name - var/contained = english_list(rinject) + // Always log attemped injections for admins + var/contained = reagents.log_list() add_logs(user, L, "attemped to inject", src, addition="which had [contained]") if(!reagents.total_volume) diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index ea80f4c508..f0c0ecfb68 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -5,7 +5,7 @@ icon_state = "water" density = TRUE anchored = FALSE - container_type = DRAWABLE_1 + container_type = DRAINABLE | AMOUNT_VISIBLE pressure_resistance = 2*ONE_ATMOSPHERE max_integrity = 300 var/tank_volume = 1000 //In units, how much the dispenser can hold @@ -18,7 +18,7 @@ boom() /obj/structure/reagent_dispensers/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/reagent_containers)) + if(W.is_refillable()) return 0 //so we can refill them via their afterattack. else return ..() @@ -28,14 +28,6 @@ reagents.add_reagent(reagent_id, tank_volume) . = ..() -/obj/structure/reagent_dispensers/examine(mob/user) - ..() - if(reagents.total_volume) - to_chat(user, "It has [reagents.total_volume] unit\s left.") - else - to_chat(user, "It's empty.") - - /obj/structure/reagent_dispensers/proc/boom() visible_message("\The [src] ruptures!") chem_splash(loc, 5, list(reagents)) diff --git a/code/modules/research/circuitprinter.dm b/code/modules/research/circuitprinter.dm index a66fdf7e03..26fa304209 100644 --- a/code/modules/research/circuitprinter.dm +++ b/code/modules/research/circuitprinter.dm @@ -8,7 +8,7 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis). name = "circuit imprinter" desc = "Manufactures circuit boards for the construction of machines." icon_state = "circuit_imprinter" - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER circuit = /obj/item/circuitboard/machine/circuit_imprinter var/efficiency_coeff diff --git a/code/modules/research/departmental_circuit_imprinter.dm b/code/modules/research/departmental_circuit_imprinter.dm index bd3414884f..991feccb66 100644 --- a/code/modules/research/departmental_circuit_imprinter.dm +++ b/code/modules/research/departmental_circuit_imprinter.dm @@ -2,7 +2,7 @@ name = "Department Circuit Imprinter" desc = "A special circuit imprinter with a built in interface meant for departmental usage, with built in ExoSync recievers allowing it to print designs researched that match its ROM-encoded department type. Features a bluespace materials reciever for recieving materials without the hassle of running to mining!" icon_state = "circuit_imprinter" - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER circuit = /obj/item/circuitboard/machine/circuit_imprinter/department console_link = FALSE requires_console = FALSE diff --git a/code/modules/research/departmental_lathe.dm b/code/modules/research/departmental_lathe.dm index 2e534195d9..83f543e4cb 100644 --- a/code/modules/research/departmental_lathe.dm +++ b/code/modules/research/departmental_lathe.dm @@ -2,7 +2,7 @@ name = "department protolathe" desc = "A special protolathe with a built in interface meant for departmental usage, with built in ExoSync recievers allowing it to print designs researched that match its ROM-encoded department type. Features a bluespace materials reciever for recieving materials without the hassle of running to mining!" icon_state = "protolathe" - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER circuit = /obj/item/circuitboard/machine/protolathe/department console_link = FALSE requires_console = FALSE diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm index 6c52fd4678..f76ff1c7ff 100644 --- a/code/modules/research/protolathe.dm +++ b/code/modules/research/protolathe.dm @@ -11,7 +11,7 @@ Note: Must be placed west/left of and R&D console to function. name = "protolathe" desc = "Converts raw materials into useful objects." icon_state = "protolathe" - container_type = OPENCONTAINER_1 + container_type = OPENCONTAINER circuit = /obj/item/circuitboard/machine/protolathe var/efficiency_coeff diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm index ad75ddf07b..61b06d356e 100644 --- a/code/modules/research/rdmachines.dm +++ b/code/modules/research/rdmachines.dm @@ -59,7 +59,7 @@ return if(default_deconstruction_crowbar(O)) return - if(is_open_container() && O.is_open_container()) + if(is_refillable() && O.is_drainable()) return FALSE //inserting reagents into the machine if(Insert_Item(O, user)) return TRUE diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index 7d8ff00e91..ae0e8f5c5e 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -11,7 +11,7 @@ throwforce = 0 throw_speed = 3 throw_range = 6 - container_type = INJECTABLE_1 + container_type = INJECTABLE | DRAWABLE grind_results = list() var/Uses = 1 // uses before it goes inert var/qdel_timer = null // deletion timer, for delayed reactions