[READY]Refactors reagent container types (#33470)

* Replaces a bunch of manual OPENCONTAINER checks with helper procs

* Removes unnecessary vars

* Updates reagent bitflags, adds some new ones

* Replaces most of the is_open_container calls with more specific ones

* Puts new AMOUNT_VISIBLE flag to use

* Uses new helper procs in more objects

* Standardizes chemicals logging

* De-snowflakes two more checks

* Fixes

* Minor fixes and improvements
This commit is contained in:
ACCount
2017-12-19 07:55:01 +03:00
committed by duncathan salt
parent 3f3fc942d4
commit 40699a8aea
51 changed files with 205 additions and 210 deletions

View File

@@ -2,18 +2,29 @@
#define LIQUID 2 #define LIQUID 2
#define GAS 3 #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 // container_type defines
#define INGEST 2 //ingestion #define INJECTABLE 1 // Makes it possible to add reagents through droppers and syringes.
#define VAPOR 3 //foam, spray, blob attack #define DRAWABLE 2 // Makes it possible to remove reagents through syringes.
#define PATCH 4 //patches
#define INJECT 5 //injection #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 //defines passed through to the on_reagent_change proc
#define DEL_REAGENT 1 //reagent deleted (fully cleared) #define DEL_REAGENT 1 // reagent deleted (fully cleared)
#define ADD_REAGENT 2 // reagent added #define ADD_REAGENT 2 // reagent added
#define REM_REAGENT 3 // reagent removed (may still exist) #define REM_REAGENT 3 // reagent removed (may still exist)

View File

@@ -194,27 +194,22 @@
set waitfor = FALSE set waitfor = FALSE
return return
// Convenience proc to see if a container is open for chemistry handling // Convenience procs to see if a container is open for chemistry handling
// returns true if open
// false if closed
/atom/proc/is_open_container() /atom/proc/is_open_container()
return container_type & OPENCONTAINER_1 return is_refillable() && is_drainable()
/atom/proc/is_transparent()
return container_type & TRANSPARENT_1
/atom/proc/is_injectable(allowmobs = TRUE) /atom/proc/is_injectable(allowmobs = TRUE)
if(isliving(src) && allowmobs) return reagents && (container_type & (INJECTABLE | REFILLABLE))
var/mob/living/L = src
return L.can_inject()
if(container_type & OPENCONTAINER_1)
return TRUE
return container_type & INJECTABLE_1
/atom/proc/is_drawable(allowmobs = TRUE) /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 reagents && (container_type & (DRAWABLE | DRAINABLE))
return TRUE
return container_type & DRAWABLE_1 /atom/proc/is_refillable()
return reagents && (container_type & REFILLABLE)
/atom/proc/is_drainable()
return reagents && (container_type & DRAINABLE)
/atom/proc/AllowDrop() /atom/proc/AllowDrop()
return FALSE return FALSE
@@ -256,7 +251,8 @@
if(desc) if(desc)
to_chat(user, 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 if(reagents)
if(container_type & TRANSPARENT)
to_chat(user, "It contains:") to_chat(user, "It contains:")
if(reagents.reagent_list.len) if(reagents.reagent_list.len)
if(user.can_see_reagents()) //Show each individual reagent if(user.can_see_reagents()) //Show each individual reagent
@@ -269,6 +265,12 @@
to_chat(user, "[total_volume] units of various reagents") to_chat(user, "[total_volume] units of various reagents")
else else
to_chat(user, "Nothing.") to_chat(user, "Nothing.")
else if(container_type & AMOUNT_VISIBLE)
if(reagents.total_volume)
to_chat(user, "<span class='notice'>It has [reagents.total_volume] unit\s left.</span>")
else
to_chat(user, "<span class='danger'>It's empty.</span>")
SendSignal(COMSIG_PARENT_EXAMINE, user) SendSignal(COMSIG_PARENT_EXAMINE, user)
/atom/proc/relaymove(mob/user) /atom/proc/relaymove(mob/user)

View File

@@ -10,7 +10,7 @@
icon = 'icons/obj/machines/limbgrower.dmi' icon = 'icons/obj/machines/limbgrower.dmi'
icon_state = "limbgrower_idleoff" icon_state = "limbgrower_idleoff"
density = TRUE density = TRUE
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
anchored = TRUE anchored = TRUE
use_power = IDLE_POWER_USE use_power = IDLE_POWER_USE
idle_power_usage = 10 idle_power_usage = 10

View File

@@ -102,7 +102,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
icon_state = "cigoff" icon_state = "cigoff"
throw_speed = 0.5 throw_speed = 0.5
item_state = "cigoff" item_state = "cigoff"
container_type = INJECTABLE_1 container_type = INJECTABLE
w_class = WEIGHT_CLASS_TINY w_class = WEIGHT_CLASS_TINY
body_parts_covered = null body_parts_covered = null
grind_results = list() grind_results = list()
@@ -659,7 +659,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
item_state = "[param_color]_vape" item_state = "[param_color]_vape"
/obj/item/clothing/mask/vape/attackby(obj/item/O, mob/user, params) /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(reagents.total_volume < chem_volume)
if(O.reagents.total_volume > 0) if(O.reagents.total_volume > 0)
O.reagents.trans_to(src,25) O.reagents.trans_to(src,25)

View File

@@ -15,6 +15,7 @@
attack_verb = list("slammed", "whacked", "bashed", "thunked", "battered", "bludgeoned", "thrashed") attack_verb = list("slammed", "whacked", "bashed", "thunked", "battered", "bludgeoned", "thrashed")
dog_fashion = /datum/dog_fashion/back dog_fashion = /datum/dog_fashion/back
resistance_flags = FIRE_PROOF resistance_flags = FIRE_PROOF
container_type = AMOUNT_VISIBLE
var/max_water = 50 var/max_water = 50
var/last_use = 1 var/last_use = 1
var/safety = TRUE var/safety = TRUE
@@ -47,7 +48,6 @@
/obj/item/extinguisher/attack_self(mob/user) /obj/item/extinguisher/attack_self(mob/user)
safety = !safety safety = !safety
src.icon_state = "[sprite_name][!safety]" src.icon_state = "[sprite_name][!safety]"
src.desc = "The safety is [safety ? "on" : "off"]."
to_chat(user, "The safety is [safety ? "on" : "off"].") to_chat(user, "The safety is [safety ? "on" : "off"].")
return return
@@ -66,11 +66,10 @@
/obj/item/extinguisher/examine(mob/user) /obj/item/extinguisher/examine(mob/user)
..() ..()
to_chat(user, "The safety is [safety ? "on" : "off"].")
if(reagents.total_volume) if(reagents.total_volume)
to_chat(user, "It contains [round(reagents.total_volume)] unit\s.")
to_chat(user, "<span class='notice'>Alt-click to empty it.</span>") to_chat(user, "<span class='notice'>Alt-click to empty it.</span>")
else
to_chat(user, "It is empty.")
/obj/item/extinguisher/proc/AttemptRefill(atom/target, mob/user) /obj/item/extinguisher/proc/AttemptRefill(atom/target, mob/user)
if(istype(target, /obj/structure/reagent_dispensers/watertank) && target.Adjacent(user)) if(istype(target, /obj/structure/reagent_dispensers/watertank) && target.Adjacent(user))

View File

@@ -2,7 +2,7 @@
name = "chem implant" name = "chem implant"
desc = "Injects things." desc = "Injects things."
icon_state = "reagents" icon_state = "reagents"
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
/obj/item/implant/chem/get_data() /obj/item/implant/chem/get_data()
var/dat = {"<b>Implant Specifications:</b><BR> var/dat = {"<b>Implant Specifications:</b><BR>

View File

@@ -114,7 +114,7 @@
possible_transfer_amounts = list(25,50,100) possible_transfer_amounts = list(25,50,100)
volume = 500 volume = 500
flags_1 = NOBLUDGEON_1 flags_1 = NOBLUDGEON_1
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
slot_flags = 0 slot_flags = 0
var/obj/item/watertank/tank var/obj/item/watertank/tank
@@ -351,7 +351,7 @@
var/usage_ratio = 5 //5 unit added per 1 removed var/usage_ratio = 5 //5 unit added per 1 removed
var/injection_amount = 1 var/injection_amount = 1
amount_per_transfer_from_this = 5 amount_per_transfer_from_this = 5
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
spillable = FALSE spillable = FALSE
possible_transfer_amounts = list(5,10,15) possible_transfer_amounts = list(5,10,15)

View File

@@ -120,7 +120,7 @@
/obj/item/weldingtool/afterattack(atom/O, mob/user, proximity) /obj/item/weldingtool/afterattack(atom/O, mob/user, proximity)
if(!proximity) if(!proximity)
return return
if(!status && istype(O, /obj/item/reagent_containers) && O.is_open_container()) if(!status && O.is_refillable())
reagents.trans_to(O, reagents.total_volume) reagents.trans_to(O, reagents.total_volume)
to_chat(user, "<span class='notice'>You empty [src]'s fuel tank into [O].</span>") to_chat(user, "<span class='notice'>You empty [src]'s fuel tank into [O].</span>")
update_icon() update_icon()
@@ -241,7 +241,7 @@
container_type = NONE container_type = NONE
else else
to_chat(user, "<span class='notice'>[src] can now be attached, modified, and refuelled.</span>") to_chat(user, "<span class='notice'>[src] can now be attached, modified, and refuelled.</span>")
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
add_fingerprint(user) add_fingerprint(user)
/obj/item/weldingtool/proc/flamethrower_rods(obj/item/I, mob/user) /obj/item/weldingtool/proc/flamethrower_rods(obj/item/I, mob/user)

View File

@@ -5,7 +5,7 @@
icon_state = "cart" icon_state = "cart"
anchored = FALSE anchored = FALSE
density = TRUE density = TRUE
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
//copypaste sorry //copypaste sorry
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite 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 var/obj/item/storage/bag/trash/mybag = null

View File

@@ -4,7 +4,7 @@
icon = 'icons/obj/janitor.dmi' icon = 'icons/obj/janitor.dmi'
icon_state = "mopbucket" icon_state = "mopbucket"
density = TRUE density = TRUE
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite

View File

@@ -483,9 +483,9 @@
if(istype(O, /obj/item/reagent_containers)) if(istype(O, /obj/item/reagent_containers))
var/obj/item/reagent_containers/RG = O var/obj/item/reagent_containers/RG = O
if(RG.container_type & OPENCONTAINER_1) if(RG.is_refillable())
if(!RG.reagents.holder_full()) 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, "<span class='notice'>You fill [RG] from [src].</span>") to_chat(user, "<span class='notice'>You fill [RG] from [src].</span>")
return TRUE return TRUE
to_chat(user, "<span class='notice'>\The [RG] is full.</span>") to_chat(user, "<span class='notice'>\The [RG] is full.</span>")
@@ -533,7 +533,7 @@
O.clean_blood() O.clean_blood()
O.acid_level = 0 O.acid_level = 0
create_reagents(5) create_reagents(5)
reagents.add_reagent("[dispensedreagent]", 5) reagents.add_reagent(dispensedreagent, 5)
reagents.reaction(O, TOUCH) reagents.reaction(O, TOUCH)
user.visible_message("<span class='notice'>[user] washes [O] using [src].</span>", \ user.visible_message("<span class='notice'>[user] washes [O] using [src].</span>", \
"<span class='notice'>You wash [O] using [src].</span>") "<span class='notice'>You wash [O] using [src].</span>")

View File

@@ -98,7 +98,7 @@
else else
if(istype(I, /obj/item/reagent_containers)) if(istype(I, /obj/item/reagent_containers))
var/obj/item/reagent_containers/RC = I 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) for(var/datum/reagent/A in RC.reagents.reagent_list)
.[A.type] += A.volume .[A.type] += A.volume
.[I.type] += 1 .[I.type] += 1

View File

@@ -13,7 +13,7 @@
icon = 'icons/obj/toy.dmi' icon = 'icons/obj/toy.dmi'
icon_state = "rag" icon_state = "rag"
flags_1 = NOBLUDGEON_1 flags_1 = NOBLUDGEON_1
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
amount_per_transfer_from_this = 5 amount_per_transfer_from_this = 5
possible_transfer_amounts = list() possible_transfer_amounts = list()
volume = 5 volume = 5

View File

@@ -8,7 +8,7 @@
icon_state = null icon_state = null
lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi' lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/food_righthand.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. 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) possible_transfer_amounts = list(5,10,15,20,25,30,50)
volume = 50 volume = 50
@@ -30,7 +30,7 @@
if(!canconsume(M, user)) if(!canconsume(M, user))
return 0 return 0
if (!is_open_container()) if (!is_drainable())
to_chat(user, "<span class='warning'>[src]'s lid hasn't been opened!</span>") to_chat(user, "<span class='warning'>[src]'s lid hasn't been opened!</span>")
return 0 return 0
@@ -44,7 +44,7 @@
if(!reagents || !reagents.total_volume) if(!reagents || !reagents.total_volume)
return // The drink might be empty after the delay, such as by spam-feeding return // The drink might be empty after the delay, such as by spam-feeding
M.visible_message("<span class='danger'>[user] feeds the contents of [src] to [M].</span>", "<span class='userdanger'>[user] feeds the contents of [src] to [M].</span>") M.visible_message("<span class='danger'>[user] feeds the contents of [src] to [M].</span>", "<span class='userdanger'>[user] feeds the contents of [src] to [M].</span>")
add_logs(user, M, "fed", reagentlist(src)) add_logs(user, M, "fed", reagents.log_list())
var/fraction = min(gulp_size/reagents.total_volume, 1) var/fraction = min(gulp_size/reagents.total_volume, 1)
checkLiked(fraction, M) checkLiked(fraction, M)
@@ -56,31 +56,16 @@
/obj/item/reagent_containers/food/drinks/afterattack(obj/target, mob/user , proximity) /obj/item/reagent_containers/food/drinks/afterattack(obj/target, mob/user , proximity)
if(!proximity) if(!proximity)
return return
if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us.
if (!is_open_container()) if(target.is_refillable()) //Something like a glass. Player probably wants to transfer TO it.
to_chat(user, "<span class='warning'>[target]'s tab isn't open!</span>")
return
if(!target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty.</span>")
return
if(reagents.total_volume >= reagents.maximum_volume)
to_chat(user, "<span class='warning'>[src] is full.</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the contents of [target].</span>")
else if(target.is_open_container()) //Something like a glass. Player probably wants to transfer TO it.
if(!reagents.total_volume) if(!reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty.</span>") to_chat(user, "<span class='warning'>[src] is empty.</span>")
return return
if(target.reagents.total_volume >= target.reagents.maximum_volume) if(target.reagents.holder_full())
to_chat(user, "<span class='warning'>[target] is full.</span>") to_chat(user, "<span class='warning'>[target] is full.</span>")
return return
var/refill = reagents.get_master_reagent_id() var/refill = reagents.get_master_reagent_id()
var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this) var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You transfer [trans] units of the solution to [target].</span>") to_chat(user, "<span class='notice'>You transfer [trans] units of the solution to [target].</span>")
@@ -90,6 +75,24 @@
bro.cell.use(30) bro.cell.use(30)
addtimer(CALLBACK(reagents, /datum/reagents.proc/add_reagent, refill, trans), 600) 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, "<span class='warning'>[src]'s tab isn't open!</span>")
return
if(!target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty.</span>")
return
if(reagents.holder_full())
to_chat(user, "<span class='warning'>[src] is full.</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the contents of [target].</span>")
else
/obj/item/reagent_containers/food/drinks/attackby(obj/item/I, mob/user, params) /obj/item/reagent_containers/food/drinks/attackby(obj/item/I, mob/user, params)
var/hotness = I.is_hot() var/hotness = I.is_hot()
if(hotness && reagents) if(hotness && reagents)
@@ -140,7 +143,7 @@
possible_transfer_amounts = list() possible_transfer_amounts = list()
volume = 5 volume = 5
flags_1 = CONDUCT_1 flags_1 = CONDUCT_1
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
spillable = TRUE spillable = TRUE
resistance_flags = FIRE_PROOF resistance_flags = FIRE_PROOF
isGlass = FALSE isGlass = FALSE
@@ -404,9 +407,9 @@
/obj/item/reagent_containers/food/drinks/soda_cans/attack_self(mob/user) /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 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) playsound(src, "can_open", 50, 1)
spillable = TRUE spillable = TRUE
return return

View File

@@ -4,7 +4,7 @@
/obj/item/reagent_containers/food /obj/item/reagent_containers/food
possible_transfer_amounts = list() possible_transfer_amounts = list()
volume = 50 //Sets the default container amount for all food items. volume = 50 //Sets the default container amount for all food items.
container_type = INJECTABLE_1 container_type = INJECTABLE
resistance_flags = FLAMMABLE resistance_flags = FLAMMABLE
var/foodtype = NONE var/foodtype = NONE
var/last_check_time var/last_check_time

View File

@@ -10,7 +10,7 @@
desc = "Just your average condiment container." desc = "Just your average condiment container."
icon = 'icons/obj/food/containers.dmi' icon = 'icons/obj/food/containers.dmi'
icon_state = "emptycondiment" icon_state = "emptycondiment"
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
possible_transfer_amounts = list(1, 5, 10, 15, 20, 25, 30, 50) possible_transfer_amounts = list(1, 5, 10, 15, 20, 25, 30, 50)
volume = 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. //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) if(!reagents || !reagents.total_volume)
return // The condiment might be empty after the delay. return // The condiment might be empty after the delay.
user.visible_message("<span class='warning'>[user] feeds [M] from [src].</span>") user.visible_message("<span class='warning'>[user] feeds [M] from [src].</span>")
add_logs(user, M, "fed", reagentlist(src)) add_logs(user, M, "fed", reagents.log_list())
var/fraction = min(10/reagents.total_volume, 1) var/fraction = min(10/reagents.total_volume, 1)
reagents.reaction(M, INGEST, fraction) reagents.reaction(M, INGEST, fraction)
@@ -70,7 +70,7 @@
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the contents of [target].</span>") to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the contents of [target].</span>")
//Something like a glass or a food item. Player probably wants to transfer TO it. //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) if(!reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty!</span>") to_chat(user, "<span class='warning'>[src] is empty!</span>")
return return

