mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 08:03:43 +01:00
Merge pull request #6176 from Fox-McCloud/reagents-noreact-refactor
Makes Reagents Holder Process and Refactors NOREACT
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
#define BLOCK_GAS_SMOKE_EFFECT 8192 // blocks the effect that chemical clouds would have on a mob --glasses, mask and helmets ONLY!
|
||||
#define THICKMATERIAL 8192 //prevents syringes, parapens and hypos if the external suit or helmet (if targeting head) has this flag. Example: space suits, biosuit, bombsuits, thick suits that cover your body. (NOTE: flag shared with BLOCK_GAS_SMOKE_EFFECT)
|
||||
|
||||
|
||||
#define NOREACT 16384 //Reagents dont' react inside this container.
|
||||
//Reagent flags
|
||||
#define REAGENT_NOREACT 1
|
||||
|
||||
//Species flags.
|
||||
|
||||
|
||||
@@ -243,7 +243,6 @@
|
||||
desc = "Equipment for medical exosuits. A chem synthesizer with syringe gun. Reagents inside are held in stasis, so no reactions will occur."
|
||||
icon = 'icons/obj/guns/projectile.dmi'
|
||||
icon_state = "syringegun"
|
||||
flags = NOREACT
|
||||
var/list/syringes
|
||||
var/list/known_reagents
|
||||
var/list/processed_reagents
|
||||
@@ -259,6 +258,7 @@
|
||||
/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/New()
|
||||
..()
|
||||
create_reagents(max_volume)
|
||||
reagents.set_reacting(FALSE)
|
||||
syringes = new
|
||||
known_reagents = list("epinephrine"="Epinephrine","charcoal"="Charcoal")
|
||||
processed_reagents = new
|
||||
@@ -273,7 +273,8 @@
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/critfail()
|
||||
..()
|
||||
flags &= ~NOREACT
|
||||
if(reagents)
|
||||
reagents.set_reacting(TRUE)
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/can_attach(obj/mecha/medical/M)
|
||||
if(..())
|
||||
|
||||
@@ -42,11 +42,13 @@ LIGHTERS ARE IN LIGHTERS.DM
|
||||
|
||||
/obj/item/clothing/mask/cigarette/New()
|
||||
..()
|
||||
flags |= NOREACT // so it doesn't react until you light it
|
||||
create_reagents(chem_volume) // making the cigarrete a chemical holder with a maximum volume of 30
|
||||
reagents.set_reacting(FALSE) // so it doesn't react until you light it
|
||||
|
||||
/obj/item/clothing/mask/cigarette/Destroy()
|
||||
qdel(reagents)
|
||||
if(reagents)
|
||||
qdel(reagents)
|
||||
processing_objects -= src
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/mask/cigarette/attack(var/mob/living/M, var/mob/living/user, def_zone)
|
||||
@@ -135,7 +137,7 @@ LIGHTERS ARE IN LIGHTERS.DM
|
||||
M.unEquip(src, 1)
|
||||
qdel(src)
|
||||
return
|
||||
flags &= ~NOREACT // allowing reagents to react after being lit
|
||||
reagents.set_reacting(TRUE)
|
||||
reagents.handle_reactions()
|
||||
icon_state = icon_on
|
||||
item_state = icon_on
|
||||
|
||||
@@ -176,8 +176,8 @@
|
||||
|
||||
/obj/item/weapon/storage/fancy/cigarettes/New()
|
||||
..()
|
||||
flags |= NOREACT
|
||||
create_reagents(30 * storage_slots)//so people can inject cigarettes without opening a packet, now with being able to inject the whole one
|
||||
reagents.set_reacting(FALSE)
|
||||
for(var/i = 1 to storage_slots)
|
||||
var/obj/item/clothing/mask/cigarette/C = new cigarette_type(src)
|
||||
unlaced_cigarettes += C
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
use_power = 1
|
||||
idle_power_usage = 5
|
||||
active_power_usage = 100
|
||||
flags = OPENCONTAINER | NOREACT
|
||||
flags = OPENCONTAINER
|
||||
var/operating = 0 // Is it on?
|
||||
var/dirty = 0 // = {0..100} Does it need cleaning?
|
||||
var/broken = 0 // ={0,1,2} How broken is it???
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
/obj/machinery/kitchen_machine/New()
|
||||
create_reagents(100)
|
||||
reagents.set_reacting(FALSE)
|
||||
if(!available_recipes)
|
||||
available_recipes = new
|
||||
acceptable_items = new
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
use_power = 1
|
||||
idle_power_usage = 5
|
||||
active_power_usage = 100
|
||||
flags = NOREACT
|
||||
var/max_n_of_items = 1500
|
||||
var/icon_on = "smartfridge"
|
||||
var/icon_off = "smartfridge-off"
|
||||
@@ -25,6 +24,8 @@
|
||||
|
||||
/obj/machinery/smartfridge/New()
|
||||
..()
|
||||
create_reagents()
|
||||
reagents.set_reacting(FALSE)
|
||||
component_parts = list()
|
||||
var/obj/item/weapon/circuitboard/smartfridge/board = new(null)
|
||||
board.set_type(type)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
mouse_opacity = 0
|
||||
simulated = 0
|
||||
anchored = 1
|
||||
flags = NOREACT
|
||||
icon = LIGHTING_ICON
|
||||
layer = LIGHTING_LAYER
|
||||
invisibility = INVISIBILITY_LIGHTING
|
||||
|
||||
@@ -246,9 +246,9 @@
|
||||
|
||||
/obj/item/ammo_casing/shotgun/dart/New()
|
||||
..()
|
||||
flags |= NOREACT
|
||||
flags |= OPENCONTAINER
|
||||
create_reagents(30)
|
||||
reagents.set_reacting(FALSE)
|
||||
|
||||
/obj/item/ammo_casing/shotgun/dart/attackby()
|
||||
return
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
qdel(S)
|
||||
D.icon_state = "syringeproj"
|
||||
D.name = "syringe"
|
||||
D.flags |= NOREACT
|
||||
D.reagents.set_reacting(FALSE)
|
||||
playsound(user.loc, 'sound/items/syringeproj.ogg', 50, 1)
|
||||
|
||||
for(var/i=0, i<6, i++)
|
||||
|
||||
@@ -243,8 +243,8 @@
|
||||
|
||||
/obj/item/projectile/bullet/dart/New()
|
||||
..()
|
||||
flags |= NOREACT
|
||||
create_reagents(50)
|
||||
reagents.set_reacting(FALSE)
|
||||
|
||||
/obj/item/projectile/bullet/dart/on_hit(var/atom/target, var/blocked = 0, var/hit_zone)
|
||||
if(iscarbon(target))
|
||||
@@ -260,7 +260,7 @@
|
||||
target.visible_message("<span class='danger'>The [name] was deflected!</span>", \
|
||||
"<span class='userdanger'>You were protected against the [name]!</span>")
|
||||
..(target, blocked, hit_zone)
|
||||
flags &= ~NOREACT
|
||||
reagents.set_reacting(TRUE)
|
||||
reagents.handle_reactions()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -13,10 +13,12 @@ var/const/INGEST = 2
|
||||
var/atom/my_atom = null
|
||||
var/chem_temp = 300
|
||||
var/list/datum/reagent/addiction_list = new/list()
|
||||
var/flags
|
||||
|
||||
/datum/reagents/New(maximum=100)
|
||||
/datum/reagents/New(maximum = 100)
|
||||
maximum_volume = maximum
|
||||
|
||||
if(!(flags & REAGENT_NOREACT))
|
||||
processing_objects |= src
|
||||
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
|
||||
if(!chemical_reagents_list)
|
||||
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
|
||||
@@ -288,11 +290,24 @@ var/const/INGEST = 2
|
||||
od_chems.Add(R.id)
|
||||
return od_chems
|
||||
|
||||
/datum/reagents/proc/process()
|
||||
if(flags & REAGENT_NOREACT)
|
||||
processing_objects -= src
|
||||
return
|
||||
|
||||
/datum/reagents/proc/reagent_on_tick()
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
R.on_tick()
|
||||
return
|
||||
|
||||
/datum/reagents/proc/set_reacting(react = TRUE)
|
||||
if(react)
|
||||
// Order is important, process() can remove from processing if
|
||||
// the flag is present
|
||||
flags &= ~(REAGENT_NOREACT)
|
||||
processing_objects |= src
|
||||
else
|
||||
processing_objects -= src
|
||||
flags |= REAGENT_NOREACT
|
||||
|
||||
/*
|
||||
if(!target) return
|
||||
var/total_transfered = 0
|
||||
@@ -337,7 +352,7 @@ var/const/INGEST = 2
|
||||
update_total()
|
||||
|
||||
/datum/reagents/proc/handle_reactions()
|
||||
if(my_atom.flags & NOREACT)
|
||||
if(flags & REAGENT_NOREACT)
|
||||
return //Yup, no reactions here. No siree.
|
||||
|
||||
var/reaction_occured = 0
|
||||
@@ -721,7 +736,7 @@ atom/proc/create_reagents(max_vol)
|
||||
|
||||
/datum/reagents/Destroy()
|
||||
. = ..()
|
||||
processing_objects.Remove(src)
|
||||
processing_objects -= src
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
qdel(R)
|
||||
reagent_list.Cut()
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
if(!possible_transfer_amounts)
|
||||
verbs -= /obj/item/weapon/reagent_containers/verb/set_APTFT
|
||||
create_reagents(volume)
|
||||
processing_objects.Add(src)
|
||||
if(spawned_disease)
|
||||
var/datum/disease/F = new spawned_disease(0)
|
||||
var/list/data = list("viruses" = list(F), "blood_colour" = "#A10808")
|
||||
@@ -38,11 +37,6 @@
|
||||
if(list_reagents)
|
||||
reagents.add_reagent_list(list_reagents)
|
||||
|
||||
/obj/item/weapon/reagent_containers/process()
|
||||
if(reagents)
|
||||
reagents.reagent_on_tick()
|
||||
return
|
||||
|
||||
/obj/item/weapon/reagent_containers/ex_act()
|
||||
if(reagents)
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
|
||||
@@ -290,7 +290,11 @@
|
||||
materials = list(MAT_GLASS=500)
|
||||
volume = 50
|
||||
amount_per_transfer_from_this = 10
|
||||
flags = OPENCONTAINER | NOREACT
|
||||
flags = OPENCONTAINER
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/noreact/New()
|
||||
..()
|
||||
reagents.set_reacting(FALSE)
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/bluespace
|
||||
name = "bluespace beaker"
|
||||
|
||||
Reference in New Issue
Block a user