Singletons + refactor of /datum/observ (#15487)

This commit is contained in:
Fluffy
2023-01-05 18:41:40 +01:00
committed by GitHub
parent 95f8207f08
commit 0ddcf0817a
507 changed files with 7603 additions and 7214 deletions
+13 -13
View File
@@ -14,15 +14,15 @@
if(species && species.flags & NO_BLOOD) //We want the var for safety but we can do without the actual blood.
return
vessel.add_reagent(/decl/reagent/blood, species.blood_volume, temperature = species?.body_temperature)
vessel.add_reagent(/singleton/reagent/blood, species.blood_volume, temperature = species?.body_temperature)
fixblood()
//Resets blood data
/mob/living/carbon/human/proc/fixblood()
if(!REAGENT_VOLUME(vessel, /decl/reagent/blood))
if(!REAGENT_VOLUME(vessel, /singleton/reagent/blood))
return
LAZYINITLIST(vessel.reagent_data)
LAZYSET(vessel.reagent_data, /decl/reagent/blood, get_blood_data())
LAZYSET(vessel.reagent_data, /singleton/reagent/blood, get_blood_data())
//Makes a blood drop, leaking amt units of blood from the mob
/mob/living/carbon/human/proc/drip(var/amt as num, var/tar = src, var/spraydir)
@@ -33,7 +33,7 @@
if(!amt)
return
vessel.remove_reagent(/decl/reagent/blood,amt)
vessel.remove_reagent(/singleton/reagent/blood,amt)
blood_splatter(tar, src, spray_dir = spraydir)
#define BLOOD_SPRAY_DISTANCE 2
@@ -85,7 +85,7 @@
#undef BLOOD_SPRAY_DISTANCE
/mob/living/carbon/human/proc/get_blood_volume()
return round((REAGENT_VOLUME(vessel, /decl/reagent/blood)/species.blood_volume)*100)
return round((REAGENT_VOLUME(vessel, /singleton/reagent/blood)/species.blood_volume)*100)
/mob/living/carbon/human/proc/get_blood_circulation()
var/obj/item/organ/internal/heart/heart = internal_organs_by_name[BP_HEART]
@@ -141,7 +141,7 @@
//Gets blood from mob to the container, preserving all data in it.
/mob/living/carbon/proc/take_blood(obj/item/reagent_containers/container, var/amount)
container.reagents.add_reagent(/decl/reagent/blood, amount, get_blood_data(), temperature = species?.body_temperature)
container.reagents.add_reagent(/singleton/reagent/blood, amount, get_blood_data(), temperature = species?.body_temperature)
return TRUE
//For humans, blood does not appear from blue, it comes from vessels.
@@ -155,14 +155,14 @@
vessel.trans_to_holder(container.reagents, amount)
if(vessel.has_reagent(/decl/reagent/blood))
LAZYSET(vessel.reagent_data, /decl/reagent/blood, get_blood_data())
if(vessel.has_reagent(/singleton/reagent/blood))
LAZYSET(vessel.reagent_data, /singleton/reagent/blood, get_blood_data())
vessel.trans_to_holder(container.reagents, amount)
return TRUE
//Transfers blood from container to vessels
/mob/living/carbon/proc/inject_blood(var/amount, var/datum/reagents/donor)
var/list/injected_data = REAGENT_DATA(donor, /decl/reagent/blood)
var/list/injected_data = REAGENT_DATA(donor, /singleton/reagent/blood)
var/chems = LAZYACCESS(injected_data, "trace_chem")
for(var/C in chems)
reagents.add_reagent(C, (text2num(chems[C]) / species.blood_volume) * amount)//adds trace chemicals to owner's blood
@@ -170,10 +170,10 @@
//Transfers blood from reagents to vessel, respecting blood types compatability.
/mob/living/carbon/human/inject_blood(var/amount, var/datum/reagents/donor)
if(!should_have_organ(BP_HEART))
reagents.add_reagent(/decl/reagent/blood, amount, REAGENT_DATA(donor, /decl/reagent/blood), temperature = species?.body_temperature)
reagents.add_reagent(/singleton/reagent/blood, amount, REAGENT_DATA(donor, /singleton/reagent/blood), temperature = species?.body_temperature)
return
// Incompatibility is handled in mix_data now.
vessel.add_reagent(/decl/reagent/blood, amount, REAGENT_DATA(donor, /decl/reagent/blood), temperature = species?.body_temperature)
vessel.add_reagent(/singleton/reagent/blood, amount, REAGENT_DATA(donor, /singleton/reagent/blood), temperature = species?.body_temperature)
..()
proc/blood_incompatible(donor,receiver,donor_species,receiver_species)
@@ -222,7 +222,7 @@ proc/blood_incompatible(donor,receiver,donor_species,receiver_species)
. = ..()
var/list/trace_chems = list()
if(LAZYLEN(vessel.reagent_data))
trace_chems = LAZYACCESS(vessel.reagent_data[/decl/reagent/blood], "trace_chem") || list()
trace_chems = LAZYACCESS(vessel.reagent_data[/singleton/reagent/blood], "trace_chem") || list()
.["trace_chem"] = trace_chems.Copy()
proc/blood_splatter(var/target, var/source, var/large, var/spray_dir, var/sourceless_color)
@@ -266,7 +266,7 @@ proc/blood_splatter(var/target, var/source, var/large, var/spray_dir, var/source
blood_data = donor.get_blood_data()
else if(isatom(source))
var/atom/donor = source
blood_data = REAGENT_DATA(donor.reagents, /decl/reagent/blood)
blood_data = REAGENT_DATA(donor.reagents, /singleton/reagent/blood)
else if(!source)
if(sourceless_color)
splatter.basecolor = sourceless_color
+4 -4
View File
@@ -116,12 +116,12 @@
return
if(pulse != PULSE_NONE || BP_IS_ROBOTIC(src))
var/blood_volume = round(REAGENT_VOLUME(owner.vessel, /decl/reagent/blood))
var/blood_volume = round(REAGENT_VOLUME(owner.vessel, /singleton/reagent/blood))
//Blood regeneration if there is some space
if(blood_volume < species.blood_volume && blood_volume)
if(REAGENT_DATA(owner.vessel, /decl/reagent/blood)) // Make sure there's blood at all
owner.vessel.add_reagent(/decl/reagent/blood, BLOOD_REGEN_RATE + LAZYACCESS(owner.chem_effects, CE_BLOODRESTORE), temperature = species?.body_temperature)
if(REAGENT_DATA(owner.vessel, /singleton/reagent/blood)) // Make sure there's blood at all
owner.vessel.add_reagent(/singleton/reagent/blood, BLOOD_REGEN_RATE + LAZYACCESS(owner.chem_effects, CE_BLOODRESTORE), temperature = species?.body_temperature)
if(blood_volume <= BLOOD_VOLUME_SAFE) //We lose nutrition and hydration very slowly if our blood is too low
owner.adjustNutritionLoss(2)
owner.adjustHydrationLoss(1)
@@ -153,7 +153,7 @@
blood_max += bleed_amount
do_spray += "[temp.name]"
else
owner.vessel.remove_reagent(/decl/reagent/blood, bleed_amount)
owner.vessel.remove_reagent(/singleton/reagent/blood, bleed_amount)
switch(pulse)
if(PULSE_SLOW)
+5 -5
View File
@@ -21,7 +21,7 @@
// Coffee is really bad for you with busted kidneys.
// This should probably be expanded in some way, but fucked if I know
// what else kidneys can process in our reagent list.
var/decl/reagent/drink/coffee = REAGENT_VOLUME(owner.reagents, /decl/reagent/drink/coffee)
var/singleton/reagent/drink/coffee = REAGENT_VOLUME(owner.reagents, /singleton/reagent/drink/coffee)
if(coffee)
if(is_bruised())
owner.adjustToxLoss(0.1)
@@ -29,11 +29,11 @@
owner.adjustToxLoss(0.3)
if(is_bruised())
if(prob(5) && REAGENT_VOLUME(reagents, /decl/reagent/potassium) < 5)
reagents.add_reagent(/decl/reagent/potassium, REM*5)
if(prob(5) && REAGENT_VOLUME(reagents, /singleton/reagent/potassium) < 5)
reagents.add_reagent(/singleton/reagent/potassium, REM*5)
if(is_broken())
if(REAGENT_VOLUME(owner.reagents, /decl/reagent/potassium) < 15)
owner.reagents.add_reagent(/decl/reagent/potassium, REM*2)
if(REAGENT_VOLUME(owner.reagents, /singleton/reagent/potassium) < 15)
owner.reagents.add_reagent(/singleton/reagent/potassium, REM*2)
//If your kidneys aren't working, your body's going to have a hard time cleaning your blood.
if(!owner.chem_effects[CE_ANTITOXIN])
+1 -1
View File
@@ -232,7 +232,7 @@
if(toxins_pp > safe_toxins_max)
var/ratio = (poison/safe_toxins_max) * 10
if(reagents)
reagents.add_reagent(/decl/reagent/toxin, Clamp(ratio, MIN_TOXIN_DAMAGE, MAX_TOXIN_DAMAGE))
reagents.add_reagent(/singleton/reagent/toxin, Clamp(ratio, MIN_TOXIN_DAMAGE, MAX_TOXIN_DAMAGE))
breath.adjust_gas(poison_type, -poison/6, update = 0) //update after
owner.phoron_alert = max(owner.phoron_alert, 1)
else
+1 -1
View File
@@ -124,7 +124,7 @@
if(should_process_alcohol)
var/alcohol_volume = REAGENT_VOLUME(ingested, /decl/reagent/alcohol)
var/alcohol_volume = REAGENT_VOLUME(ingested, /singleton/reagent/alcohol)
// Alcohol counts as double volume for the purposes of vomit probability
var/effective_volume = ingested.total_volume + alcohol_volume
+4 -4
View File
@@ -170,8 +170,8 @@
log_debug("Organ [DEBUG_REF(src)] had QDELETED reagents! Regenerating.")
create_reagents(5)
if(REAGENT_VOLUME(reagents, /decl/reagent/blood) && !(status & ORGAN_ROBOT) && prob(40))
reagents.remove_reagent(/decl/reagent/blood,0.1)
if(REAGENT_VOLUME(reagents, /singleton/reagent/blood) && !(status & ORGAN_ROBOT) && prob(40))
reagents.remove_reagent(/singleton/reagent/blood,0.1)
if (isturf(loc))
blood_splatter(src,src,TRUE)
if(config.organs_decay) damage += rand(1,3)
@@ -259,7 +259,7 @@
germ_level += rand(2,3)
if(501 to INFINITY)
germ_level += rand(3,5)
owner.reagents.add_reagent(/decl/reagent/toxin, rand(1,2))
owner.reagents.add_reagent(/singleton/reagent/toxin, rand(1,2))
/obj/item/organ/proc/receive_chem(chemical as obj)
return 0
@@ -414,7 +414,7 @@
if (!reagents)
create_reagents(5)
var/blood_data = LAZYACCESS(reagents.reagent_data, /decl/reagent/blood)
var/blood_data = LAZYACCESS(reagents.reagent_data, /singleton/reagent/blood)
if(!("blood_DNA" in blood_data))
owner.vessel.trans_to(src, 5, 1, 1)
+2 -2
View File
@@ -723,7 +723,7 @@ Note that amputating the affected organ does in fact remove the infection from t
germ_level++
if(germ_level >= INFECTION_LEVEL_TWO && REAGENT_VOLUME(owner.reagents, /decl/reagent/thetamycin) < 5) //The presence of 5 units of thetamycin will stop infections spreading
if(germ_level >= INFECTION_LEVEL_TWO && REAGENT_VOLUME(owner.reagents, /singleton/reagent/thetamycin) < 5) //The presence of 5 units of thetamycin will stop infections spreading
//SPREADING TO INTERNAL ORGANS
if(isnull(infect_target_internal) || QDELETED(infect_target_internal))
infect_target_internal = get_infect_target(internal_organs)
@@ -1094,7 +1094,7 @@ Note that amputating the affected organ does in fact remove the infection from t
owner.emote("scream")
owner.flash_strong_pain()
playsound(src.loc, /decl/sound_category/fracture_sound, 100, 1, -2)
playsound(src.loc, /singleton/sound_category/fracture_sound, 100, 1, -2)
status |= ORGAN_BROKEN
broken_description = pick("Broken","Fracture","Hairline Fracture")
perma_injury = brute_dam
+1 -1
View File
@@ -41,7 +41,7 @@ mob/var/next_pain_time = 0
var/force_emote = species.get_pain_emote(src, power)
if(force_emote && prob(power))
var/decl/emote/use_emote = usable_emotes[force_emote]
var/singleton/emote/use_emote = usable_emotes[force_emote]
if(!(use_emote.message_type == AUDIBLE_MESSAGE && silent))
emote(force_emote)
+4 -4
View File
@@ -137,7 +137,7 @@
to_chat(owner, "<span class='notice'>\The [src] activates, releasing a stream of chemicals into your veins!</span>")
owner.reagents.add_reagent(/decl/reagent/adrenaline, 15)
owner.reagents.add_reagent(/singleton/reagent/adrenaline, 15)
/obj/item/organ/internal/augment/venomous_rest
name = "venomous rest implant"
@@ -156,9 +156,9 @@
return FALSE
if(owner.reagents)
owner.reagents.add_reagent(/decl/reagent/inaprovaline, 10)
owner.reagents.add_reagent(/decl/reagent/tricordrazine, 10)
owner.reagents.add_reagent(/decl/reagent/soporific, 15)
owner.reagents.add_reagent(/singleton/reagent/inaprovaline, 10)
owner.reagents.add_reagent(/singleton/reagent/tricordrazine, 10)
owner.reagents.add_reagent(/singleton/reagent/soporific, 15)
take_damage(15)
to_chat(owner, "<span class='notice'>\The [src] activates, releasing a stream of chemicals into your veins!</span>")
+3 -3
View File
@@ -148,10 +148,10 @@
nymph_out(E, limb_nymph, forced = TRUE)
return FALSE
var/blood_volume = round(REAGENT_VOLUME(E.owner.vessel, /decl/reagent/blood))
var/blood_volume = round(REAGENT_VOLUME(E.owner.vessel, /singleton/reagent/blood))
if(blood_volume)
if(REAGENT_DATA(E.owner.vessel, /decl/reagent/blood))
E.owner.vessel.remove_reagent(/decl/reagent/blood, BLOOD_REGEN_RATE / (2 * nymph_limb_types_by_name.len))
if(REAGENT_DATA(E.owner.vessel, /singleton/reagent/blood))
E.owner.vessel.remove_reagent(/singleton/reagent/blood, BLOOD_REGEN_RATE / (2 * nymph_limb_types_by_name.len))
if(blood_volume <= 0)
nymph_out(E, limb_nymph, forced = TRUE)
+6 -6
View File
@@ -87,8 +87,8 @@
set_light(1, l_color = "#E6E600")
if(prob(10))
to_chat(owner, "<span class='warning'>You feel something squirming inside of you!</span>")
owner.reagents.add_reagent(/decl/reagent/toxin/phoron, 8)
owner.reagents.add_reagent(/decl/reagent/kois, 5)
owner.reagents.add_reagent(/singleton/reagent/toxin/phoron, 8)
owner.reagents.add_reagent(/singleton/reagent/kois, 5)
if(stage >= 4)
if(prob(10))
@@ -98,8 +98,8 @@
var/turf/T = get_turf(owner)
var/datum/reagents/R = new/datum/reagents(100)
R.add_reagent(/decl/reagent/kois,10)
R.add_reagent(/decl/reagent/toxin/phoron,10)
R.add_reagent(/singleton/reagent/kois,10)
R.add_reagent(/singleton/reagent/toxin/phoron,10)
var/datum/effect/effect/system/smoke_spread/chem/spores/S = new("koisspore")
S.attach(T)
@@ -154,7 +154,7 @@
if(prob(5))
to_chat(owner, "<span class='warning'>You feel something squirming inside of you!</span>")
owner.reagents.add_reagent(/decl/reagent/kois/black, 4)
owner.reagents.add_reagent(/singleton/reagent/kois/black, 4)
else if(prob(5))
to_chat(owner, "In your struggle, a part of you wishes for the spread to continue.")
@@ -199,7 +199,7 @@
var/turf/T = get_turf(owner)
var/datum/reagents/R = new/datum/reagents(20)
R.add_reagent(/decl/reagent/kois/black,5)
R.add_reagent(/singleton/reagent/kois/black,5)
var/datum/effect/effect/system/smoke_spread/chem/spores/S = new("blackkois")
S.attach(T)