View File

@@ -291,7 +291,7 @@
desc = "A simple bowl, used for soups and salads." desc = "A simple bowl, used for soups and salads."
icon = 'icons/obj/food/soupsalad.dmi' icon = 'icons/obj/food/soupsalad.dmi'
icon_state = "bowl" icon_state = "bowl"
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
materials = list(MAT_GLASS = 500) materials = list(MAT_GLASS = 500)
w_class = WEIGHT_CLASS_NORMAL w_class = WEIGHT_CLASS_NORMAL

View File

@@ -94,7 +94,7 @@
if(!do_mob(user, M)) if(!do_mob(user, M))
return return
add_logs(user, M, "fed", reagentlist(src)) add_logs(user, M, "fed", reagents.log_list())
M.visible_message("<span class='danger'>[user] forces [M] to eat [src].</span>", \ M.visible_message("<span class='danger'>[user] forces [M] to eat [src].</span>", \
"<span class='userdanger'>[user] forces [M] to eat [src].</span>") "<span class='userdanger'>[user] forces [M] to eat [src].</span>")

View File

@@ -29,7 +29,7 @@ God bless America.
anchored = TRUE anchored = TRUE
use_power = IDLE_POWER_USE use_power = IDLE_POWER_USE
idle_power_usage = 5 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/obj/item/reagent_containers/food/snacks/deepfryholder/frying //What's being fried RIGHT NOW?
var/cook_time = 0 var/cook_time = 0
var/oil_use = 0.05 //How much cooking oil is used per tick var/oil_use = 0.05 //How much cooking oil is used per tick

