reagent holder rework (#6903)

- reagents are now singletons
- most of reagent holder datums are refactored.
This commit is contained in:
silicons
2025-03-06 20:44:34 +01:00
committed by GitHub
parent 03a5b8a3bf
commit ef19e75993
180 changed files with 4282 additions and 3903 deletions
+2 -2
View File
@@ -805,7 +805,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if(!(W.can_autoheal() || (bicardose && inaprovaline) || myeldose)) //bicaridine and inaprovaline stop internal wounds from growing bigger with time, unless it is so small that it is already healing
W.open_wound(0.1)
owner.vessel.remove_reagent("blood", W.damage/40) //line should possibly be moved to handle_blood, so all the bleeding stuff is in one place.
owner.erase_blood(W.damage / 40)
if(prob(1))
owner.custom_pain("You feel a stabbing pain in your [name]!", 50)
@@ -1170,7 +1170,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if(company)
model = company
var/datum/robolimb/R = GLOB.all_robolimbs[company]
var/datum/robolimb/R = GLOB.all_robolimbs[isnum(company) ? GLOB.all_robolimbs[company] : company]
if(!R || (species && (species.name in R.species_cannot_use)))
R = GLOB.basic_robolimb
if(R)
+1 -1
View File
@@ -19,7 +19,7 @@
if((damage > 5 || damage + burn_dam >= 15) && type == WOUND_TYPE_BURN && (robotic < ORGAN_ROBOT) && !(species.species_flags & NO_BLOOD))
var/fluid_loss = 0.4 * (damage/(owner.getMaxHealth() - owner.getMinHealth())) * owner.species.blood_volume*(1 - owner.species.blood_level_fatal)
owner.remove_blood(fluid_loss)
owner.erase_blood(fluid_loss)
// first check whether we can widen an existing wound
if(length(wounds) > 0 && prob(max(50+(wound_tally-1)*10,90)))
+12 -12
View File
@@ -16,19 +16,19 @@
owner.reagents.add_reagent(chem, 5)
// They're also super gross and ooze ichor.
if(prob(5))
var/mob/living/carbon/human/H = owner
if(!istype(H))
return
// if(prob(5))
// var/mob/living/carbon/human/H = owner
// if(!istype(H))
// return
var/datum/reagent/blood/B = locate(/datum/reagent/blood) in H.vessel.reagent_list
blood_splatter(H,B,1)
var/obj/effect/debris/cleanable/blood/splatter/goo = locate() in get_turf(owner)
if(goo)
goo.name = "husk ichor"
goo.desc = "It's thick and stinks of decay."
goo.basecolor = "#412464"
goo.update_icon()
// var/datum/reagent/blood/B = locate(/datum/reagent/blood) in H.vessel.reagent_list
// blood_splatter(H,B,1)
// var/obj/effect/debris/cleanable/blood/splatter/goo = locate() in get_turf(owner)
// if(goo)
// goo.name = "husk ichor"
// goo.desc = "It's thick and stinks of decay."
// goo.basecolor = "#412464"
// goo.update_icon()
/obj/item/organ/internal/borer/removed(var/mob/living/user)
@@ -17,15 +17,13 @@
..()
if(!owner) return
var/datum/reagent/coffee = locate(/datum/reagent/drink/coffee) in owner.reagents.reagent_list
if(coffee)
if(owner.reagents.has_reagent(/datum/reagent/drink/coffee::id))
if(is_bruised())
owner.adjustToxLoss(0.1 * (delta_time * 5))
else if(is_broken())
owner.adjustToxLoss(0.3 * (delta_time * 5))
var/datum/reagent/sugar = locate(/datum/reagent/sugar) in owner.reagents.reagent_list
if(sugar)
if(owner.reagents.has_reagent(/datum/reagent/sugar::id))
if(is_bruised())
owner.adjustToxLoss(0.1 * (delta_time * 5))
else if(is_broken())
@@ -12,7 +12,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/datum/reagent/coffee = locate(/datum/reagent/drink/coffee) in owner.reagents.reagent_list
var/datum/reagent/coffee = locate(/datum/reagent/drink/coffee) in owner.reagents.get_reagent_datums()
if(coffee)
if(is_bruised())
owner.adjustToxLoss(0.1 * (dt * 5))
+22 -18
View File
@@ -367,9 +367,9 @@
rejecting = null
if(istype(owner))
var/datum/reagent/blood/organ_blood = locate(/datum/reagent/blood) in reagents.reagent_list
if(!organ_blood || !organ_blood.data["blood_DNA"])
owner.vessel.trans_to(src, 5, 1, 1)
if(!reagents.has_reagent(/datum/reagent/blood::id))
var/datum/blood_mixture/owner_mixture = owner.take_blood_mixture(5, TRUE)
reagents.add_reagent(/datum/reagent/blood::id, 5, owner_mixture)
if(owner && vital && !ignore_vital)
if(user)
@@ -383,19 +383,20 @@
reconsider_processing()
/obj/item/organ/proc/replaced(var/mob/living/carbon/human/target,var/obj/item/organ/external/affected)
if(!istype(target))
return
if(!istype(target)) return
var/datum/reagent/blood/transplant_blood = locate(/datum/reagent/blood) in reagents.reagent_list
var/datum/blood_mixture/mixture_data = reagents.get_reagent_data(/datum/reagent/blood)
transplant_data = list()
if(!transplant_blood)
if(!mixture_data?.unsafe_get_fragment_ref(1))
transplant_data["species"] = target?.species.name
transplant_data["blood_type"] = target?.dna.b_type
transplant_data["blood_DNA"] = target?.dna.unique_enzymes
else
transplant_data["species"] = transplant_blood?.data["species"]
transplant_data["blood_type"] = transplant_blood?.data["blood_type"]
transplant_data["blood_DNA"] = transplant_blood?.data["blood_DNA"]
var/datum/blood_fragment/use_fragment = mixture_data.unsafe_get_fragment_ref(1)
transplant_data["species"] = use_fragment.legacy_species
transplant_data["blood_type"] = use_fragment.legacy_blood_type
transplant_data["blood_DNA"] = use_fragment.legacy_blood_dna
owner = target
loc = owner
@@ -474,10 +475,9 @@
//Process infections
if(reagents)
var/datum/reagent/blood/B = locate(/datum/reagent/blood) in reagents.reagent_list
if(B && prob(40))
reagents.remove_reagent("blood",0.1)
blood_splatter(src,B,1)
if(reagents.has_reagent(/datum/reagent/blood::id) && prob(40) && get_turf(src))
blood_splatter_legacy(get_turf(src), reagents.reagent_datas[/datum/reagent/blood::id], FALSE)
reagents.remove_reagent(/datum/reagent/blood, 0.1)
adjust_germ_level(rand(2,6))
if(germ_level >= INFECTION_LEVEL_TWO)
adjust_germ_level(rand(2,6))
@@ -630,7 +630,7 @@
// immunosuppressant that changes transplant data to make it match.
if(dna && can_reject)
if(!rejecting)
if(blood_incompatible(dna.b_type, owner.dna.b_type, species.name, owner.species.name)) // Process species by name.
if(!legacy_blood_compatible_with_self(owner.dna.b_type, dna.b_type, owner.species.name, species.name))
rejecting = 1
else
rejecting++ //Rejection severity increases over time.
@@ -651,9 +651,13 @@
if(robotic >= ORGAN_ROBOT)
return
to_chat(user, SPAN_NOTICE("You take an experimental bite out of \the [src]."))
var/datum/reagent/blood/B = locate(/datum/reagent/blood) in reagents.reagent_list
blood_splatter(src,B,1)
user.visible_message(
SPAN_BOLDWARNING("[user] takes an experimental bite out of \the [src]!"),
SPAN_BOLDWARNING("You take an experimental bite out of \the [src]!"),
SPAN_WARNING("You hear a sickening chewing sound."),
MESSAGE_RANGE_INVENTORY_HARD,
)
blood_splatter_legacy(get_turf(src), reagents.reagent_datas?[/datum/reagent/blood::id], TRUE)
user.temporarily_remove_from_inventory(src, INV_OP_FORCE)