Skip to content

Commit

Permalink
Allows syringes and droppers to show their reagents when examined whi…
Browse files Browse the repository at this point in the history
…le wearing things such as Science Goggles. (tgstation#22618)

* Allows syringes and droppers to show their reagents when examined.

* rearranges my logic

* replaces SEMIOPENCONTAINER with TRANSPARENT

* Silly spelling error fix.

* Moves the defines from flags to container_type to avoid issues with conflicting flags

* changes it back to obj/item/O

* Moves the OPENCONTAINER and TRANSPARENT defines to the reagents.dm
  • Loading branch information
Firecage authored and optimumtact committed Jan 4, 2017
1 parent 4d7695a commit 50bbf5a
Show file tree
Hide file tree
Showing 37 changed files with 56 additions and 42 deletions.
1 change: 0 additions & 1 deletion code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#define NOSLIP 1024 //prevents from slipping on wet floors, in space etc (NOTE: flag shared with THICKMATERIAL for external suits and helmet)

#define OPENCONTAINER 4096 // is an open container for chemistry purposes
#define HEADBANGPROTECT 4096

// BLOCK_GAS_SMOKE_EFFECT only used in masks at the moment.
Expand Down
5 changes: 4 additions & 1 deletion code/__DEFINES/reagents.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#define SOLID 1
#define LIQUID 2
#define GAS 3
#define GAS 3

#define OPENCONTAINER 4096 // is an open container for chemistry purposes
#define TRANSPARENT 8192 //Used for non-open containers which you still want to be able to see the reagents off.
8 changes: 6 additions & 2 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
var/list/fingerprints
var/list/fingerprintshidden
var/list/blood_DNA
var/container_type = 0
var/admin_spawned = 0 //was this spawned by an admin? used for stat tracking stuff.

//This atom's HUD (med/sec, etc) images. Associative list.
Expand Down Expand Up @@ -130,7 +131,10 @@
// returns true if open
// false if closed
/atom/proc/is_open_container()
return flags & OPENCONTAINER
return container_type & OPENCONTAINER

/atom/proc/is_transparent()
return container_type & TRANSPARENT

/*//Convenience proc to see whether a container can be accessed in a certain way.
Expand Down Expand Up @@ -207,7 +211,7 @@
// *****RM
//user << "[name]: Dn:[density] dir:[dir] cont:[contents] icon:[icon] is:[icon_state] loc:[loc]"

if(reagents && is_open_container()) //is_open_container() isn't really the right proc for this, but w/e
if(reagents && (is_open_container() || is_transparent())) //is_open_container() isn't really the right proc for this, but w/e
user << "It contains:"
if(reagents.reagent_list.len)
if(user.can_see_reagents()) //Show each individual reagent
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/limbgrower.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
icon = 'icons/obj/machines/limbgrower.dmi'
icon_state = "limbgrower_idleoff"
density = 1
flags = OPENCONTAINER
container_type = OPENCONTAINER

var/operating = 0
anchored = 1
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/devices/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ MASS SPECTROMETER
icon_state = "spectrometer"
item_state = "analyzer"
w_class = WEIGHT_CLASS_SMALL
flags = CONDUCT | OPENCONTAINER
flags = CONDUCT
slot_flags = SLOT_BELT
container_type = OPENCONTAINER
throwforce = 0
throw_speed = 3
throw_range = 7
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/cigs_lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,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/weapon/reagent_containers) && (O.flags & OPENCONTAINER))
if(istype(O, /obj/item/weapon/reagent_containers) && (O.container_type & OPENCONTAINER))
if(reagents.total_volume < chem_volume)
if(O.reagents.total_volume > 0)
O.reagents.trans_to(src,25)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/implants/implant_chem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
desc = "Injects things."
icon_state = "reagents"
origin_tech = "materials=3;biotech=4"
flags = OPENCONTAINER
container_type = OPENCONTAINER

/obj/item/weapon/implant/chem/get_data()
var/dat = {"<b>Implant Specifications:</b><BR>
Expand Down Expand Up @@ -60,7 +60,7 @@
/obj/item/weapon/implantcase/chem/New()
imp = new /obj/item/weapon/implant/chem(src)
..()

/obj/item/weapon/implantcase/chem/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W,/obj/item/weapon/reagent_containers/syringe) && imp)
W.afterattack(imp, user, params)
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/items/weapons/tanks/watertank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
amount_per_transfer_from_this = 50
possible_transfer_amounts = list(25,50,100)
volume = 500
flags = NODROP | OPENCONTAINER | NOBLUDGEON
flags = NODROP | NOBLUDGEON
container_type = OPENCONTAINER
slot_flags = 0

var/obj/item/weapon/watertank/tank
Expand Down Expand Up @@ -347,7 +348,7 @@
var/usage_ratio = 5 //5 unit added per 1 removed
var/injection_amount = 1
amount_per_transfer_from_this = 5
flags = OPENCONTAINER
container_type = OPENCONTAINER
spillable = 0
possible_transfer_amounts = list(5,10,15)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/janicart.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
icon_state = "cart"
anchored = 0
density = 1
flags = OPENCONTAINER
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/weapon/storage/bag/trash/mybag = null
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/mop_bucket.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
icon = 'icons/obj/janitor.dmi'
icon_state = "mopbucket"
density = 1
flags = OPENCONTAINER
container_type = OPENCONTAINER
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite


Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/watercloset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@

if(istype(O, /obj/item/weapon/reagent_containers))
var/obj/item/weapon/reagent_containers/RG = O
if(RG.flags & OPENCONTAINER)
if(RG.container_type & OPENCONTAINER)
RG.reagents.add_reagent("water", min(RG.volume - RG.reagents.total_volume, RG.amount_per_transfer_from_this))
user << "<span class='notice'>You fill [RG] from [src].</span>"
return 1
Expand Down
2 changes: 1 addition & 1 deletion code/modules/crafting/craft.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
else
if(istype(I, /obj/item/weapon/reagent_containers))
var/obj/item/weapon/reagent_containers/RC = I
if(RC.flags & OPENCONTAINER)
if(RC.container_type & OPENCONTAINER)
for(var/datum/reagent/A in RC.reagents.reagent_list)
.[A.type] += A.volume
.[I.type] += 1
Expand Down
3 changes: 2 additions & 1 deletion code/modules/detectivework/footprints_and_rag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
w_class = WEIGHT_CLASS_TINY
icon = 'icons/obj/toy.dmi'
icon_state = "rag"
flags = OPENCONTAINER | NOBLUDGEON
flags = NOBLUDGEON
container_type = OPENCONTAINER
amount_per_transfer_from_this = 5
possible_transfer_amounts = list()
volume = 5
Expand Down
5 changes: 3 additions & 2 deletions code/modules/food_and_drinks/drinks/drinks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
desc = "yummy"
icon = 'icons/obj/drinks.dmi'
icon_state = null
flags = OPENCONTAINER
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
Expand Down Expand Up @@ -103,7 +103,8 @@
materials = list(MAT_METAL=100)
possible_transfer_amounts = list()
volume = 5
flags = CONDUCT | OPENCONTAINER
flags = CONDUCT
container_type = OPENCONTAINER
spillable = 1
resistance_flags = FIRE_PROOF

Expand Down
2 changes: 1 addition & 1 deletion code/modules/food_and_drinks/food/condiment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
desc = "Just your average condiment container."
icon = 'icons/obj/food/containers.dmi'
icon_state = "emptycondiment"
flags = OPENCONTAINER
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() to change names, descs and sprites.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/food_and_drinks/food/customizables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
desc = "A simple bowl, used for soups and salads."
icon = 'icons/obj/food/soupsalad.dmi'
icon_state = "bowl"
flags = OPENCONTAINER
container_type = OPENCONTAINER
materials = list(MAT_GLASS = 500)
w_class = WEIGHT_CLASS_NORMAL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
var/portion = 10
var/selected_drink
var/list/stored_food = list()
flags = OPENCONTAINER
container_type = OPENCONTAINER
var/obj/item/weapon/reagent_containers/mixer

/obj/machinery/food_cart/New()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
var/list/product_types = list()
var/dispense_flavour = ICECREAM_VANILLA
var/flavour_name = "vanilla"
flags = OPENCONTAINER
container_type = OPENCONTAINER
obj_integrity = 300
max_integrity = 300

Expand Down
6 changes: 3 additions & 3 deletions code/modules/food_and_drinks/kitchen_machinery/microwave.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
src.icon_state = "mw"
src.broken = 0 // Fix it!
src.dirty = 0 // just to be sure
src.flags = OPENCONTAINER
src.container_type = OPENCONTAINER
return 0 //to use some fuel
else
user << "<span class='warning'>It's broken!</span>"
Expand All @@ -109,7 +109,7 @@
src.dirty = 0 // It's clean!
src.broken = 0 // just to be sure
src.icon_state = "mw"
src.flags = OPENCONTAINER
src.container_type = OPENCONTAINER
src.updateUsrDialog()
return 1 // Disables the after-attack so we don't spray the floor/user.
else
Expand All @@ -130,7 +130,7 @@
src.dirty = 0 // It's clean!
src.broken = 0 // just to be sure
src.icon_state = "mw"
src.flags = OPENCONTAINER
src.container_type = OPENCONTAINER

else if(src.dirty==100) // The microwave is all dirty so can't be used!
user << "<span class='warning'>It's dirty!</span>"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/hydroponics/hydroitemdefines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
icon_state = "weedspray"
item_state = "spray"
volume = 100
flags = OPENCONTAINER
container_type = OPENCONTAINER
slot_flags = SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
Expand All @@ -43,7 +43,7 @@
icon_state = "pestspray"
item_state = "plantbgone"
volume = 100
flags = OPENCONTAINER
container_type = OPENCONTAINER
slot_flags = SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
Expand Down
2 changes: 1 addition & 1 deletion code/modules/paperwork/pen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
*/
/obj/item/weapon/pen/sleepy
origin_tech = "engineering=4;syndicate=2"
flags = OPENCONTAINER
container_type = OPENCONTAINER


/obj/item/weapon/pen/sleepy/attack(mob/living/M, mob/user)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/ammunition/ammo_casings.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@

/obj/item/ammo_casing/shotgun/dart/New()
..()
flags |= OPENCONTAINER
container_type |= OPENCONTAINER
create_reagents(30)
reagents.set_reacting(FALSE)

Expand Down
3 changes: 2 additions & 1 deletion code/modules/projectiles/guns/energy/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@
item_state = "plasmacutter"
origin_tech = "combat=1;materials=3;magnets=2;plasmatech=3;engineering=1"
ammo_type = list(/obj/item/ammo_casing/energy/plasma)
flags = CONDUCT | OPENCONTAINER
flags = CONDUCT
container_type = OPENCONTAINER
attack_verb = list("attacked", "slashed", "cut", "sliced")
force = 12
sharpness = IS_SHARP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
if(default_unfasten_wrench(user, I))
return

if(istype(I, /obj/item/weapon/reagent_containers) && (I.flags & OPENCONTAINER))
if(istype(I, /obj/item/weapon/reagent_containers) && (I.container_type & OPENCONTAINER))
var/obj/item/weapon/reagent_containers/B = I
. = 1 //no afterattack
if(beaker)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/machinery/chem_heater.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
if(default_deconstruction_crowbar(I))
return

if(istype(I, /obj/item/weapon/reagent_containers) && (I.flags & OPENCONTAINER))
if(istype(I, /obj/item/weapon/reagent_containers) && (I.container_type & OPENCONTAINER))
. = 1 //no afterattack
if(beaker)
user << "<span class='warning'>A beaker is already loaded into the machine!</span>"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/machinery/chem_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
if(default_unfasten_wrench(user, I))
return

if(istype(I, /obj/item/weapon/reagent_containers) && (I.flags & OPENCONTAINER))
if(istype(I, /obj/item/weapon/reagent_containers) && (I.container_type & OPENCONTAINER))
. = 1 // no afterattack
if(panel_open)
user << "<span class='warning'>You can't use the [src.name] while its panel is opened!</span>"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/machinery/pandemic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@


/obj/machinery/computer/pandemic/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weapon/reagent_containers) && (I.flags & OPENCONTAINER))
if(istype(I, /obj/item/weapon/reagent_containers) && (I.container_type & OPENCONTAINER))
. = 1 //no afterattack
if(stat & (NOPOWER|BROKEN))
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
if(default_unfasten_wrench(user, I))
return