View File

@@ -15,7 +15,7 @@
var/portion = 10 var/portion = 10
var/selected_drink var/selected_drink
var/list/stored_food = list() var/list/stored_food = list()
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
var/obj/item/reagent_containers/mixer var/obj/item/reagent_containers/mixer
/obj/machinery/food_cart/Initialize() /obj/machinery/food_cart/Initialize()
@@ -100,7 +100,7 @@
stored_food[sanitize(S.name)]++ stored_food[sanitize(S.name)]++
else else
stored_food[sanitize(S.name)] = 1 stored_food[sanitize(S.name)] = 1
else if(O.is_open_container()) else if(O.is_drainable())
return return
else else
. = ..() . = ..()

View File

@@ -14,7 +14,7 @@
anchored = FALSE anchored = FALSE
use_power = NO_POWER_USE use_power = NO_POWER_USE
layer = BELOW_OBJ_LAYER layer = BELOW_OBJ_LAYER
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
max_integrity = 300 max_integrity = 300
var/list/product_types = list() var/list/product_types = list()
var/dispense_flavour = ICECREAM_VANILLA var/dispense_flavour = ICECREAM_VANILLA
@@ -112,7 +112,7 @@
else else
to_chat(user, "<span class='notice'>[O] already has ice cream in it.</span>") to_chat(user, "<span class='notice'>[O] already has ice cream in it.</span>")
return 1 return 1
else if(O.is_open_container()) else if(O.is_drainable())
return return
else else
return ..() return ..()

