mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 07:03:30 +01:00
Merge pull request #3838 from Crazylemon64/slime_blood_work_right_dangit
Skeletons, Slime people, and other bloodless races no longer bleed
This commit is contained in:
@@ -1,15 +1,9 @@
|
||||
/mob/living/carbon/hitby(atom/movable/AM)
|
||||
// if(!skip) //ugly, but easy
|
||||
// message_admins("Skip Check Passed")
|
||||
if(in_throw_mode && !get_active_hand()) //empty active hand and we're in throw mode
|
||||
// message_admins("In Throw Mode and active hand check passed")
|
||||
if(canmove && !restrained())
|
||||
// message_admins("Restrained/moving check passed")
|
||||
if(istype(AM, /obj/item))
|
||||
// message_admins("Item check passed")
|
||||
var/obj/item/I = AM
|
||||
if(isturf(I.loc))
|
||||
// message_admins("Turf check passed")
|
||||
put_in_active_hand(I)
|
||||
visible_message("<span class='warning'>[src] catches [I]!</span>")
|
||||
throw_mode_off()
|
||||
|
||||
@@ -1308,7 +1308,8 @@
|
||||
/mob/living/carbon/human/revive()
|
||||
|
||||
if(species && !(species.flags & NO_BLOOD))
|
||||
vessel.add_reagent("blood",560-vessel.total_volume)
|
||||
var/blood_reagent = get_blood_name()
|
||||
vessel.add_reagent(blood_reagent, max_blood-vessel.total_volume)
|
||||
fixblood()
|
||||
|
||||
// Fix up all organs.
|
||||
|
||||
@@ -91,12 +91,27 @@ var/const/INGEST = 2
|
||||
|
||||
return the_id
|
||||
|
||||
/datum/reagents/proc/trans_to(var/obj/target, var/amount=1, var/multiplier=1, var/preserve_data=1)//if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred.
|
||||
if (!target )
|
||||
/datum/reagents/proc/trans_to(var/target, var/amount=1, var/multiplier=1, var/preserve_data=1)//if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred.
|
||||
if (!target)
|
||||
return
|
||||
if (!target.reagents || src.total_volume<=0)
|
||||
if(src.total_volume <= 0)
|
||||
return
|
||||
var/datum/reagents/R = target.reagents
|
||||
var/datum/reagents/R
|
||||
if(istype(target, /obj))
|
||||
var/obj/O = target
|
||||
if (!O.reagents )
|
||||
return
|
||||
R = O.reagents
|
||||
else if (istype(target, /mob/living))
|
||||
var/mob/living/M = target
|
||||
if(!M.reagents)
|
||||
return
|
||||
R = M.reagents
|
||||
else if(istype(target, /datum/reagents))
|
||||
R = target
|
||||
else
|
||||
return
|
||||
|
||||
amount = min(min(amount, src.total_volume), R.maximum_volume-R.total_volume)
|
||||
var/part = amount / src.total_volume
|
||||
var/trans_data = null
|
||||
@@ -605,6 +620,14 @@ atom/proc/create_reagents(var/max_vol)
|
||||
reagents = new/datum/reagents(max_vol)
|
||||
reagents.my_atom = src
|
||||
|
||||
/datum/reagents/proc/get_reagent_from_id(var/id)
|
||||
var/datum/reagent/result = null
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
if(R.id == id)
|
||||
result = R
|
||||
break
|
||||
return result
|
||||
|
||||
/datum/reagents/Destroy()
|
||||
. = ..()
|
||||
processing_objects.Remove(src)
|
||||
|
||||
@@ -184,16 +184,18 @@
|
||||
if(!istype(T)) return
|
||||
var/datum/reagent/blood/self = src
|
||||
src = null
|
||||
if(!(volume >= 3)) return
|
||||
var/big_splash = 1
|
||||
if(volume < 3)
|
||||
big_splash = 0
|
||||
//var/datum/disease/D = self.data["virus"]
|
||||
if(!self.data["donor"] || istype(self.data["donor"], /mob/living/carbon/human))
|
||||
blood_splatter(T, src, big_splash)
|
||||
var/obj/effect/decal/cleanable/blood/blood_prop = locate() in T //find some blood here
|
||||
if(!blood_prop) //first blood!
|
||||
blood_prop = new(T)
|
||||
blood_prop.blood_DNA[self.data["blood_DNA"]] = self.data["blood_type"]
|
||||
|
||||
if(self.data["virus2"])
|
||||
blood_prop.virus2 = virus_copylist(self.data["virus2"])
|
||||
if(blood_prop)
|
||||
blood_prop.blood_DNA[self.data["blood_DNA"]] = self.data["blood_type"]
|
||||
if(self.data["virus2"])
|
||||
blood_prop.virus2 = virus_copylist(self.data["virus2"])
|
||||
|
||||
else if(istype(self.data["donor"], /mob/living/carbon/alien))
|
||||
var/obj/effect/decal/cleanable/blood/xeno/blood_prop = locate() in T
|
||||
|
||||
@@ -16,13 +16,13 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
|
||||
if(vessel)
|
||||
return
|
||||
|
||||
vessel = new/datum/reagents(600)
|
||||
vessel = new/datum/reagents(max_blood)
|
||||
vessel.my_atom = src
|
||||
|
||||
if(species && species.exotic_blood)
|
||||
vessel.add_reagent(species.exotic_blood,560)
|
||||
vessel.add_reagent(species.exotic_blood, max_blood)
|
||||
else
|
||||
vessel.add_reagent("blood",560)
|
||||
vessel.add_reagent("blood", max_blood)
|
||||
spawn(1)
|
||||
fixblood()
|
||||
|
||||
@@ -41,18 +41,21 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
|
||||
return
|
||||
if(stat != DEAD && bodytemperature >= 170) //Dead or cryosleep people do not pump the blood.
|
||||
if(species.exotic_blood)
|
||||
blood_volume = round(vessel.get_reagent_amount(species.exotic_blood))
|
||||
if(blood_volume < 560 && blood_volume)
|
||||
var/datum/reagent/water/W = locate() in vessel.reagent_list //Grab some blood
|
||||
if(W) // Make sure there's some blood at all
|
||||
W.volume += 0.1 // regenerate blood VERY slowly
|
||||
if (reagents.has_reagent("nutriment")) //Getting food speeds it up
|
||||
W.volume += 0.4
|
||||
reagents.remove_reagent("nutriment", 0.1)
|
||||
var/blood_reagent = species.exotic_blood // This is a string of the name of the species' blood reagent
|
||||
blood_volume = round(vessel.get_reagent_amount(blood_reagent))
|
||||
if(blood_volume < max_blood && blood_volume)
|
||||
vessel.add_reagent(blood_reagent, 0.1) // regenerate blood VERY slowly
|
||||
if (reagents.has_reagent("nutriment")) //Getting food speeds it up
|
||||
vessel.add_reagent(blood_reagent, 0.4)
|
||||
reagents.remove_reagent("nutriment", 0.1)
|
||||
else if (reagents.has_reagent(blood_reagent))
|
||||
vessel.add_reagent(blood_reagent, 0.4)
|
||||
reagents.remove_reagent(blood_reagent, 0.4)
|
||||
|
||||
else
|
||||
blood_volume = round(vessel.get_reagent_amount("blood"))
|
||||
//Blood regeneration if there is some space
|
||||
if(blood_volume < 560 && blood_volume)
|
||||
if(blood_volume < max_blood && blood_volume)
|
||||
var/datum/reagent/blood/B = locate() in vessel.reagent_list //Grab some blood
|
||||
if(B) // Make sure there's some blood at all
|
||||
|
||||
@@ -74,16 +77,16 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
|
||||
B = D
|
||||
break
|
||||
|
||||
B.volume += 0.1 // regenerate blood VERY slowly
|
||||
vessel.add_reagent("blood", 0.1) // regenerate blood VERY slowly
|
||||
if (reagents.has_reagent("nutriment")) //Getting food speeds it up
|
||||
B.volume += 0.4
|
||||
vessel.add_reagent("blood", 0.4)
|
||||
reagents.remove_reagent("nutriment", 0.1)
|
||||
if (reagents.has_reagent("iron")) //Hematogen candy anyone?
|
||||
B.volume += 0.8
|
||||
vessel.add_reagent("blood", 0.8)
|
||||
reagents.remove_reagent("iron", 0.1)
|
||||
if (reagents.has_reagent("salglu_solution")) //saline is good for blood regeneration
|
||||
if(prob(33))
|
||||
B.volume += 1.0
|
||||
vessel.add_reagent("blood", 1.0)
|
||||
|
||||
// Damaged heart virtually reduces the blood volume, as the blood isn't
|
||||
// being pumped properly anymore.
|
||||
@@ -187,12 +190,10 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
|
||||
//Gets blood from mob to the container, preserving all data in it.
|
||||
/mob/living/carbon/proc/take_blood(obj/item/weapon/reagent_containers/container, var/amount)
|
||||
var/datum/reagent/B = get_blood(container.reagents)
|
||||
if(!B) B = new /datum/reagent/blood
|
||||
if(!istype(B, /datum/reagent/blood)) B = new /datum/reagent/blood
|
||||
B.holder = container
|
||||
B.volume += amount
|
||||
|
||||
|
||||
|
||||
//set reagent data
|
||||
B.data["donor"] = src
|
||||
if (!B.data["virus2"])
|
||||
@@ -241,7 +242,7 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
|
||||
//Transfers blood from container ot vessels
|
||||
/mob/living/carbon/proc/inject_blood(obj/item/weapon/reagent_containers/container, var/amount)
|
||||
var/datum/reagent/blood/injected = get_blood(container.reagents)
|
||||
if (!injected)
|
||||
if (!istype(injected))
|
||||
return
|
||||
var/list/sniffles = virus_copylist(injected.data["virus2"])
|
||||
for(var/ID in sniffles)
|
||||
@@ -269,7 +270,7 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
|
||||
|
||||
var/datum/reagent/blood/our = get_blood(vessel)
|
||||
|
||||
if (!injected || !our)
|
||||
if (!istype(injected) || !istype(our))
|
||||
return
|
||||
if(blood_incompatible(injected.data["blood_type"],our.data["blood_type"]) )
|
||||
reagents.add_reagent("toxin",amount * 0.5)
|
||||
@@ -289,6 +290,21 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
|
||||
return D
|
||||
return res
|
||||
|
||||
/mob/living/carbon/human/get_blood(datum/reagents/container)
|
||||
if(species.exotic_blood)
|
||||
return container.get_reagent_from_id(species.exotic_blood)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/proc/get_blood_name()
|
||||
return "blood"
|
||||
|
||||
/mob/living/carbon/human/get_blood_name()
|
||||
if(species.exotic_blood)
|
||||
return species.exotic_blood
|
||||
else
|
||||
return ..()
|
||||
|
||||
/proc/blood_incompatible(donor,receiver)
|
||||
|
||||
var/donor_antigen = copytext(donor,1,lentext(donor))
|
||||
@@ -307,15 +323,34 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
|
||||
//AB is a universal receiver.
|
||||
return 0
|
||||
|
||||
proc/blood_splatter(var/target,var/datum/reagent/blood/source,var/large)
|
||||
/*
|
||||
Target: Thing/tile to get bloody
|
||||
Source: Human or blood reagent
|
||||
Large: Whether the splat should be big or not
|
||||
*/
|
||||
/proc/blood_splatter(var/target,var/source,var/large = 0)
|
||||
|
||||
var/obj/effect/decal/cleanable/blood/B
|
||||
var/decal_type = /obj/effect/decal/cleanable/blood/splatter
|
||||
var/turf/T = get_turf(target)
|
||||
|
||||
var/datum/reagent/blood/bld
|
||||
if(istype(source,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/M = source
|
||||
source = M.get_blood(M.vessel)
|
||||
var/mob/living/carbon/human/H = source
|
||||
bld = H.get_blood(H.vessel)
|
||||
if(H.species.exotic_blood)
|
||||
H.vessel.reaction(T, TOUCH)
|
||||
return
|
||||
else if(H.species.flags & NO_BLOOD)
|
||||
return
|
||||
else if(istype(source, /datum/reagent))
|
||||
bld = source
|
||||
if(!istype(bld, /datum/reagent/blood))
|
||||
var/datum/reagent/R = bld
|
||||
if(istype(R))
|
||||
R.reaction_turf(T, R.volume)
|
||||
return
|
||||
else if(source)
|
||||
log_to_dd("Non-human or reagent blood source. Area: [get_area(source)], Name: [source]")
|
||||
|
||||
// Are we dripping or splattering?
|
||||
var/list/drips = list()
|
||||
@@ -337,24 +372,24 @@ proc/blood_splatter(var/target,var/datum/reagent/blood/source,var/large)
|
||||
drop.drips |= drips
|
||||
|
||||
// If there's no data to copy, call it quits here.
|
||||
if(!source)
|
||||
if(!bld)
|
||||
return B
|
||||
|
||||
// Update appearance.
|
||||
if(source.data["blood_colour"])
|
||||
B.basecolor = source.data["blood_colour"]
|
||||
if(bld.data["blood_colour"])
|
||||
B.basecolor = bld.data["blood_colour"]
|
||||
B.update_icon()
|
||||
|
||||
// Update blood information.
|
||||
if(source.data["blood_DNA"])
|
||||
if(bld.data["blood_DNA"])
|
||||
B.blood_DNA = list()
|
||||
if(source.data["blood_type"])
|
||||
B.blood_DNA[source.data["blood_DNA"]] = source.data["blood_type"]
|
||||
if(bld.data["blood_type"])
|
||||
B.blood_DNA[bld.data["blood_DNA"]] = bld.data["blood_type"]
|
||||
else
|
||||
B.blood_DNA[source.data["blood_DNA"]] = "O+"
|
||||
B.blood_DNA[bld.data["blood_DNA"]] = "O+"
|
||||
|
||||
// Update virus information.
|
||||
if(source.data["virus2"])
|
||||
B.virus2 = virus_copylist(source.data["virus2"])
|
||||
if(bld.data["virus2"])
|
||||
B.virus2 = virus_copylist(bld.data["virus2"])
|
||||
|
||||
return B
|
||||
@@ -86,11 +86,11 @@ var/list/organ_cache = list()
|
||||
return
|
||||
|
||||
if(!owner)
|
||||
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 && prob(40))
|
||||
reagents.remove_any(0.1)
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
R.reaction_turf(get_turf(src), 0.1)
|
||||
|
||||
// Maybe scale it down a bit, have it REALLY kick in once past the basic infection threshold
|
||||
// Another mercy for surgeons preparing transplant organs
|
||||
germ_level++
|
||||
@@ -268,8 +268,8 @@ var/list/organ_cache = list()
|
||||
loc = get_turf(owner)
|
||||
processing_objects |= src
|
||||
var/datum/reagent/blood/organ_blood
|
||||
if(reagents) organ_blood = locate(/datum/reagent/blood) in reagents.reagent_list
|
||||
if(!organ_blood || !organ_blood.data["blood_DNA"])
|
||||
if(reagents) organ_blood = reagents.get_reagent_from_id(owner.get_blood_name())
|
||||
if((!organ_blood || !organ_blood.data["blood_DNA"]) && (owner && !(owner.species.flags & NO_BLOOD)))
|
||||
owner.vessel.trans_to(src, 5, 1, 1)
|
||||
|
||||
if(owner && vital && is_primary_organ()) // I'd do another check for species or whatever so that you couldn't "kill" an IPC by removing a human head from them, but it doesn't matter since they'll come right back from the dead
|
||||
|
||||
Reference in New Issue
Block a user