if (istype(I, /obj/item/weapon/reagent_containers) && (I.flags & OPENCONTAINER) )
if (istype(I, /obj/item/weapon/reagent_containers) && (I.container_type & OPENCONTAINER) )
if (!beaker)
if(!user.drop_item())
return 1
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/readme.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ About the Tools:
'pouring' our reagents into something else.
atom/proc/is_open_container()
Checks atom/var/flags & OPENCONTAINER.
Checks obj/var/container_type & OPENCONTAINER.
If this returns 1 , you can use syringes, beakers etc
to manipulate the contents of this object.
If it's 0, you'll need to write your own custom reagent
Expand Down
1 change: 1 addition & 0 deletions code/modules/reagents/reagent_containers/dropper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
amount_per_transfer_from_this = 5
possible_transfer_amounts = list(1, 2, 3, 4, 5)
volume = 5
container_type = TRANSPARENT

/obj/item/weapon/reagent_containers/dropper/afterattack(obj/target, mob/user , proximity)
if(!proximity) return
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/reagent_containers/glass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5, 10, 15, 20, 25, 30, 50)
volume = 50
flags = OPENCONTAINER
container_type = OPENCONTAINER
spillable = 1
resistance_flags = ACID_PROOF

Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/reagent_containers/hypospray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
volume = 30
possible_transfer_amounts = list()
resistance_flags = ACID_PROOF
flags = OPENCONTAINER
container_type = OPENCONTAINER
slot_flags = SLOT_BELT
var/ignore_flags = 0
var/infinite = FALSE
Expand Down
3 changes: 2 additions & 1 deletion code/modules/reagents/reagent_containers/spray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
icon = 'icons/obj/janitor.dmi'
icon_state = "cleaner"
item_state = "cleaner"
flags = OPENCONTAINER | NOBLUDGEON
flags = NOBLUDGEON
container_type = OPENCONTAINER
slot_flags = SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
Expand Down
1 change: 1 addition & 0 deletions code/modules/reagents/reagent_containers/syringes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
var/busy = 0 // 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

/obj/item/weapon/reagent_containers/syringe/New()
..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/research/circuitprinter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
flags = OPENCONTAINER
container_type = OPENCONTAINER

var/datum/material_container/materials
var/efficiency_coeff
Expand Down
Loading

0 comments on commit 50bbf5a

Please sign in to comment.