View File

@@ -81,7 +81,7 @@
src.icon_state = "mw" src.icon_state = "mw"
src.broken = 0 // Fix it! src.broken = 0 // Fix it!
src.dirty = 0 // just to be sure src.dirty = 0 // just to be sure
src.container_type = OPENCONTAINER_1 src.container_type = OPENCONTAINER
return 0 //to use some fuel return 0 //to use some fuel
else else
to_chat(user, "<span class='warning'>It's broken!</span>") to_chat(user, "<span class='warning'>It's broken!</span>")
@@ -98,7 +98,7 @@
src.dirty = 0 // It's clean! src.dirty = 0 // It's clean!
src.broken = 0 // just to be sure src.broken = 0 // just to be sure
src.icon_state = "mw" src.icon_state = "mw"
src.container_type = OPENCONTAINER_1 src.container_type = OPENCONTAINER
src.updateUsrDialog() src.updateUsrDialog()
return 1 // Disables the after-attack so we don't spray the floor/user. return 1 // Disables the after-attack so we don't spray the floor/user.
else else
@@ -119,7 +119,7 @@
src.dirty = 0 // It's clean! src.dirty = 0 // It's clean!
src.broken = 0 // just to be sure src.broken = 0 // just to be sure
src.icon_state = "mw" 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! else if(src.dirty==100) // The microwave is all dirty so can't be used!
to_chat(user, "<span class='warning'>It's dirty!</span>") to_chat(user, "<span class='warning'>It's dirty!</span>")

View File

@@ -24,12 +24,6 @@
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi' lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi' righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
volume = 100 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() /obj/item/reagent_containers/spray/weedspray/Initialize()
. = ..() . = ..()
@@ -48,12 +42,6 @@
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi' lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi' righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
volume = 100 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() /obj/item/reagent_containers/spray/pestspray/Initialize()
. = ..() . = ..()

View File

@@ -712,8 +712,8 @@
else if(transfer_amount) // Droppers, cans, beakers, what have you. else if(transfer_amount) // Droppers, cans, beakers, what have you.
visi_msg="[user] uses [reagent_source] on [target]" visi_msg="[user] uses [reagent_source] on [target]"
irrigate = 1 irrigate = 1
// Beakers, bottles, buckets, etc. Can't use is_open_container though. // Beakers, bottles, buckets, etc.
if(istype(reagent_source, /obj/item/reagent_containers/glass/)) if(reagent_source.is_drainable())
playsound(loc, 'sound/effects/slosh.ogg', 25, 1) playsound(loc, 'sound/effects/slosh.ogg', 25, 1)
if(irrigate && transfer_amount > 30 && reagent_source.reagents.total_volume >= 30 && using_irrigation) if(irrigate && transfer_amount > 30 && reagent_source.reagents.total_volume >= 30 && using_irrigation)

