Updates reagents a bit.

This commit is contained in:
Ghommie
2019-06-07 06:27:04 +02:00
parent 17febdd07c
commit 7aac9e6280
56 changed files with 118 additions and 163 deletions
+10 -15
View File
@@ -53,7 +53,7 @@
var/list/datum/reagent/addiction_list = new/list()
var/reagents_holder_flags
/datum/reagents/New(maximum=100)
/datum/reagents/New(maximum=100, new_flags)
maximum_volume = maximum
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
@@ -62,6 +62,8 @@
if(!GLOB.chemical_reactions_list)
build_chemical_reactions_list()
reagents_holder_flags = new_flags
/datum/reagents/Destroy()
. = ..()
var/list/cached_reagents = reagent_list
@@ -311,13 +313,6 @@
C.update_stamina()
update_total()
/datum/reagents/proc/set_reacting(react = TRUE)
if(react)
reagents_holder_flags &= ~(REAGENT_NOREACT)
else
reagents_holder_flags |= REAGENT_NOREACT
/datum/reagents/proc/conditional_update_move(atom/A, Running = 0)
var/list/cached_reagents = reagent_list
for(var/reagent in cached_reagents)
@@ -333,11 +328,11 @@
update_total()
/datum/reagents/proc/handle_reactions()
if(reagents_holder_flags & NO_REACT)
return //Yup, no reactions here. No siree.
var/list/cached_reagents = reagent_list
var/list/cached_reactions = GLOB.chemical_reactions_list
var/datum/cached_my_atom = my_atom
if(reagents_holder_flags & REAGENT_NOREACT)
return //Yup, no reactions here. No siree.
var/reaction_occurred = 0
do
@@ -555,7 +550,7 @@
if(!D)
WARNING("[my_atom] attempted to add a reagent called '[reagent]' which doesn't exist. ([usr])")
return FALSE
update_total()
var/cached_total = total_volume
if(cached_total + amount > maximum_volume)
@@ -599,9 +594,9 @@
if(data)
R.data = data
R.on_new(data)
if(isliving(my_atom))
R.on_mob_add(my_atom) //Must occur befor it could posibly run on_mob_delete
R.on_mob_add(my_atom) //Must occur befor it could posibly run on_mob_delete
update_total()
if(my_atom)
my_atom.on_reagent_change(ADD_REAGENT)
@@ -800,10 +795,10 @@
// Convenience proc to create a reagents holder for an atom
// Max vol is maximum volume of holder
/atom/proc/create_reagents(max_vol)
/atom/proc/create_reagents(max_vol, flags)
if(reagents)
qdel(reagents)
reagents = new/datum/reagents(max_vol)
reagents = new/datum/reagents(max_vol, flags)
reagents.my_atom = src
/proc/get_random_reagent_id() // Returns a random reagent ID minus blacklisted reagents
+1 -1
View File
@@ -230,7 +230,7 @@ By default, all atom have a reagents var - but its empty. if you want to use an
'pouring' our reagents into something else.
atom/proc/is_open_container()
Checks obj/var/container_type & OPENCONTAINER.
Checks atom/var/reagents.reagents_holder_flags & 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
+2 -1
View File
@@ -7,6 +7,7 @@
var/amount_per_transfer_from_this = 5
var/list/possible_transfer_amounts = list(5,10,15,20,25,30)
var/volume = 30
var/reagent_flags
var/list/list_reagents = null
var/spawned_disease = null
var/disease_amount = 20
@@ -16,7 +17,7 @@
. = ..()
if(isnum(vol) && vol > 0)
volume = vol
create_reagents(volume)
create_reagents(volume, reagent_flags)
if(spawned_disease)
var/datum/disease/F = new spawned_disease()
var/list/data = list("viruses"= list(F))
@@ -6,7 +6,7 @@
amount_per_transfer_from_this = 5
possible_transfer_amounts = list(1, 2, 3, 4, 5)
volume = 5
container_type = TRANSPARENT
reagent_flags = TRANSPARENT
/obj/item/reagent_containers/dropper/afterattack(obj/target, mob/user , proximity)
. = ..()
@@ -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
reagent_flags = OPENCONTAINER
spillable = TRUE
resistance_flags = ACID_PROOF
@@ -194,13 +194,10 @@
reactions. Can hold up to 50 units."
icon_state = "beakernoreact"
materials = list(MAT_METAL=3000)
reagent_flags = OPENCONTAINER | NO_REACT
volume = 50
amount_per_transfer_from_this = 10
/obj/item/reagent_containers/glass/beaker/noreact/Initialize()
. = ..()
reagents.set_reacting(FALSE)
/obj/item/reagent_containers/glass/beaker/bluespace
name = "bluespace beaker"
desc = "A bluespace beaker, powered by experimental bluespace technology \
@@ -291,11 +288,11 @@
to_chat(user, "<span class='userdanger'>[src]'s contents spill all over you!</span>")
reagents.reaction(user, TOUCH)
reagents.clear_reagents()
container_type = NONE
reagent_flags = NONE
/obj/item/reagent_containers/glass/bucket/dropped(mob/user)
. = ..()
container_type = initial(container_type)
reagent_flags = initial(reagent_flags)
/obj/item/reagent_containers/glass/bucket/equip_to_best_slot(var/mob/M)
if(reagents.total_volume) //If there is water in a bucket, don't quick equip it to the head
@@ -10,7 +10,7 @@
volume = 30
possible_transfer_amounts = list()
resistance_flags = ACID_PROOF
container_type = OPENCONTAINER
reagent_flags = OPENCONTAINER
slot_flags = ITEM_SLOT_BELT
var/ignore_flags = 0
var/infinite = FALSE
@@ -73,7 +73,7 @@
desc = "A modified air-needle autoinjector with a small single-use reservoir. It contains an experimental serum."
icon_state = "combat_hypo"
volume = 5
container_type = NONE
reagent_flags = NONE
list_reagents = list("magillitis" = 5)
//MediPens
@@ -88,7 +88,7 @@
amount_per_transfer_from_this = 10
volume = 10
ignore_flags = 1 //so you can medipen through hardsuits
container_type = DRAWABLE
reagent_flags = DRAWABLE
flags_1 = null
list_reagents = list("epinephrine" = 10)
@@ -103,7 +103,7 @@
..()
if(!iscyborg(user))
reagents.maximum_volume = 0 //Makes them useless afterwards
container_type = NONE
reagent_flags = NONE
update_icon()
addtimer(CALLBACK(src, .proc/cyborg_recharge, user), 80)
@@ -8,7 +8,7 @@
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
item_flags = NOBLUDGEON
obj_flags = UNIQUE_RENAME
container_type = OPENCONTAINER
reagent_flags = OPENCONTAINER
slot_flags = ITEM_SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
@@ -7,7 +7,7 @@
lefthand_file = 'icons/mob/inhands/equipment/custodial_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/custodial_righthand.dmi'
item_flags = NOBLUDGEON
container_type = OPENCONTAINER
reagent_flags = OPENCONTAINER
slot_flags = ITEM_SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
@@ -224,7 +224,7 @@
return
/obj/item/reagent_containers/spray/waterflower/cyborg
container_type = NONE
reagent_flags = NONE
volume = 100
list_reagents = list("water" = 100)
var/generate_amount = 5
@@ -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
reagent_flags = TRANSPARENT
/obj/item/reagent_containers/syringe/Initialize()
. = ..()
@@ -249,10 +249,7 @@
name = "cryo syringe"
desc = "An advanced syringe that stops reagents inside from reacting. It can hold up to 20 units."
volume = 20
/obj/item/reagent_containers/syringe/noreact/Initialize()
. = ..()
reagents.set_reacting(FALSE)
reagent_flags = TRANSPARENT | NO_REACT
/obj/item/reagent_containers/syringe/piercing
name = "piercing syringe"
+1 -2
View File
@@ -5,7 +5,6 @@
icon_state = "water"
density = TRUE
anchored = FALSE
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
@@ -24,7 +23,7 @@
return ..()
/obj/structure/reagent_dispensers/Initialize()
create_reagents(tank_volume)
create_reagents(tank_volume, DRAINABLE | AMOUNT_VISIBLE)
reagents.add_reagent(reagent_id, tank_volume)
. = ..()