View File

@@ -90,7 +90,7 @@
icon_state = "chemical_cell" 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,\ 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." 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 complexity = 4
inputs = list() inputs = list()
outputs = list("volume used" = IC_PINTYPE_NUMBER, "self reference" = IC_PINTYPE_REF) outputs = list("volume used" = IC_PINTYPE_NUMBER, "self reference" = IC_PINTYPE_REF)

View File

@@ -17,7 +17,7 @@
extended_desc = "This smoke generator creates clouds of smoke on command. It can also hold liquids inside, which will go \ 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." into the smoke clouds when activated. The reagents are consumed when smoke is made."
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
volume = 100 volume = 100
complexity = 20 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 \ 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." 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 volume = 30
complexity = 20 complexity = 20
@@ -145,7 +145,7 @@
return return
if(direction_mode == SYRINGE_INJECT) 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) activate_pin(3)
return return
@@ -156,12 +156,8 @@
return return
//Always log attemped injections for admins //Always log attemped injections for admins
var/list/rinject = list() var/contained = reagents.log_list()
for(var/datum/reagent/R in reagents.reagent_list) add_logs(src, L, "attemped to inject", addition="which had [contained]")
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)
L.visible_message("<span class='danger'>[acting_object] is trying to inject [L]!</span>", \ L.visible_message("<span class='danger'>[acting_object] is trying to inject [L]!</span>", \
"<span class='userdanger'>[acting_object] is trying to inject you!</span>") "<span class='userdanger'>[acting_object] is trying to inject you!</span>")
busy = TRUE busy = TRUE
@@ -169,6 +165,7 @@
var/fraction = min(transfer_amount/reagents.total_volume, 1) var/fraction = min(transfer_amount/reagents.total_volume, 1)
reagents.reaction(L, INJECT, fraction) reagents.reaction(L, INJECT, fraction)
reagents.trans_to(L, transfer_amount) reagents.trans_to(L, transfer_amount)
add_logs(src, L, "injected", addition="which had [contained]")
L.visible_message("<span class='danger'>[acting_object] injects [L] with its needle!</span>", \ L.visible_message("<span class='danger'>[acting_object] injects [L] with its needle!</span>", \
"<span class='userdanger'>[acting_object] injects you with its needle!</span>") "<span class='userdanger'>[acting_object] injects you with its needle!</span>")
else else
@@ -263,8 +260,7 @@
activate_pin(2) activate_pin(2)
return return
// FALSE in those procs makes mobs invalid targets. if(!source.is_drainable() || !target.is_refillable())
if(!source.is_drawable(FALSE) || !target.is_injectable(FALSE))
return return
source.reagents.trans_to(target, transfer_amount) source.reagents.trans_to(target, transfer_amount)
@@ -276,7 +272,7 @@
icon_state = "reagent_storage" icon_state = "reagent_storage"
extended_desc = "This is effectively an internal beaker." extended_desc = "This is effectively an internal beaker."
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
volume = 60 volume = 60
complexity = 4 complexity = 4
@@ -399,8 +395,7 @@
if(!source.reagents || !target.reagents) if(!source.reagents || !target.reagents)
return return
// FALSE in those procs makes mobs invalid targets. if(!source.is_drainable() || !target.is_refillable())
if(!source.is_drawable(FALSE) || !target.is_injectable(FALSE))
return return
if(target.reagents.maximum_volume - target.reagents.total_volume <= 0) if(target.reagents.maximum_volume - target.reagents.total_volume <= 0)

View File

@@ -343,8 +343,15 @@
return 1 return 1
return 0 return 0
// Living mobs use can_inject() to make sure that the mob is not syringe-proof in general.
/mob/living/proc/can_inject() /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() /mob/living/proc/get_organ_target()
var/mob/shooter = src var/mob/shooter = src

View File

@@ -162,7 +162,7 @@
* Sleepypens * Sleepypens
*/ */
/obj/item/pen/sleepy /obj/item/pen/sleepy
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
/obj/item/pen/sleepy/attack(mob/living/M, mob/user) /obj/item/pen/sleepy/attack(mob/living/M, mob/user)

View File

@@ -286,7 +286,7 @@
/obj/item/ammo_casing/shotgun/dart/Initialize() /obj/item/ammo_casing/shotgun/dart/Initialize()
. = ..() . = ..()
container_type |= OPENCONTAINER_1 container_type |= OPENCONTAINER
create_reagents(30) create_reagents(30)
reagents.set_reacting(TRUE) reagents.set_reacting(TRUE)

View File

@@ -121,7 +121,6 @@
item_state = "plasmacutter" item_state = "plasmacutter"
ammo_type = list(/obj/item/ammo_casing/energy/plasma) ammo_type = list(/obj/item/ammo_casing/energy/plasma)
flags_1 = CONDUCT_1 flags_1 = CONDUCT_1
container_type = OPENCONTAINER_1
attack_verb = list("attacked", "slashed", "cut", "sliced") attack_verb = list("attacked", "slashed", "cut", "sliced")
force = 12 force = 12
sharpness = IS_SHARP sharpness = IS_SHARP

View File

@@ -60,6 +60,19 @@
if(my_atom && my_atom.reagents == src) if(my_atom && my_atom.reagents == src)
my_atom.reagents = null 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) /datum/reagents/proc/remove_any(amount = 1)
var/list/cached_reagents = reagent_list var/list/cached_reagents = reagent_list
var/total_transfered = 0 var/total_transfered = 0

View File

@@ -184,7 +184,7 @@
if(default_unfasten_wrench(user, I)) if(default_unfasten_wrench(user, I))
return 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 var/obj/item/reagent_containers/B = I
. = 1 //no afterattack . = 1 //no afterattack
if(beaker) if(beaker)

View File

@@ -64,7 +64,7 @@
if(default_deconstruction_crowbar(I)) if(default_deconstruction_crowbar(I))
return 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 . = 1 //no afterattack
if(beaker) if(beaker)
to_chat(user, "<span class='warning'>A container is already loaded into [src]!</span>") to_chat(user, "<span class='warning'>A container is already loaded into [src]!</span>")

View File

@@ -88,7 +88,7 @@
if(default_unfasten_wrench(user, I)) if(default_unfasten_wrench(user, I))
return 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 . = 1 // no afterattack
if(panel_open) if(panel_open)
to_chat(user, "<span class='warning'>You can't use the [src.name] while its panel is opened!</span>") to_chat(user, "<span class='warning'>You can't use the [src.name] while its panel is opened!</span>")

View File

@@ -225,7 +225,7 @@
/obj/machinery/computer/pandemic/attackby(obj/item/I, mob/user, params) /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 . = TRUE //no afterattack
if(stat & (NOPOWER|BROKEN)) if(stat & (NOPOWER|BROKEN))
return return

View File

@@ -62,7 +62,7 @@
if(default_unfasten_wrench(user, I)) if(default_unfasten_wrench(user, I))
return 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 (!beaker)
if(!user.transferItemToLoc(I, src)) if(!user.transferItemToLoc(I, src))
to_chat(user, "<span class='warning'>[I] is stuck to your hand!</span>") to_chat(user, "<span class='warning'>[I] is stuck to your hand!</span>")

View File

@@ -48,15 +48,6 @@
/obj/item/reagent_containers/afterattack(obj/target, mob/user , flag) /obj/item/reagent_containers/afterattack(obj/target, mob/user , flag)
return 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) /obj/item/reagent_containers/proc/canconsume(mob/eater, mob/user)
if(!iscarbon(eater)) if(!iscarbon(eater))
return 0 return 0
@@ -126,7 +117,6 @@
reagents.clear_reagents() reagents.clear_reagents()
/obj/item/reagent_containers/microwave_act(obj/machinery/microwave/M) /obj/item/reagent_containers/microwave_act(obj/machinery/microwave/M)
if(is_open_container())
reagents.expose_temperature(1000) reagents.expose_temperature(1000)
..() ..()

View File

@@ -173,7 +173,7 @@ Borg Shaker
if(!proximity) if(!proximity)
return return
else if(target.is_open_container() && target.reagents) else if(target.is_refillable())
var/datum/reagents/R = reagent_list[mode] var/datum/reagents/R = reagent_list[mode]
if(!R.total_volume) if(!R.total_volume)
to_chat(user, "<span class='warning'>[src] is currently out of this ingredient! Please allow some time for the synthesizer to produce more.</span>") to_chat(user, "<span class='warning'>[src] is currently out of this ingredient! Please allow some time for the synthesizer to produce more.</span>")

View File

@@ -6,7 +6,7 @@
amount_per_transfer_from_this = 5 amount_per_transfer_from_this = 5
possible_transfer_amounts = list(1, 2, 3, 4, 5) possible_transfer_amounts = list(1, 2, 3, 4, 5)
volume = 5 volume = 5
container_type = TRANSPARENT_1 container_type = TRANSPARENT
/obj/item/reagent_containers/dropper/afterattack(obj/target, mob/user , proximity) /obj/item/reagent_containers/dropper/afterattack(obj/target, mob/user , proximity)
if(!proximity) if(!proximity)

View File

@@ -3,7 +3,7 @@
amount_per_transfer_from_this = 10 amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5, 10, 15, 20, 25, 30, 50) possible_transfer_amounts = list(5, 10, 15, 20, 25, 30, 50)
volume = 50 volume = 50
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
spillable = TRUE spillable = TRUE
resistance_flags = ACID_PROOF resistance_flags = ACID_PROOF
@@ -44,7 +44,7 @@
if(!reagents || !reagents.total_volume) if(!reagents || !reagents.total_volume)
return // The drink might be empty after the delay, such as by spam-feeding return // The drink might be empty after the delay, such as by spam-feeding
M.visible_message("<span class='danger'>[user] feeds something to [M].</span>", "<span class='userdanger'>[user] feeds something to you.</span>") M.visible_message("<span class='danger'>[user] feeds something to [M].</span>", "<span class='userdanger'>[user] feeds something to you.</span>")
add_logs(user, M, "fed", reagentlist(src)) add_logs(user, M, "fed", reagents.log_list())
else else
to_chat(user, "<span class='notice'>You swallow a gulp of [src].</span>") to_chat(user, "<span class='notice'>You swallow a gulp of [src].</span>")
var/fraction = min(5/reagents.total_volume, 1) var/fraction = min(5/reagents.total_volume, 1)
@@ -56,32 +56,30 @@
if((!proximity) || !check_allowed_items(target,target_self=1)) if((!proximity) || !check_allowed_items(target,target_self=1))
return return
else if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us. if(target.is_refillable()) //Something like a glass. Player probably wants to transfer TO it.
if(target.reagents && !target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty and can't be refilled!</span>")
return
if(reagents.total_volume >= reagents.maximum_volume)
to_chat(user, "<span class='notice'>[src] is full.</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You fill [src] with [trans] unit\s of the contents of [target].</span>")
else if(target.is_open_container() && target.reagents) //Something like a glass. Player probably wants to transfer TO it.
if(!reagents.total_volume) if(!reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty!</span>") to_chat(user, "<span class='warning'>[src] is empty!</span>")
return return
if(target.reagents.total_volume >= target.reagents.maximum_volume) if(target.reagents.holder_full())
to_chat(user, "<span class='notice'>[target] is full.</span>") to_chat(user, "<span class='warning'>[target] is full.</span>")
return return
var/trans = reagents.trans_to(target, amount_per_transfer_from_this) var/trans = reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You transfer [trans] unit\s of the solution to [target].</span>") to_chat(user, "<span class='notice'>You transfer [trans] unit\s of the solution to [target].</span>")
else if(target.is_drainable()) //A dispenser. Transfer FROM it TO us.
if(!target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty and can't be refilled!</span>")
return
if(reagents.holder_full())
to_chat(user, "<span class='warning'>[src] is full.</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You fill [src] with [trans] unit\s of the contents of [target].</span>")
else if(reagents.total_volume) else if(reagents.total_volume)
if(user.a_intent == INTENT_HARM) if(user.a_intent == INTENT_HARM)
user.visible_message("<span class='danger'>[user] splashes the contents of [src] onto [target]!</span>", \ user.visible_message("<span class='danger'>[user] splashes the contents of [src] onto [target]!</span>", \
@@ -163,7 +161,6 @@
volume = 100 volume = 100
amount_per_transfer_from_this = 10 amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,15,20,25,30,50,100) possible_transfer_amounts = list(5,10,15,20,25,30,50,100)
flags_1 = OPENCONTAINER_1
/obj/item/reagent_containers/glass/beaker/noreact /obj/item/reagent_containers/glass/beaker/noreact
name = "cryostasis beaker" name = "cryostasis beaker"
@@ -173,7 +170,6 @@
materials = list(MAT_METAL=3000) materials = list(MAT_METAL=3000)
volume = 50 volume = 50
amount_per_transfer_from_this = 10 amount_per_transfer_from_this = 10
flags_1 = OPENCONTAINER_1
/obj/item/reagent_containers/glass/beaker/noreact/Initialize() /obj/item/reagent_containers/glass/beaker/noreact/Initialize()
. = ..() . = ..()
@@ -189,7 +185,6 @@
volume = 300 volume = 300
amount_per_transfer_from_this = 10 amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,15,20,25,30,50,100,300) possible_transfer_amounts = list(5,10,15,20,25,30,50,100,300)
flags_1 = OPENCONTAINER_1
/obj/item/reagent_containers/glass/beaker/cryoxadone /obj/item/reagent_containers/glass/beaker/cryoxadone
list_reagents = list("cryoxadone" = 30) list_reagents = list("cryoxadone" = 30)
@@ -232,7 +227,6 @@
amount_per_transfer_from_this = 20 amount_per_transfer_from_this = 20
possible_transfer_amounts = list(10,15,20,25,30,50,70) possible_transfer_amounts = list(10,15,20,25,30,50,70)
volume = 70 volume = 70
flags_1 = OPENCONTAINER_1
flags_inv = HIDEHAIR flags_inv = HIDEHAIR
slot_flags = SLOT_HEAD slot_flags = SLOT_HEAD
resistance_flags = NONE resistance_flags = NONE

View File

@@ -10,7 +10,7 @@
volume = 30 volume = 30
possible_transfer_amounts = list() possible_transfer_amounts = list()
resistance_flags = ACID_PROOF resistance_flags = ACID_PROOF
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
slot_flags = SLOT_BELT slot_flags = SLOT_BELT
var/ignore_flags = 0 var/ignore_flags = 0
var/infinite = FALSE var/infinite = FALSE
@@ -88,7 +88,7 @@
amount_per_transfer_from_this = 10 amount_per_transfer_from_this = 10
volume = 10 volume = 10
ignore_flags = 1 //so you can medipen through hardsuits ignore_flags = 1 //so you can medipen through hardsuits
container_type = DRAWABLE_1 container_type = DRAWABLE
flags_1 = null flags_1 = null
list_reagents = list("epinephrine" = 10) list_reagents = list("epinephrine" = 10)

View File

@@ -46,7 +46,7 @@
"<span class='userdanger'>[user] forces [M] to [apply_method] [src].</span>") "<span class='userdanger'>[user] forces [M] to [apply_method] [src].</span>")
add_logs(user, M, "fed", reagentlist(src)) add_logs(user, M, "fed", reagents.log_list())
if(reagents.total_volume) if(reagents.total_volume)
reagents.reaction(M, apply_type) reagents.reaction(M, apply_type)
reagents.trans_to(M, reagents.total_volume) reagents.trans_to(M, reagents.total_volume)
@@ -57,10 +57,15 @@
/obj/item/reagent_containers/pill/afterattack(obj/target, mob/user , proximity) /obj/item/reagent_containers/pill/afterattack(obj/target, mob/user , proximity)
if(!proximity) if(!proximity)
return return
if(target.is_open_container() != 0 && target.reagents) if(target.is_refillable())
if(!target.reagents.total_volume) if(target.is_drainable() && !target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty! There's nothing to dissolve [src] in.</span>") to_chat(user, "<span class='warning'>[target] is empty! There's nothing to dissolve [src] in.</span>")
return return
if(target.reagents.holder_full())
to_chat(user, "<span class='warning'>[target] is full.</span>")
return
to_chat(user, "<span class='notice'>You dissolve [src] in [target].</span>") to_chat(user, "<span class='notice'>You dissolve [src] in [target].</span>")
for(var/mob/O in viewers(2, user)) //viewers is necessary here because of the small radius for(var/mob/O in viewers(2, user)) //viewers is necessary here because of the small radius
to_chat(O, "<span class='warning'>[user] slips something into [target]!</span>") to_chat(O, "<span class='warning'>[user] slips something into [target]!</span>")

View File

@@ -7,7 +7,7 @@
lefthand_file = 'icons/mob/inhands/equipment/custodial_lefthand.dmi' lefthand_file = 'icons/mob/inhands/equipment/custodial_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/custodial_righthand.dmi' righthand_file = 'icons/mob/inhands/equipment/custodial_righthand.dmi'
flags_1 = NOBLUDGEON_1 flags_1 = NOBLUDGEON_1
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
slot_flags = SLOT_BELT slot_flags = SLOT_BELT
throwforce = 0 throwforce = 0
w_class = WEIGHT_CLASS_SMALL w_class = WEIGHT_CLASS_SMALL
@@ -23,17 +23,17 @@
possible_transfer_amounts = list(5,10,15,20,25,30,50,100) 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)) if(istype(A, /obj/structure/sink) || istype(A, /obj/structure/janitorialcart) || istype(A, /obj/machinery/hydroponics))
return 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.is_drainable() && !A.is_refillable()) && get_dist(src,A) <= 1)
if(!A.reagents.total_volume && A.reagents) if(!A.reagents.total_volume)
to_chat(user, "<span class='notice'>\The [A] is empty.</span>") to_chat(user, "<span class='warning'>[A] is empty.</span>")
return return
if(reagents.total_volume >= reagents.maximum_volume) if(reagents.holder_full())
to_chat(user, "<span class='notice'>\The [src] is full.</span>") to_chat(user, "<span class='warning'>[src] is full.</span>")
return return
var/trans = A.reagents.trans_to(src, 50) //transfer 50u , using the spray's transfer amount would take too long to refill 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 return
if(reagents.total_volume < amount_per_transfer_from_this) if(reagents.total_volume < amount_per_transfer_from_this)
to_chat(user, "<span class='warning'>\The [src] is empty!</span>") to_chat(user, "<span class='warning'>[src] is empty!</span>")
return return
spray(A) spray(A)

View File

@@ -13,7 +13,7 @@
var/busy = FALSE // needed for delayed drawing of blood var/busy = FALSE // needed for delayed drawing of blood
var/proj_piercing = 0 //does it pierce through thick clothes when shot with syringe gun var/proj_piercing = 0 //does it pierce through thick clothes when shot with syringe gun
materials = list(MAT_METAL=10, MAT_GLASS=20) materials = list(MAT_METAL=10, MAT_GLASS=20)
container_type = TRANSPARENT_1 container_type = TRANSPARENT
/obj/item/reagent_containers/syringe/Initialize() /obj/item/reagent_containers/syringe/Initialize()
. = ..() . = ..()
@@ -107,11 +107,8 @@
update_icon() update_icon()
if(SYRINGE_INJECT) if(SYRINGE_INJECT)
//Always log attemped injections for admins // Always log attemped injections for admins
var/list/rinject = list() var/contained = reagents.log_list()
for(var/datum/reagent/R in reagents.reagent_list)
rinject += R.name
var/contained = english_list(rinject)
add_logs(user, L, "attemped to inject", src, addition="which had [contained]") add_logs(user, L, "attemped to inject", src, addition="which had [contained]")
if(!reagents.total_volume) if(!reagents.total_volume)

View File

@@ -5,7 +5,7 @@
icon_state = "water" icon_state = "water"
density = TRUE density = TRUE
anchored = FALSE anchored = FALSE
container_type = DRAWABLE_1 container_type = DRAINABLE | AMOUNT_VISIBLE
pressure_resistance = 2*ONE_ATMOSPHERE pressure_resistance = 2*ONE_ATMOSPHERE
max_integrity = 300 max_integrity = 300
var/tank_volume = 1000 //In units, how much the dispenser can hold var/tank_volume = 1000 //In units, how much the dispenser can hold
@@ -18,7 +18,7 @@
boom() boom()
/obj/structure/reagent_dispensers/attackby(obj/item/W, mob/user, params) /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. return 0 //so we can refill them via their afterattack.
else else
return ..() return ..()
@@ -28,14 +28,6 @@
reagents.add_reagent(reagent_id, tank_volume) reagents.add_reagent(reagent_id, tank_volume)
. = ..() . = ..()
/obj/structure/reagent_dispensers/examine(mob/user)
..()
if(reagents.total_volume)
to_chat(user, "<span class='notice'>It has [reagents.total_volume] unit\s left.</span>")
else
to_chat(user, "<span class='danger'>It's empty.</span>")
/obj/structure/reagent_dispensers/proc/boom() /obj/structure/reagent_dispensers/proc/boom()
visible_message("<span class='danger'>\The [src] ruptures!</span>") visible_message("<span class='danger'>\The [src] ruptures!</span>")
chem_splash(loc, 5, list(reagents)) chem_splash(loc, 5, list(reagents))

View File

@@ -8,7 +8,7 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
name = "circuit imprinter" name = "circuit imprinter"
desc = "Manufactures circuit boards for the construction of machines." desc = "Manufactures circuit boards for the construction of machines."
icon_state = "circuit_imprinter" icon_state = "circuit_imprinter"
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
circuit = /obj/item/circuitboard/machine/circuit_imprinter circuit = /obj/item/circuitboard/machine/circuit_imprinter
var/efficiency_coeff var/efficiency_coeff

View File

@@ -2,7 +2,7 @@
name = "Department Circuit Imprinter" 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!" 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" icon_state = "circuit_imprinter"
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
circuit = /obj/item/circuitboard/machine/circuit_imprinter/department circuit = /obj/item/circuitboard/machine/circuit_imprinter/department
requires_console = FALSE requires_console = FALSE

View File

@@ -2,7 +2,7 @@
name = "department protolathe" 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!" 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" icon_state = "protolathe"
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
circuit = /obj/item/circuitboard/machine/protolathe/department circuit = /obj/item/circuitboard/machine/protolathe/department
requires_console = FALSE requires_console = FALSE

View File

@@ -11,7 +11,7 @@ Note: Must be placed west/left of and R&D console to function.
name = "protolathe" name = "protolathe"
desc = "Converts raw materials into useful objects." desc = "Converts raw materials into useful objects."
icon_state = "protolathe" icon_state = "protolathe"
container_type = OPENCONTAINER_1 container_type = OPENCONTAINER
circuit = /obj/item/circuitboard/machine/protolathe circuit = /obj/item/circuitboard/machine/protolathe
var/efficiency_coeff var/efficiency_coeff

View File

@@ -61,7 +61,7 @@
return return
if(default_deconstruction_crowbar(O)) if(default_deconstruction_crowbar(O))
return return
if(is_open_container() && O.is_open_container()) if(is_refillable() && O.is_drainable())
return FALSE //inserting reagents into the machine return FALSE //inserting reagents into the machine
if(Insert_Item(O, user)) if(Insert_Item(O, user))
return TRUE return TRUE

View File

@@ -11,7 +11,7 @@
throwforce = 0 throwforce = 0
throw_speed = 3 throw_speed = 3
throw_range = 6 throw_range = 6
container_type = INJECTABLE_1 container_type = INJECTABLE | DRAWABLE
grind_results = list() grind_results = list()
var/Uses = 1 // uses before it goes inert var/Uses = 1 // uses before it goes inert
var/qdel_timer = null // deletion timer, for delayed reactions var/qdel_timer = null // deletion timer, for delayed reactions