Blood Refactor (#6220)

* commit for branch swap

* branch swap again

* BLEED

* trying to clear up compile errors

* i killed everything when i tested this...

* restorealltheblood

* I REMOVED A THING

* well some progress

* stop bleeding

* got to swap branches again.

* grr

* damn bloodcolors

* Squash everything

* color....colourrrrrrr

* color....colourrrrrrr

* well now that updated the branch...

* Changes

* Some tweaks..before i upload something major

* COLOR NOT COLOUR...COLOR

YES I KNOW NOT EVERYONE SPELLS IT LIKE THAT BUT MY GOD

* Foot print shit..

blood coloring is going to be PAIN

* trying to handle some colors..maybe.

* blood colorsing sucks..di i mention this?

* commenting cod malfunctions.

* Changes

* lets try this

* Its too late at night.

* blargh

* woops

* almost works...

* progress..

* Branch swap

* figured out the overlay issue....

* BRANCH SWAP

* BLARGH

* fixed merged conflicts..expect something to be horribly wrong.

* bunch of changes

* Major Fixes

 - Moved blood_state and bloodiness var definitions to
 /obj/effect/decal/cleanable/blood as well as /cleanable/Crossed(), in
 order to make blood color work properly.
   - These were not used by any other decal, so it was pointless.
 - Tweaked human/add_blood so that hand_blood_color uses the correct
 value now.
 - Corrected gibs having the wrong basecolor.
 - Tracks of different blood colors will no longer combine weirdly, and
 will instead form seperate overlays.
   - This also fixes all of the issues with tracks in general and not
   updating correctly.
 - Fixed transfering blood in add_fingerprint; the old detective code
 didn't use the new format for add_blood().
 - Fixed xenomorphs causing runtimes in makeTrail(), and gave them their
 own trails. Sprites should probably be brightened later.
 - Fixed mobs occasionally randomly having their blood_DNA list reset.

* may have accidently removed shit.

* Mrowl

* stiff

water is not bleeding
lowered trail making threshold

* tweaks then conflcits

* weee

* indent

* some tweaks

* somefox tweaks.

* derp

* why won't they bleed!?

* BLEED DAMMIT

* Flattist comments and removes simple animale blood volume

Cause i cannot get it to work right.

* PRAISE FLATTIST

* Simple animals have a blood volume now

Bug with trail fixed.

* changes

* thanksmrowlmrowl

* exotice blood trails

* makesure is an exotic bleeder has a bleed rate first...

* FoxBoxTweakSox

* BoxVoxSoXFox

* ONE MORE THING

* animalsbleedreds

* Buh? BUGH!

* thisismescreaming

* removing note needed thing

* Color changes but the rabbit hole continues.

* This is not pretty....

* wot

* IT WORKS DAMMIT

* colors.

* germaphobic commit..

* we have to use the old system

* nothing to see here

* doubleprocarady

* try to fix mulebots

* mulebot fixed

* DONE
This commit is contained in:
Aurorablade
2017-07-11 16:49:11 -04:00
committed by Fox McCloud
parent cf7c028659
commit 476cdc3e06
73 changed files with 957 additions and 1047 deletions
+2
View File
@@ -372,6 +372,8 @@ BLIND // can't see anything
var/silence_steps = 0
var/shoe_sound_footstep = 1
var/shoe_sound = null
var/blood_state = BLOOD_STATE_NOT_BLOODY
var/list/bloody_shoes = list(BLOOD_STATE_HUMAN = 0, BLOOD_STATE_XENO = 0, BLOOD_STATE_NOT_BLOODY = 0)
permeability_coefficient = 0.50
slowdown = SHOES_SLOWDOWN
@@ -6,10 +6,10 @@ atom/proc/add_fibers(mob/living/carbon/human/M)
if(M.gloves && istype(M.gloves,/obj/item/clothing/))
var/obj/item/clothing/gloves/G = M.gloves
if(G.transfer_blood > 1) //bloodied gloves transfer blood to touched objects
if(add_blood(G.bloody_hands_mob)) //only reduces the bloodiness of our gloves if the item wasn't already bloody
if(add_blood(G.blood_DNA, G.blood_color)) //only reduces the bloodiness of our gloves if the item wasn't already bloody
G.transfer_blood--
else if(M.bloody_hands > 1)
if(add_blood(M.bloody_hands_mob))
if(add_blood(M.blood_DNA, M.hand_blood_color))
M.bloody_hands--
if(!suit_fibers) suit_fibers = list()
var/fibertext
@@ -1,18 +1,13 @@
/mob
var/bloody_hands = 0
var/mob/living/carbon/human/bloody_hands_mob
var/track_blood = 0
var/list/feet_blood_DNA
var/track_blood_type
var/feet_blood_color
var/blood_state = BLOOD_STATE_NOT_BLOODY
var/list/bloody_feet = list(BLOOD_STATE_HUMAN = 0, BLOOD_STATE_XENO = 0, BLOOD_STATE_NOT_BLOODY = 0)
/obj/item/clothing/gloves
var/transfer_blood = 0
var/mob/living/carbon/human/bloody_hands_mob
/obj/item/clothing/shoes/
var/track_blood = 0
/obj/item/weapon/reagent_containers/glass/rag
name = "damp rag"
@@ -294,3 +294,9 @@ Des: Removes all infected images from the alien.
playsound(T, S, volume, 1, range)
return 1
return 0
/mob/living/carbon/alien/getTrail()
if(getBruteLoss() < 200)
return pick("xltrails_1", "xltrails_2")
else
return pick("xttrails_1", "xttrails_2")
+1 -16
View File
@@ -107,7 +107,7 @@
for(var/i=0 to distance)
if(blood)
if(T)
T.add_blood_floor(src)
add_splatter_floor(T)
if(stun)
adjustBruteLoss(3)
else
@@ -477,21 +477,6 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
if(istype(loc, /obj/machinery/atmospherics))
add_ventcrawl(loc)
/mob/living/carbon/clean_blood()
. = ..()
if(ishuman(src))
var/mob/living/carbon/human/H = src
if(H.gloves)
if(H.gloves.clean_blood())
H.update_inv_gloves(0,0)
H.gloves.germ_level = 0
else
if(H.bloody_hands)
H.bloody_hands = 0
H.update_inv_gloves(0,0)
H.germ_level = 0
update_icons() //apply the now updated overlays to the mob
//Throwing stuff
@@ -30,3 +30,5 @@
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.
var/co2overloadtime = null
blood_volume = BLOOD_VOLUME_NORMAL
@@ -441,6 +441,11 @@
if(display_gloves)
msg += "<span class='warning'><b>[src] has blood running from under [t_his] gloves!</b></span>\n"
if(blood_volume < BLOOD_VOLUME_SAFE)
msg += "[t_He] [t_has] pale skin.\n"
if(bleedsuppress)
msg += "[t_He] [t_is] bandaged with something.\n"
if(digitalcamo)
msg += "[t_He] [t_is] repulsively uncanny!\n"
if(!(skipface || ( wear_mask && ( wear_mask.flags_inv & HIDEFACE || wear_mask.flags_cover & MASKCOVERSMOUTH) ) ) && is_thrall(src) && in_range(user,src))
+6 -30
View File
@@ -33,7 +33,6 @@
create_reagents(330)
prev_gender = gender // Debug for plural genders
make_blood()
martial_art = default_martial_art
@@ -539,12 +538,10 @@
popup.open()
// called when something steps onto a human
// this handles mulebots and vehicles
/mob/living/carbon/human/Crossed(var/atom/movable/AM)
if(istype(AM, /obj/vehicle))
var/obj/vehicle/V = AM
V.RunOver(src)
/mob/living/carbon/human/Crossed(atom/movable/AM)
var/mob/living/simple_animal/bot/mulebot/MB = AM
if(istype(MB))
MB.RunOver(src)
// Get rank from ID, ID inside PDA, PDA, ID in wallet, etc.
/mob/living/carbon/human/proc/get_authentification_rank(var/if_no_id = "No id", var/if_no_job = "No job")
@@ -1255,12 +1252,6 @@
I.insert(H)
/mob/living/carbon/human/revive()
if(species && !(species.flags & NO_BLOOD))
var/blood_reagent = get_blood_name()
vessel.add_reagent(blood_reagent, max_blood-vessel.total_volume)
fixblood()
//Fix up all organs and replace lost ones.
restore_all_organs() //Rejuvenate and reset all existing organs.
check_and_regenerate_organs(src) //Regenerate limbs and organs only if they're really missing.
@@ -1332,23 +1323,13 @@
*/
//returns 1 if made bloody, returns 0 otherwise
/mob/living/carbon/human/add_blood(mob/living/carbon/human/M as mob)
if(!..())
return 0
//if this blood isn't already in the list, add it
if(blood_DNA[M.dna.unique_enzymes])
return 0 //already bloodied with this blood. Cannot add more.
blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
hand_blood_color = blood_color
src.update_inv_gloves()
verbs += /mob/living/carbon/human/proc/bloody_doodle
return 1 //we applied blood to the item
/mob/living/carbon/human/clean_blood(var/clean_feet)
.=..()
if(clean_feet && !shoes && istype(feet_blood_DNA, /list) && feet_blood_DNA.len)
feet_blood_color = null
qdel(feet_blood_DNA)
bloody_feet = list(BLOOD_STATE_HUMAN = 0, BLOOD_STATE_XENO = 0, BLOOD_STATE_NOT_BLOODY = 0)
blood_state = BLOOD_STATE_NOT_BLOODY
update_inv_shoes(1)
return 1
@@ -1443,10 +1424,6 @@
tail = species.tail
if(vessel)
vessel = null
make_blood()
maxHealth = species.total_health
toxins_alert = 0
@@ -1543,7 +1520,6 @@
overlays.Cut()
update_mutantrace(1)
regenerate_icons()
fixblood()
if(!delay_icon_update)
UpdateAppearance()
@@ -300,15 +300,6 @@
////////////////////////////////////////////
/*
This function restores the subjects blood to max.
*/
/mob/living/carbon/human/proc/restore_blood()
if(!(species.flags & NO_BLOOD))
var/blood_type = get_blood_name()
var/blood_volume = vessel.get_reagent_amount(blood_type)
vessel.add_reagent(blood_type, BLOOD_VOLUME_NORMAL - blood_volume)
/*
This function restores all organs.
*/
@@ -8,6 +8,7 @@ emp_act
*/
/mob/living/carbon/human/bullet_act(obj/item/projectile/P, def_zone)
if(P.is_reflectable)
@@ -185,7 +186,7 @@ emp_act
newmeat.subjectjob = src.job
newmeat.reagents.add_reagent ("nutriment", (src.nutrition / 15) / 3)
src.reagents.trans_to (newmeat, round ((src.reagents.total_volume) / 3, 1))
src.loc.add_blood(src)
add_mob_blood(src)
--src.meatleft
to_chat(user, "<span class='warning'>You hack off a chunk of meat from [src.name]</span>")
if(!src.meatleft)
@@ -232,19 +233,18 @@ emp_act
var/bloody = 0
if(I.damtype == BRUTE && I.force && prob(25 + I.force * 2))
I.add_blood(src) //Make the weapon bloody, not the person.
I.add_mob_blood(src) //Make the weapon bloody, not the person.
// if(user.hand) user.update_inv_l_hand() //updates the attacker's overlay for the (now bloodied) weapon
// else user.update_inv_r_hand() //removed because weapons don't have on-mob blood overlays
if(prob(33))
if(prob(I.force * 2)) //blood spatter!
bloody = 1
var/turf/location = loc
if(istype(location, /turf/simulated))
location.add_blood(src)
add_splatter_floor(location)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(get_dist(H, src) <= 1) //people with TK won't get smeared with blood
H.bloody_body(src)
H.bloody_hands(src)
H.add_mob_blood(src)
if(!stat)
switch(hit_area)
@@ -260,15 +260,16 @@ emp_act
if(bloody)//Apply blood
if(wear_mask)
wear_mask.add_blood(src)
wear_mask.add_mob_blood(src)
update_inv_wear_mask(0)
if(head)
head.add_blood(src)
head.add_mob_blood(src)
update_inv_head(0,0)
if(glasses && prob(33))
glasses.add_blood(src)
glasses.add_mob_blood(src)
update_inv_glasses(0)
if("upper body")//Easier to score a stun but lasts less time
if(stat == CONSCIOUS && I.force && prob(I.force + 10))
visible_message("<span class='combat danger'>[src] has been knocked down!</span>", \
@@ -276,7 +277,13 @@ emp_act
apply_effect(5, WEAKEN, armor)
if(bloody)
bloody_body(src)
if(wear_suit)
wear_suit.add_mob_blood(src)
update_inv_wear_suit(1)
if(w_uniform)
w_uniform.add_mob_blood(src)
update_inv_w_uniform(1)
if(Iforce > 10 || Iforce >= 5 && prob(33))
@@ -313,22 +320,20 @@ emp_act
/mob/living/carbon/human/proc/bloody_hands(var/mob/living/source, var/amount = 2)
if(gloves)
gloves.add_blood(source)
gloves.add_mob_blood(source)
gloves:transfer_blood = amount
gloves:bloody_hands_mob = source
else
add_blood(source)
add_mob_blood(source)
bloody_hands = amount
bloody_hands_mob = source
update_inv_gloves(1) //updates on-mob overlays for bloody hands and/or bloody gloves
/mob/living/carbon/human/proc/bloody_body(var/mob/living/source)
if(wear_suit)
wear_suit.add_blood(source)
wear_suit.add_mob_blood(source)
update_inv_wear_suit(0)
return
if(w_uniform)
w_uniform.add_blood(source)
w_uniform.add_mob_blood(source)
update_inv_w_uniform(1)
/mob/living/carbon/human/proc/handle_suit_punctures(var/damtype, var/damage)
@@ -65,6 +65,8 @@ var/global/default_martial_art = new/datum/martial_art
var/meatleft = 3 //For chef item
var/decaylevel = 0 // For rotting bodies
var/max_blood = BLOOD_VOLUME_NORMAL // For stuff in the vessel
var/bleed_rate = 0
var/bleedsuppress = 0 //for stopping bloodloss
var/check_mutations=0 // Check mutations on next life tick
@@ -35,12 +35,52 @@
/mob/living/carbon/human/Move(NewLoc, direct)
. = ..()
if(shoes && .) // did we actually move?
if(.) // did we actually move?
if(!lying && !buckled)
var/obj/item/clothing/shoes/S = shoes
if(!has_gravity(loc))
return
var/obj/item/clothing/shoes/S = shoes
S.step_action(src)
//Bloody footprints
var/turf/T = get_turf(src)
var/obj/item/organ/external/l_foot = get_organ("l_foot")
var/obj/item/organ/external/r_foot = get_organ("r_foot")
var/hasfeet = 1
if((!l_foot || l_foot.status & ORGAN_DESTROYED) && (!r_foot || r_foot.status & ORGAN_DESTROYED))
hasfeet = 0
if(shoes)
if(S.bloody_shoes && S.bloody_shoes[S.blood_state])
var/obj/effect/decal/cleanable/blood/footprints/oldFP = locate(/obj/effect/decal/cleanable/blood/footprints) in T
if(oldFP && oldFP.blood_state == S.blood_state && oldFP.basecolor == S.blood_color)
return
else
//No oldFP or it's a different kind of blood
S.bloody_shoes[S.blood_state] = max(0, S.bloody_shoes[S.blood_state] - BLOOD_LOSS_PER_STEP)
var/obj/effect/decal/cleanable/blood/footprints/FP = new /obj/effect/decal/cleanable/blood/footprints(T)
FP.blood_state = S.blood_state
FP.entered_dirs |= dir
FP.bloodiness = S.bloody_shoes[S.blood_state]
FP.blood_DNA = S.blood_DNA
FP.basecolor = S.blood_color
FP.update_icon()
update_inv_shoes()
else if(hasfeet)
if(bloody_feet && bloody_feet[blood_state])
var/obj/effect/decal/cleanable/blood/footprints/oldFP = locate(/obj/effect/decal/cleanable/blood/footprints) in T
if(oldFP && oldFP.blood_state == blood_state && oldFP.basecolor == feet_blood_color)
return
else
bloody_feet[blood_state] = max(0, bloody_feet[blood_state] - BLOOD_LOSS_PER_STEP)
var/obj/effect/decal/cleanable/blood/footprints/FP = new /obj/effect/decal/cleanable/blood/footprints(T)
FP.blood_state = blood_state
FP.entered_dirs |= dir
FP.bloodiness = bloody_feet[blood_state]
FP.basecolor = feet_blood_color
FP.update_icon()
update_inv_shoes()
//End bloody footprints
if(S)
S.step_action(src)
/mob/living/carbon/human/handle_footstep(turf/T)
if(..())
+1 -3
View File
@@ -893,7 +893,6 @@
if(!in_stasis)
handle_organs()
handle_blood()
else //dead
@@ -1040,8 +1039,7 @@
var/temp = PULSE_NORM
var/blood_type = get_blood_name()
if(round(vessel.get_reagent_amount(blood_type)) <= BLOOD_VOLUME_BAD) //how much blood do we have
if(blood_volume <= BLOOD_VOLUME_BAD)//how much blood do we have
temp = PULSE_THREADY //not enough :(
if(status_flags & FAKEDEATH)
@@ -519,6 +519,7 @@
"is cracking their exoskeleton!",
"is stabbing themselves with their mandibles!",
"is holding their breath!")
/datum/species/slime
name = "Slime People"
name_plural = "Slime People"
@@ -547,6 +548,7 @@
bodyflags = HAS_SKIN_COLOR | NO_EYES
dietflags = DIET_CARN
reagent_tag = PROCESS_ORG
blood_color = "#0064C8"
exotic_blood = "water"
//ventcrawler = 1 //ventcrawling commented out
butt_sprite = "slime"
@@ -575,7 +577,7 @@
#define SLIMEPERSON_BLOOD_SCALING_FACTOR 5 // Used to adjust how much of an effect the blood has on the rate of color change. Higher is slower.
// Slowly shifting to the color of the reagents
if((H in recolor_list) && H.reagents.total_volume > SLIMEPERSON_COLOR_SHIFT_TRIGGER)
var/blood_amount = H.vessel.total_volume
var/blood_amount = H.blood_volume
var/r_color = mix_color_from_reagents(H.reagents.reagent_list)
var/new_body_color = BlendRGB(r_color, rgb(H.r_skin, H.g_skin, H.b_skin), (blood_amount*SLIMEPERSON_BLOOD_SCALING_FACTOR)/((blood_amount*SLIMEPERSON_BLOOD_SCALING_FACTOR)+(H.reagents.total_volume)))
var/list/new_color_list = ReadRGB(new_body_color)
+3
View File
@@ -9,6 +9,7 @@
if(..())
. = 1
handle_blood()
for(var/obj/item/organ/internal/O in internal_organs)
O.on_life()
handle_changeling()
@@ -196,6 +197,8 @@
return
//remember to remove the "proc" of the child procs of these.
/mob/living/carbon/proc/handle_blood()
return
/mob/living/carbon/proc/handle_changeling()
return
+54 -4
View File
@@ -524,6 +524,7 @@
stat = CONSCIOUS
update_fire()
regenerate_icons()
restore_blood()
if(human_mob)
human_mob.update_eyes()
human_mob.update_dna()
@@ -577,10 +578,10 @@
var/pull_dir = get_dir(src, pulling)
if(get_dist(src, pulling) > 1 || ((pull_dir - 1) & pull_dir)) // puller and pullee more than one tile away or in diagonal position
//if(isliving(pulling))
//var/mob/living/M = pulling
//if(M.lying && !M.buckled && (prob(M.getBruteLoss() * 200 / M.maxHealth)))
//M.makeTrail(T)
if(isliving(pulling))
var/mob/living/M = pulling
if(M.lying && !M.buckled && (prob(M.getBruteLoss() * 200 / M.maxHealth)))
M.makeTrail(T)
pulling.Move(T, get_dir(pulling, T)) // the pullee tries to reach our previous position
if(pulling && get_dist(src, pulling) > 1) // the pullee couldn't keep up
stop_pulling()
@@ -601,6 +602,55 @@
return 1
return 0
/mob/living/proc/makeTrail(turf/T)
if(!has_gravity(src))
return
var/blood_exists = 0
for(var/obj/effect/decal/cleanable/trail_holder/C in loc) //checks for blood splatter already on the floor
blood_exists = 1
if(isturf(loc))
var/trail_type = getTrail()
if(trail_type)
var/brute_ratio = round(getBruteLoss()/maxHealth, 0.1)
if(blood_volume && blood_volume > max(BLOOD_VOLUME_NORMAL*(1 - brute_ratio * 0.25), 0))//don't leave trail if blood volume below a threshold
blood_volume = max(blood_volume - max(1, brute_ratio * 2), 0) //that depends on our brute damage.
var/newdir = get_dir(T, loc)
if(newdir != src.dir)
newdir = newdir | dir
if(newdir == 3) //N + S
newdir = NORTH
else if(newdir == 12) //E + W
newdir = EAST
if((newdir in cardinal) && (prob(50)))
newdir = turn(get_dir(T, loc), 180)
if(!blood_exists)
new /obj/effect/decal/cleanable/trail_holder(loc)
for(var/obj/effect/decal/cleanable/trail_holder/TH in loc)
if((!(newdir in TH.existing_dirs) || trail_type == "trails_1" || trail_type == "trails_2") && TH.existing_dirs.len <= 16) //maximum amount of overlays is 16 (all light & heavy directions filled)
TH.existing_dirs += newdir
TH.overlays.Add(image('icons/effects/blood.dmi', trail_type, dir = newdir))
TH.transfer_mob_blood_dna(src)
if(ishuman(src))
var/mob/living/carbon/human/H = src
if(H.species.blood_color)
TH.color = H.species.blood_color
else
TH.color = "#A10808"
/mob/living/carbon/human/makeTrail(turf/T)
if((species.flags & NO_BLOOD) || species.exotic_blood || !bleed_rate || bleedsuppress)
return
..()
/mob/living/proc/getTrail()
if(getBruteLoss() < 300)
return pick("ltrails_1", "ltrails_2")
else
return pick("trails_1", "trails_2")
/*//////////////////////
START RESIST PROCS
*///////////////////////
@@ -59,3 +59,5 @@
var/tesla_ignore = FALSE
var/list/say_log = list() //a log of what we've said, plain text, no spans or junk, essentially just each individual "message"
var/blood_volume = 0 //how much blood the mob has
@@ -568,23 +568,6 @@
mode = BOT_NO_ROUTE
/mob/living/simple_animal/bot/mulebot/Move(turf/simulated/next)
var/turf/simulated/last = loc
if(istype(last) && bloodiness)
last.AddTracks(/obj/effect/decal/cleanable/blood/tracks/wheels, currentDNA, 0, get_dir(last, next), currentBloodColor)
. = ..()
if(. && istype(next))
if(bloodiness)
next.AddTracks(/obj/effect/decal/cleanable/blood/tracks/wheels, currentDNA, get_dir(last, next), 0, currentBloodColor)
bloodiness--
for(var/mob/living/carbon/human/H in next)
if(H != load)
RunOver(H)
// calculates a path to the current destination
// given an optional turf to avoid
/mob/living/simple_animal/bot/mulebot/calc_path(turf/avoid = null)
@@ -668,6 +651,30 @@
return
/mob/living/simple_animal/bot/mulebot/Move(turf/simulated/next)
. = ..()
if(. && istype(next))
if(bloodiness)
var/obj/effect/decal/cleanable/blood/tracks/B = locate() in next
if(!B)
B = new /obj/effect/decal/cleanable/blood/tracks(loc)
if(blood_DNA && blood_DNA.len)
B.blood_DNA |= blood_DNA.Copy()
B.basecolor = currentBloodColor
var/newdir = get_dir(next, loc)
if(newdir == dir)
B.setDir(newdir)
else
newdir = newdir | dir
if(newdir == 3)
newdir = 1
else if(newdir == 12)
newdir = 4
B.setDir(newdir)
B.update_icon()
bloodiness--
// called when bot bumps into anything
/mob/living/simple_animal/bot/mulebot/Bump(atom/obs)
if(!wires.MobAvoid()) // usually just bumps, but if avoidance disabled knock over mobs
@@ -697,21 +704,18 @@
H.apply_damage(0.5*damage, BRUTE, "l_arm", run_armor_check("l_arm", "melee"))
H.apply_damage(0.5*damage, BRUTE, "r_arm", run_armor_check("r_arm", "melee"))
var/obj/effect/decal/cleanable/blood/B = new(loc)
B.blood_DNA = list()
B.blood_DNA[H.dna.unique_enzymes] = H.dna.b_type
currentDNA = B.blood_DNA
var/turf/T = get_turf(src)
H.add_mob_blood(H)
H.add_splatter_floor(T)
bloodiness += 4
currentBloodColor = "#A10808"
if(istype(H))
var/datum/reagent/blood/bld = H.get_blood(H.vessel)
if(bld.data["blood_colour"])
currentBloodColor = bld.data["blood_colour"]
return
B.basecolor = currentBloodColor
B.update_icon()
var/list/blood_dna = H.get_blood_dna_list()
if(blood_dna)
transfer_blood_dna(blood_dna)
currentBloodColor = H.species.blood_color
return
/mob/living/simple_animal/bot/mulebot/bot_control_message(command, mob/user, user_turf)
switch(command)
@@ -27,6 +27,7 @@
stop_automated_movement_when_pulled = 1
var/milk_content = 0
can_collar = 1
blood_volume = BLOOD_VOLUME_NORMAL
/mob/living/simple_animal/hostile/retaliate/goat/handle_automated_movement()
..()
@@ -110,6 +111,7 @@
var/milk_content = 0
can_collar = 1
gold_core_spawnable = CHEM_MOB_SPAWN_FRIENDLY
blood_volume = BLOOD_VOLUME_NORMAL
/mob/living/simple_animal/cow/New()
..()
@@ -312,6 +314,7 @@ var/global/chicken_count = 0
maxHealth = 50
can_collar = 1
gold_core_spawnable = CHEM_MOB_SPAWN_FRIENDLY
blood_volume = BLOOD_VOLUME_NORMAL
/mob/living/simple_animal/turkey
name = "turkey"
@@ -381,6 +384,7 @@ var/global/chicken_count = 0
maxHealth = 50
can_collar = 1
gold_core_spawnable = CHEM_MOB_SPAWN_FRIENDLY
blood_volume = BLOOD_VOLUME_NORMAL
/mob/living/simple_animal/walrus
name = "walrus"
@@ -404,3 +408,4 @@ var/global/chicken_count = 0
maxHealth = 50
can_collar = 1
gold_core_spawnable = CHEM_MOB_SPAWN_FRIENDLY
blood_volume = BLOOD_VOLUME_NORMAL
@@ -2,6 +2,7 @@
icon = 'icons/mob/pets.dmi'
can_collar = 1
mob_size = MOB_SIZE_SMALL
blood_volume = BLOOD_VOLUME_NORMAL
/mob/living/simple_animal/pet/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
if(istype(O, /obj/item/weapon/newspaper))
@@ -203,9 +203,9 @@
reagents.reaction(C, INGEST, fraction)
reagents.trans_to(C, volume)
/mob/living/simple_animal/hostile/asteroid/hivelordbrood/blood/proc/link_host(mob/living/carbon/human/H)
faction = list("\ref[src]", "\ref[H]") // Hostile to everyone except the host.
H.vessel.trans_to(src, 30)
/mob/living/simple_animal/hostile/asteroid/hivelordbrood/blood/proc/link_host(mob/living/carbon/C)
faction = list("\ref[src]", "\ref[C]") // Hostile to everyone except the host.
C.transfer_blood_to(src, 30)
color = mix_color_from_reagents(reagents.reagent_list)
// Legion
@@ -422,6 +422,13 @@
damage = O.force
if(O.damtype == STAMINA)
damage = 0
if(O.damtype == BRUTE)
if(prob(33))
O.add_mob_blood(src)
var/turf/location = get_turf(src)
add_splatter_floor(location)
if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
user.add_mob_blood(src)
visible_message("<span class='danger'>[user] has [O.attack_verb.len ? "[pick(O.attack_verb)]": "attacked"] [src] with [O]!</span>",\
"<span class='userdanger'>[user] has [O.attack_verb.len ? "[pick(O.attack_verb)]": "attacked"] you with [O]!</span>")
else
@@ -432,7 +439,6 @@
"<span class='warning'>This weapon is ineffective, it does no damage.</span>")
adjustBruteLoss(damage)
/mob/living/simple_animal/movement_delay()
. = ..()
+1 -1
View File
@@ -66,7 +66,7 @@
/obj/item/projectile/bullet/spike/on_hit(atom/target, blocked = 0)
if((blocked != 100) && istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/H = target
H.drip(500)
H.bleed(50)
..()
//This gun only functions for armalis. The on-sprite is too huge to render properly on other sprites.
@@ -67,9 +67,9 @@
/obj/item/projectile/bullet/saw/bleeding/on_hit(atom/target, blocked = 0, hit_zone)
. = ..()
if((blocked != 100) && istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/H = target
H.drip(350)
if((blocked != 100) && iscarbon(target))
var/mob/living/carbon/C = target
C.bleed(35)
/obj/item/projectile/bullet/saw/hollow
damage = 60
@@ -119,9 +119,9 @@
breakthings = FALSE
/obj/item/projectile/bullet/sniper/haemorrhage/on_hit(atom/target, blocked = 0, hit_zone)
if((blocked != 100) && istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/H = target
H.drip(1000)
if((blocked != 100) && iscarbon(target))
var/mob/living/carbon/C = target
C.bleed(100)
return ..()
+2 -2
View File
@@ -14,8 +14,8 @@ var/list/random_color_list = list("#00aedb","#a200ff","#f47835","#d41243","#d111
var/vol_temp
// see libs/IconProcs/IconProcs.dm
for(var/datum/reagent/reagent in reagent_list)
if(reagent.id == "blood" && reagent.data && reagent.data["blood_colour"])
reagent_color = reagent.data["blood_colour"]
if(reagent.id == "blood" && reagent.data && reagent.data["blood_color"])
reagent_color = reagent.data["blood_color"]
else
reagent_color = reagent.color
@@ -135,10 +135,6 @@ var/const/INGEST = 2
for(var/datum/reagent/current_reagent in reagent_list)
if(!current_reagent)
continue
if(current_reagent.id == "blood" && ishuman(target))
var/mob/living/carbon/human/H = target
H.inject_blood(my_atom, amount)
continue
var/current_reagent_transfer = current_reagent.volume * part
if(preserve_data)
trans_data = copy_data(current_reagent)
@@ -31,11 +31,9 @@
if(H.can_eat(diet_flags)) //Make sure the species has it's dietflag set, otherwise it can't digest any nutrients
if(prob(50))
M.adjustBruteLoss(-1)
if(H.species.exotic_blood)
H.vessel.add_reagent(H.species.exotic_blood, 0.4)
else
if(!(H.species.flags & NO_BLOOD))
H.vessel.add_reagent("blood", 0.4)
if(!(H.species.flags & NO_BLOOD))//do not restore blood on things with no blood by nature.
if(H.blood_volume < BLOOD_VOLUME_NORMAL)
H.blood_volume += 0.4
..()
/datum/reagent/consumable/nutriment/protein // Meat-based protein, digestable by carnivores and omnivores, worthless to herbivores
@@ -65,11 +63,9 @@
M.satiety += 30
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(H.species.exotic_blood)
H.vessel.add_reagent(H.species.exotic_blood, 0.5)
else
if(!(H.species.flags & NO_BLOOD))
H.vessel.add_reagent("blood", 0.5)
if(!(H.species.flags & NO_BLOOD))//do not restore blood on things with no blood by nature.
if(H.blood_volume < BLOOD_VOLUME_NORMAL)
H.blood_volume += 0.5
..()
/datum/reagent/consumable/sugar
@@ -210,10 +210,11 @@
if(prob(33))
M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER)
M.adjustFireLoss(-2*REAGENTS_EFFECT_MULTIPLIER)
if(ishuman(M))
if(ishuman(M) && prob(33))
var/mob/living/carbon/human/H = M
if(!H.species.exotic_blood && !(H.species.flags & NO_BLOOD) && prob(33))
H.vessel.add_reagent("blood", 1)
if(!(H.species.flags & NO_BLOOD))//do not restore blood on things with no blood by nature.
if(H.blood_volume < BLOOD_VOLUME_NORMAL)
H.blood_volume += 1
..()
/datum/reagent/medicine/synthflesh
@@ -148,7 +148,7 @@
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(!H.species.exotic_blood && !(H.species.flags & NO_BLOOD))
H.vessel.add_reagent("blood", 0.8)
H.blood_volume += 0.8
..()
//foam
@@ -206,6 +206,14 @@
else //ingest, patch or inject
M.ForceContractDisease(D)
if(method == INGEST && iscarbon(M))
var/mob/living/carbon/C = M
if(C.get_blood_id() == "blood")
if((!data || !(data["blood_type"] in get_safe_blood(C.dna.b_type))) && !M.mind.vampire)
C.reagents.add_reagent("toxin", volume * 0.5)
else
C.blood_volume = min(C.blood_volume + round(volume, 0.1), BLOOD_VOLUME_MAXIMUM)
/datum/reagent/blood/on_new(list/data)
if(istype(data))
SetViruses(src, data)
@@ -234,13 +242,13 @@
preserve += D
data["viruses"] = preserve
if(mix_data["blood_colour"])
color = mix_data["blood_colour"]
if(mix_data["blood_color"])
color = mix_data["blood_color"]
return 1
/datum/reagent/blood/on_update(atom/A)
if(data["blood_colour"])
color = data["blood_colour"]
if(data["blood_color"])
color = data["blood_color"]
return ..()
/datum/reagent/blood/reaction_turf(turf/simulated/T, volume)//splash the blood all over the place
+1 -1
View File
@@ -32,7 +32,7 @@
create_reagents(volume)
if(spawned_disease)
var/datum/disease/F = new spawned_disease(0)
var/list/data = list("viruses" = list(F), "blood_colour" = "#A10808")
var/list/data = list("viruses" = list(F), "blood_color" = "#A10808")
reagents.add_reagent("blood", disease_amount, data)
if(list_reagents)
reagents.add_reagent_list(list_reagents)
@@ -16,6 +16,7 @@
volume = 15
w_class = WEIGHT_CLASS_TINY
sharp = 1
var/busy = 0
var/mode = SYRINGE_DRAW
var/projectile_type = /obj/item/projectile/bullet/dart/syringe
@@ -58,13 +59,16 @@
..()
return
/obj/item/weapon/reagent_containers/syringe/afterattack(obj/target, mob/user, proximity)
if(!proximity) return
if(!target.reagents) return
/obj/item/weapon/reagent_containers/syringe/afterattack(atom/target, mob/user , proximity)
if(!proximity)
return
if(!target.reagents)
return
var/mob/living/L
if(isliving(target))
var/mob/living/M = target
if(!M.can_inject(user, 1))
L = target
if(!L.can_inject(user, 1))
return
if(mode == SYRINGE_BROKEN)
@@ -75,163 +79,84 @@
if(SYRINGE_DRAW)
if(reagents.total_volume >= reagents.maximum_volume)
to_chat(user, "<span class='warning'>The syringe is full.</span>")
to_chat(user, "<span class='notice'>The syringe is full.</span>")
return
if(ismob(target))//Blood!
if(istype(target, /mob/living/carbon/slime))
to_chat(user, "<span class='warning'>You are unable to locate any blood.</span>")
return
if(reagents.has_reagent("blood"))
to_chat(user, "<span class='warning'>There is already a blood sample in this syringe</span>")
return
if(istype(target, /mob/living/carbon))//maybe just add a blood reagent to all mobs. Then you can suck them dry...With hundreds of syringes. Jolly good idea.
var/mob/living/carbon/T = target
if(!T.dna)
to_chat(usr, "You are unable to locate any blood. (To be specific, your target seems to be missing their DNA datum)")
if(L) //living mob
var/drawn_amount = reagents.maximum_volume - reagents.total_volume
if(target != user)
target.visible_message("<span class='danger'>[user] is trying to take a blood sample from [target]!</span>", \
"<span class='userdanger'>[user] is trying to take a blood sample from [target]!</span>")
busy = 1
if(!do_mob(user, target))
busy = 0
return
if(NOCLONE in T.mutations) //target done been et, no more blood in him
to_chat(user, "<span class='warning'>You are unable to locate any blood.</span>")
if(reagents.total_volume >= reagents.maximum_volume)
return
var/time = 30
if(istype(target,/mob/living/carbon/human))
var/mob/living/carbon/human/H = T
if(H.species.flags & NO_BLOOD)
to_chat(usr, "<span class='warning'>You are unable to locate any blood.</span>")
return
if(target == user)
time = 0
else
for(var/mob/O in viewers(world.view, user))
O.show_message(text("<span class='danger'>[] is trying to take a blood sample from []!</span>", user, target), 1)
if(!do_mob(user, target, time))
return
var/amount = reagents.maximum_volume - reagents.total_volume
if(amount == 0)
to_chat(usr, "<span class='warning'>The syringe is full!</span>")
return
var/datum/reagent/B
if(istype(T,/mob/living/carbon/human))
var/mob/living/carbon/human/H = T
if(H.species && H.species.exotic_blood && H.vessel.total_volume)
H.vessel.trans_to(src,amount)
else
B = T.take_blood(src,amount)
else
B = T.take_blood(src,amount)
if(B)
reagents.reagent_list |= B
reagents.update_total()
on_reagent_change()
reagents.handle_reactions()
to_chat(user, "<span class='notice'>You take a blood sample from [target]</span>")
for(var/mob/O in viewers(4, user))
O.show_message("<span class='warning'>[user] takes a blood sample from [target].</span>", 1)
else
user.visible_message("<span class='warning'>[user] takes a sample from [target].</span>", "<span class='notice'>You take a sample from [target].</span>")
busy = 0
if(L.transfer_blood_to(src, drawn_amount))
user.visible_message("[user] takes a blood sample from [L].")
else
to_chat(user, "<span class='warning'>You are unable to draw any blood from [L]!</span>")
else //if not mob
if(!target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty.</span>")
to_chat(user, "<span class='warning'>[target] is empty!</span>")
return
if(!target.is_open_container() && !istype(target,/obj/structure/reagent_dispensers) && !istype(target,/obj/item/slime_extract))
to_chat(user, "<span class='warning'>You cannot directly remove reagents from this object.</span>")
to_chat(user, "<span class='warning'>You cannot directly remove reagents from [target]!</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) // transfer from, transfer to - who cares?
to_chat(user, "<span class='notice'>You fill the syringe with [trans] units of the solution.</span>")
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the solution.</span>")
if(reagents.total_volume >= reagents.maximum_volume)
mode=!mode
update_icon()
if(SYRINGE_INJECT)
if(!reagents.total_volume)
to_chat(user, "<span class='warning'>The Syringe is empty.</span>")
return
if(istype(target, /obj/item/weapon/implantcase/chem))
to_chat(user, "<span class='notice'>[src] is empty.</span>")
return
if(!target.is_open_container() && !ismob(target) && !istype(target, /obj/item/weapon/reagent_containers/food) && !istype(target, /obj/item/slime_extract) && !istype(target, /obj/item/clothing/mask/cigarette) && !istype(target, /obj/item/weapon/storage/fancy/cigarettes))
to_chat(user, "<span class='warning'>You cannot directly fill this object.</span>")
to_chat(user, "<span class='warning'>You cannot directly fill [target]!</span>")
return
if(istype(target, /obj/item/clothing/mask/cigarette))
var/obj/item/clothing/mask/cigarette/C = target
if(istype(C.loc, /obj/item/weapon/storage/fancy/cigarettes))
to_chat(user, "<span class='warning'>You cannot inject a cigarette while it's still in the pack.</span>")
return
if(target.reagents.total_volume >= target.reagents.maximum_volume)
to_chat(user, "<span class='warning'>[target] is full.</span>")
to_chat(user, "<span class='notice'>[target] is full.</span>")
return
var/mob/living/carbon/human/H = target
if(istype(H))
var/obj/item/organ/external/affected = H.get_organ(user.zone_sel.selecting)
if(!affected)
to_chat(user, "<span class='danger'>\The [H] is missing that limb!</span>")
return
/* else if(affected.status & ORGAN_ROBOT)
to_chat(user, "<span class='danger'>You cannot inject a robotic limb.</span>")
return */
if(L) //living mob
if(L != user)
L.visible_message("<span class='danger'>[user] is trying to inject [L]!</span>", \
"<span class='userdanger'>[user] is trying to inject [L]!</span>")
if(!do_mob(user, L))
return
if(!reagents.total_volume)
return
if(L.reagents.total_volume >= L.reagents.maximum_volume)
return
L.visible_message("<span class='danger'>[user] injects [L] with the syringe!", \
"<span class='userdanger'>[user] injects [L] with the syringe!")
if(ismob(target) && target != user)
for(var/mob/O in viewers(world.view, user))
O.show_message(text("<span class='danger'>[] is trying to inject []!</span>", user, target), 1)
var/list/rinject = list()
for(var/datum/reagent/R in reagents.reagent_list)
rinject += R.name
var/contained = english_list(rinject)
if(!do_mob(user, target, 30)) return
for(var/mob/O in viewers(world.view, user))
O.show_message(text("<span class='warning'>[] injects [] with the syringe!</span>", user, target), 1)
if(istype(target,/mob/living))
var/mob/living/M = target
var/list/injected = list()
for(var/datum/reagent/R in reagents.reagent_list)
injected += R.name
var/contained = english_list(injected)
M.create_attack_log("<font color='orange'>Has been injected with [name] by [key_name(user)]. Reagents: [contained]</font>")
user.create_attack_log("<font color='red'>Used the [name] to inject [key_name(M)]. Reagents: [contained]</font>")
if(M.ckey)
msg_admin_attack("[key_name_admin(user)] injected [key_name_admin(M)] with [name]. Reagents: [contained] (INTENT: [uppertext(user.a_intent)])")
if(!iscarbon(user))
M.LAssailant = null
else
M.LAssailant = user
reagents.reaction(target, INGEST)
if(ismob(target) && target == user)
reagents.reaction(target, INGEST)
spawn(5)
var/datum/reagent/blood/B
for(var/datum/reagent/blood/d in reagents.reagent_list)
B = d
break
var/trans
if(B && istype(target,/mob/living/carbon))
var/mob/living/carbon/C = target
C.inject_blood(src, 5)
if(L != user)
add_logs(user, L, "injected", src, addition="which had [contained]")
else
trans = reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You inject [trans] units of the solution. The syringe now contains [reagents.total_volume] units.</span>")
if(istype(target, /obj/item/weapon/reagent_containers/food/pill/patch))
var/obj/item/weapon/reagent_containers/food/pill/patch/P = target
if(P.instant_application)
to_chat(user, "<span class=warning>You break the medical seal on the [P]!</span>")
P.instant_application = 0
log_attack("<font color='red'>[user.name] ([user.ckey]) injected [L.name] ([L.ckey]) with [src.name], which had [contained] (INTENT: [uppertext(user.a_intent)])</font>")
if(reagents.total_volume <= 0 && mode==SYRINGE_INJECT)
mode = SYRINGE_DRAW
update_icon()
return
var/fraction = min(amount_per_transfer_from_this/reagents.total_volume, 1)
reagents.reaction(L, INGEST, fraction)
reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You inject [amount_per_transfer_from_this] units of the solution. The syringe now contains [reagents.total_volume] units.</span>")
if (reagents.total_volume <= 0 && mode==SYRINGE_INJECT)
mode = SYRINGE_DRAW
update_icon()
/obj/item/weapon/reagent_containers/syringe/update_icon()
if(mode == SYRINGE_BROKEN)
@@ -98,7 +98,7 @@
/obj/structure/disposalconstruct/AltClick(mob/user)
if(user.incapacitated())
to_chat(user << "<span class='warning'>You can't do that right now!</span>")
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(!Adjacent(user))
return
@@ -195,7 +195,7 @@
playsound(src.loc, I.usesound, 100, 1)
update()
return
var/obj/structure/disposalpipe/CP = locate() in T
if(ptype>=6 && ptype <= 8) // Disposal or outlet
if(CP) // There's something there
@@ -17,14 +17,12 @@
if(affecting && istype(affecting))
affecting.heal_damage(25 * weakness, 25 * weakness)
//H:heal_organ_damage(25, 25)
H.vessel.add_reagent("blood",5)
H.blood_volume += 5
H.nutrition += 50 * weakness
H.adjustBrainLoss(-25 * weakness)
var/radiation = min(H.radiation, 25 * weakness)
H.apply_effect(-radiation,IRRADIATE,0)
H.bodytemperature = initial(H.bodytemperature)
spawn(1)
H.fixblood()
//
C.adjustOxyLoss(-25 * weakness)
C.adjustToxLoss(-25 * weakness)
@@ -134,7 +134,7 @@
B.target_turf = pick(range(1, src))
B.blood_DNA = list()
B.blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
M.vessel.remove_reagent("blood",rand(25,50))
M.blood_volume -= rand(25,50)
//animated blood 2 SPOOKY
/obj/effect/decal/cleanable/blood/splatter/animated
+198 -291
View File
@@ -1,87 +1,42 @@
/****************************************************
BLOOD SYSTEM
****************************************************/
/mob/living/carbon/human/var/datum/reagents/vessel //Container for blood and BLOOD ONLY. Do not transfer other chems here.
//Initializes blood vessels
/mob/living/carbon/human/proc/make_blood()
if(vessel)
/mob/living/carbon/human/proc/suppress_bloodloss(amount)
if(bleedsuppress)
return
vessel = new/datum/reagents(max_blood)
vessel.my_atom = src
if(species && species.exotic_blood)
vessel.add_reagent(species.exotic_blood, max_blood)
else
vessel.add_reagent("blood", max_blood)
for(var/datum/reagent/blood/B in vessel.reagent_list)
if(B.id == "blood")
B.data = list(
"donor" = src,
"viruses" = null,
"blood_DNA" = dna.unique_enzymes,
"blood_colour" = species.blood_color,
"blood_type" = b_type,
"resistances" = null,
"trace_chem" = null)
spawn(1)
fixblood()
bleedsuppress = 1
spawn(amount)
bleedsuppress = 0
if(stat != DEAD && bleed_rate)
to_chat(src, "<span class='warning'>The blood soaks through your bandage.</span>")
//Resets blood data
/mob/living/carbon/human/proc/fixblood()
for(var/datum/reagent/blood/B in vessel.reagent_list)
if(B.id == "blood")
B.data = list(
"donor" = src,
"viruses" = null,
"blood_DNA" = dna.unique_enzymes,
"blood_colour" = species.blood_color,
"blood_type" = b_type,
"resistances" = null,
"trace_chem" = null)
// Takes care blood loss and regeneration
/mob/living/carbon/human/proc/handle_blood()
var/blood_volume
if(species && species.flags & NO_BLOOD)
/mob/living/carbon/human/handle_blood()
var/list/blood_data = get_blood_data(get_blood_id())//PROCCEPTION
if(in_stasis)
return
if(stat != DEAD && bodytemperature >= 170) //Dead or cryosleep people do not pump the blood.
if(species.exotic_blood)
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(blood_reagent))
vessel.add_reagent(blood_reagent, 0.4)
else
blood_volume = round(vessel.get_reagent_amount("blood"))
//Blood regeneration if there is some space
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
if(mind) //Handles vampires "eating" blood that isn't their own.
if(mind in ticker.mode.vampires)
for(var/datum/reagent/blood/BL in vessel.reagent_list)
if(nutrition >= NUTRITION_LEVEL_WELL_FED)
break //We don't want blood tranfusions making vampires fat.
if(BL.data["donor"] != src)
nutrition += (15 * REAGENTS_METABOLISM)
BL.volume -= REAGENTS_METABOLISM
if(BL.volume <= 0)
qdel(BL)
break //Only process one blood per tick, to maintain the same metabolism as nutriment for non-vampires.
if(species && species.flags & NO_BLOOD)
bleed_rate = 0
return
if(B.data["donor"] != src) //If it's not theirs, then we look for theirs
for(var/datum/reagent/blood/D in vessel.reagent_list)
if(D.data["donor"] == src)
B = D
break
if(bodytemperature >= 225 && !(NOCLONE in mutations)) //cryosleep or husked people do not pump the blood.
vessel.add_reagent("blood", 0.1) // regenerate blood VERY slowly
//Blood regeneration if there is some space
if(blood_volume < max_blood && blood_volume)
if(mind) //Handles vampires "eating" blood that isn't their own.
if(mind in ticker.mode.vampires)
if(nutrition >= NUTRITION_LEVEL_WELL_FED)
return //We don't want blood tranfusions making vampires fat.
if(blood_data["donor"] != src)
nutrition += (15 * REAGENTS_METABOLISM)
return //Only process one blood per tick, to maintain the same metabolism as nutriment for non-vampires.
if(blood_volume < BLOOD_VOLUME_NORMAL)
blood_volume += 0.1 // regenerate blood VERY slowly
//Effects of bloodloss
@@ -102,6 +57,7 @@
adjustOxyLoss(round((BLOOD_VOLUME_NORMAL - blood_volume) * 0.02, 1))
if(prob(5))
EyeBlurry(6)
var/word = pick("dizzy","woozy","faint")
to_chat(src, "<span class='warning'>You feel very [word].</span>")
if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD)
@@ -117,264 +73,215 @@
death()
//Bleeding out
var/blood_max = 0
var/temp_bleed = 0
for(var/obj/item/organ/external/temp in bodyparts)
if(!(temp.status & ORGAN_BLEEDING) || temp.status & ORGAN_ROBOT)
continue
for(var/datum/wound/W in temp.wounds)
if(W.bleeding())
blood_max += W.damage / 4
temp_bleed += W.damage / 4
if(temp.open)
blood_max += 2 //Yer stomach is cut open
drip(blood_max)
temp_bleed += 0.5
//Makes a blood drop, leaking certain amount of blood from the mob
/mob/living/carbon/human/proc/drip(var/amt as num)
bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects (heparin) naturally decreases
if(species && species.flags & NO_BLOOD) //TODO: Make drips come from the reagents instead.
return
if(bleed_rate && !bleedsuppress)
bleed(bleed_rate)
if(!amt)
return
//Makes a blood drop, leaking amt units of blood from the mob
/mob/living/carbon/proc/bleed(amt)
if(blood_volume)
blood_volume = max(blood_volume - amt, 0)
if(isturf(loc)) //Blood loss still happens in locker, floor stays clean
if(amt >= 10)
add_splatter_floor(loc)
else
add_splatter_floor(loc, 1)
var/amm = 0.1 * amt
var/turf/T = get_turf(src)
/mob/living/carbon/human/bleed(amt)
if(!(species && species.flags & NO_BLOOD))
..()
if(species.exotic_blood)
var/datum/reagent/R = chemical_reagents_list[get_blood_id()]
if(istype(R) && isturf(loc))
R.reaction_turf(get_turf(src), amt)
if(species.exotic_blood)
vessel.remove_reagent(species.exotic_blood,amm)
if(vessel.total_volume)
var/fraction = amm / vessel.total_volume
vessel.reaction(T, TOUCH, fraction)
return
else
vessel.remove_reagent("blood",amm)
blood_splatter(src, src)
/mob/living/proc/restore_blood()
blood_volume = initial(blood_volume)
/mob/living/carbon/human/restore_blood()
blood_volume = BLOOD_VOLUME_NORMAL
bleed_rate = 0
/****************************************************
BLOOD TRANSFERS
****************************************************/
//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(!istype(B, /datum/reagent/blood)) B = new /datum/reagent/blood
B.holder = container
B.volume += amount
//Gets blood from mob to a container or other mob, preserving all data in it.
/mob/living/proc/transfer_blood_to(atom/movable/AM, amount, forced)
if(!blood_volume || !AM.reagents)
return 0
if(blood_volume < BLOOD_VOLUME_BAD && !forced)
return 0
//set reagent data
B.data["donor"] = src
B.data["viruses"] = list()
if(blood_volume < amount)
amount = blood_volume
for(var/datum/disease/D in viruses)
B.data["viruses"] += D.Copy()
if(resistances && resistances.len)
B.data["resistances"] = resistances.Copy()
var/blood_id = get_blood_id()
if(!blood_id)
return 0
B.data["blood_DNA"] = copytext(src.dna.unique_enzymes,1,0)
B.data["blood_type"] = copytext(src.dna.b_type,1,0)
blood_volume -= amount
// Putting this here due to return shenanigans.
if(istype(src,/mob/living/carbon/human))
var/mob/living/carbon/human/H = src
B.data["blood_colour"] = H.species.blood_color
B.color = B.data["blood_colour"]
var/list/blood_data = get_blood_data(blood_id)
var/list/temp_chem = list()
for(var/datum/reagent/R in src.reagents.reagent_list)
temp_chem += R.id
temp_chem[R.id] = R.volume
B.data["trace_chem"] = list2params(temp_chem)
if(mind)
B.data["mind"] = mind
if(ckey)
B.data["ckey"] = ckey
if(iscarbon(AM))
var/mob/living/carbon/C = AM
if(blood_id == C.get_blood_id())//both mobs have the same blood substance
if(blood_id == "blood") //normal blood
if(blood_data["viruses"])
for(var/datum/disease/D in blood_data["viruses"])
if((D.spread_flags & SPECIAL) || (D.spread_flags & NON_CONTAGIOUS))
continue
C.ForceContractDisease(D)
if(!(blood_data["blood_type"] in get_safe_blood(C.dna.b_type)))
C.reagents.add_reagent("toxin", amount * 0.5)
return 1
if(!suiciding)
B.data["cloneable"] = 1
B.data["gender"] = gender
B.data["real_name"] = real_name
B.data["factions"] = faction
return B
C.blood_volume = min(C.blood_volume + round(amount, 0.1), BLOOD_VOLUME_MAXIMUM)
return 1
//For humans, blood does not appear from blue, it comes from vessels.
/mob/living/carbon/human/take_blood(obj/item/weapon/reagent_containers/container, var/amount)
if(src.species.exotic_blood)
if(vessel.get_reagent_amount(src.species.exotic_blood) < amount)
return null
var/datum/reagent/W = new /datum/reagent
W.holder = container
W.volume += amount
AM.reagents.add_reagent(blood_id, amount, blood_data, bodytemperature)
return 1
/mob/living/proc/get_blood_data(blood_id)
return
/mob/living/carbon/human/get_blood_data(blood_id)
if(blood_id == "blood") //actual blood reagent
var/blood_data = list()
//set the blood data
blood_data["donor"] = src
blood_data["viruses"] = list()
for(var/datum/disease/D in viruses)
blood_data["viruses"] += D.Copy()
blood_data["blood_DNA"] = copytext(dna.unique_enzymes,1,0)
if(resistances && resistances.len)
blood_data["resistances"] = resistances.Copy()
var/list/temp_chem = list()
for(var/datum/reagent/R in src.reagents.reagent_list)
temp_chem += R.id
for(var/datum/reagent/R in reagents.reagent_list)
temp_chem[R.id] = R.volume
W.data["trace_chem"] = list2params(temp_chem)
vessel.remove_reagent(src.species.exotic_blood,amount) // Removes blood if human
return W
if(species && species.flags & NO_BLOOD)
return null
else
if(vessel.get_reagent_amount("blood") < amount)
return null
. = ..()
vessel.remove_reagent("blood",amount) // Removes blood if human
blood_data["trace_chem"] = list2params(temp_chem)
if(mind)
blood_data["mind"] = mind
if(ckey)
blood_data["ckey"] = ckey
if(!suiciding)
blood_data["cloneable"] = 1
blood_data["blood_type"] = copytext(src.dna.b_type,1,0)
blood_data["gender"] = gender
blood_data["real_name"] = real_name
blood_data["blood_color"] = species.blood_color
blood_data["factions"] = faction
return blood_data
//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)
//get the id of the substance this mob use as blood.
/mob/proc/get_blood_id()
return
if(!istype(injected))
/mob/living/simple_animal/get_blood_id()
if(blood_volume)
return "blood"
/mob/living/carbon/human/get_blood_id()
if(species.exotic_blood)//some races may bleed water..or kethcup..
return species.exotic_blood
else if((species && species.flags & NO_BLOOD) || (NOCLONE in mutations))
return
var/list/chems = list()
chems = params2list(injected.data["trace_chem"])
for(var/C in chems)
src.reagents.add_reagent(C, (text2num(chems[C]) / BLOOD_VOLUME_NORMAL) * amount)//adds trace chemicals to owner's blood
reagents.update_total()
container.reagents.remove_reagent("blood", amount)
//Transfers blood from container ot vessels, respecting blood types compatability.
/mob/living/carbon/human/inject_blood(obj/item/weapon/reagent_containers/container, var/amount)
var/datum/reagent/blood/injected = get_blood(container.reagents)
if(!istype(injected)) //Sanity..
return
if(species && species.flags & NO_BLOOD)
reagents.add_reagent("blood", amount, injected.data)
reagents.update_total()
return
var/datum/reagent/blood/our = get_blood(vessel)
if(!istype(our)) // Do we not have blood?
vessel.add_reagent("blood", amount, injected.data) // This is only ran once, so we need to add back their DNA.
vessel.update_total()
..()
our = get_blood(vessel) // Get the new blood.
our.data["blood_DNA"] = dna.unique_enzymes // Give it the proper DNA we had before (src.dna)
our.data["blood_type"] = dna.b_type // Proper blood type.
our.data["donor"] = src // Without this, it'd be random each time it was extracted or Null.
return
if(blood_incompatible(injected.data["blood_type"],our.data["blood_type"]) )
reagents.add_reagent("toxin",amount * 0.5)
reagents.update_total()
else
vessel.add_reagent("blood", amount, injected.data)
vessel.update_total()
..()
//Gets human's own blood.
/mob/living/carbon/proc/get_blood(datum/reagents/container)
var/datum/reagent/blood/res = locate() in container.reagent_list //Grab some blood
if(res) // Make sure there's some blood at all
if(res.data["donor"] != src) //If it's not theirs, then we look for theirs
for(var/datum/reagent/blood/D in container.reagent_list)
if(D.data["donor"] == src)
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 ..()
// This is has more potential uses, and is probably faster than the old proc.
/proc/get_safe_blood(bloodtype)
. = list()
if(!bloodtype)
return
switch(bloodtype)
if("A-")
return list("A-", "O-")
if("A+")
return list("A-", "A+", "O-", "O+")
if("B-")
return list("B-", "O-")
if("B+")
return list("B-", "B+", "O-", "O+")
if("AB-")
return list("A-", "B-", "O-", "AB-")
if("AB+")
return list("A-", "A+", "B-", "B+", "O-", "O+", "AB-", "AB+")
if("O-")
return list("O-")
if("O+")
return list("O-", "O+")
/proc/blood_incompatible(donor,receiver)
//to add a splatter of blood or other mob liquid.
/mob/living/proc/add_splatter_floor(turf/T, small_drip)
if(get_blood_id() != "blood")//is it blood or welding fuel?
return
var/donor_antigen = copytext(donor,1,lentext(donor))
var/receiver_antigen = copytext(receiver,1,lentext(receiver))
var/donor_rh = findtext("+",donor)
var/receiver_rh = findtext("+",receiver)
if(!T)
T = get_turf(src)
if(donor_rh && !receiver_rh) return 1
switch(receiver_antigen)
if("A")
if(donor_antigen != "A" && donor_antigen != "O") return 1
if("B")
if(donor_antigen != "B" && donor_antigen != "O") return 1
if("O")
if(donor_antigen != "O") return 1
//AB is a universal receiver.
return 0
var/list/temp_blood_DNA
var/list/b_data = get_blood_data(get_blood_id())
/*
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/H = source
bld = H.get_blood(H.vessel)
if(H.species.exotic_blood)
H.vessel.reaction(T, TOUCH)
if(small_drip)
// Only a certain number of drips (or one large splatter) can be on a given turf.
var/obj/effect/decal/cleanable/blood/drip/drop = locate() in T
if(drop)
if(drop.drips < 3)
drop.drips++
drop.overlays |= pick(drop.random_icon_states)
drop.transfer_mob_blood_dna(src)
drop.basecolor = b_data["blood_color"]
drop.update_icon()
else
temp_blood_DNA = list()
temp_blood_DNA |= drop.blood_DNA.Copy() //we transfer the dna from the drip to the splatter
qdel(drop)
else
drop = new(T)
drop.transfer_mob_blood_dna(src)
drop.basecolor = b_data["blood_color"]
drop.update_icon()
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_runtime(EXCEPTION("Non-human or reagent blood source. Area: [get_area(source)], Name: [source]"), source)
// Are we dripping or splattering?
var/list/drips = list()
// Only a certain number of drips (or one large splatter) can be on a given turf.
for(var/obj/effect/decal/cleanable/blood/drip/drop in T)
drips |= drop.drips
qdel(drop)
if(!large && drips.len < 3)
decal_type = /obj/effect/decal/cleanable/blood/drip
// Find a blood decal or create a new one.
B = locate(decal_type) in T
var/obj/effect/decal/cleanable/blood/B = locate() in T
if(!B)
B = new decal_type(T)
B = new /obj/effect/decal/cleanable/blood/splatter(T)
B.transfer_mob_blood_dna(src) //give blood info to the blood decal.
if(temp_blood_DNA)
B.blood_DNA |= temp_blood_DNA
B.update_icon()
var/obj/effect/decal/cleanable/blood/drip/drop = B
if(istype(drop) && drips && drips.len && !large)
drop.overlays |= drips
drop.drips |= drips
/mob/living/carbon/human/add_splatter_floor(turf/T, small_drip)
if(!(species && species.flags & NO_BLOOD))
..()
// If there's no data to copy, call it quits here.
if(!bld)
return B
/mob/living/carbon/alien/add_splatter_floor(turf/T, small_drip)
if(!T)
T = get_turf(src)
var/obj/effect/decal/cleanable/blood/xeno/B = locate() in T.contents
if(!B)
B = new(T)
B.blood_DNA["UNKNOWN DNA"] = "X*"
// Update appearance.
if(bld.data["blood_colour"])
B.basecolor = bld.data["blood_colour"]
B.update_icon()
// Update blood information.
if(bld.data["blood_DNA"])
B.blood_DNA = list()
if(bld.data["blood_type"])
B.blood_DNA[bld.data["blood_DNA"]] = bld.data["blood_type"]
else
B.blood_DNA[bld.data["blood_DNA"]] = "O+"
return B
/mob/living/silicon/robot/add_splatter_floor(turf/T, small_drip)
if(!T)
T = get_turf(src)
var/obj/effect/decal/cleanable/blood/oil/B = locate() in T.contents
if(!B)
B = new(T)
+3 -2
View File
@@ -32,6 +32,7 @@ var/list/organ_cache = list()
var/sterile = 0 //can the organ be infected by germs?
var/tough = 0 //can organ be easily damaged?
/obj/item/organ/Destroy()
processing_objects.Remove(src)
if(owner)
@@ -316,9 +317,9 @@ var/list/organ_cache = list()
loc = get_turf(owner)
processing_objects |= src
var/datum/reagent/blood/organ_blood
if(reagents) organ_blood = reagents.get_reagent_from_id(owner.get_blood_name())
if(reagents) organ_blood = reagents.get_reagent_from_id(owner.get_blood_id())
if((!organ_blood || !organ_blood.data["blood_DNA"]) && (owner && !(owner.species.flags & NO_BLOOD)))
owner.vessel.trans_to(src, 5, 1, 1)
owner.transfer_blood_to(src)
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
if(user)
@@ -577,9 +577,9 @@ Note that amputating the affected organ does in fact remove the infection from t
var/bicardose = owner.reagents.get_reagent_amount("styptic_powder")
if(!bicardose) //styptic powder stops internal wounds from growing bigger with time, and also stop bleeding
W.open_wound(0.1 * wound_update_accuracy)
owner.vessel.remove_reagent("blood",0.05 * W.damage * wound_update_accuracy)
owner.blood_volume -= (0.05 * W.damage * wound_update_accuracy)
owner.vessel.remove_reagent("blood",0.02 * W.damage * wound_update_accuracy)
owner.blood_volume -= (0.02 * W.damage * wound_update_accuracy)
if(prob(1 * wound_update_accuracy))
owner.custom_pain("You feel a stabbing pain in your [name]!",1)
@@ -744,7 +744,7 @@ Note that amputating the affected organ does in fact remove the infection from t
switch(disintegrate)
if(DROPLIMB_SHARP)
compile_icon()
add_blood(victim)
add_blood(victim.blood_DNA, victim.species.blood_color)
var/matrix/M = matrix()
M.Turn(rand(180))
src.transform = M
+13 -11
View File
@@ -224,10 +224,11 @@
if(world.time > (last_pump + pump_delay))
if(ishuman(owner) && owner.client) //While this entire item exists to make people suffer, they can't control disconnects.
var/mob/living/carbon/human/H = owner
H.vessel.remove_reagent("blood", blood_loss)
to_chat(H, "<span class='userdanger'>You have to keep pumping your blood!</span>")
if(H.client)
H.client.color = "red" //bloody screen so real
if(!(H.species.flags & NO_BLOOD))
H.blood_volume = max(H.blood_volume - blood_loss, 0)
to_chat(H, "<span class='userdanger'>You have to keep pumping your blood!</span>")
if(H.client)
H.client.color = "red" //bloody screen so real
else
last_pump = world.time //lets be extra fair *sigh*
@@ -256,13 +257,14 @@
var/mob/living/carbon/human/H = owner
if(istype(H))
H.vessel.add_reagent("blood", (cursed_heart.blood_loss*0.5))//gain half the blood back from a failure
if(owner.client)
owner.client.color = ""
if(!(H.species.flags & NO_BLOOD))
H.blood_volume = min(H.blood_volume + cursed_heart.blood_loss*0.5, BLOOD_VOLUME_MAXIMUM)
if(owner.client)
owner.client.color = ""
H.adjustBruteLoss(-cursed_heart.heal_brute)
H.adjustFireLoss(-cursed_heart.heal_burn)
H.adjustOxyLoss(-cursed_heart.heal_oxy)
H.adjustBruteLoss(-cursed_heart.heal_brute)
H.adjustFireLoss(-cursed_heart.heal_burn)
H.adjustOxyLoss(-cursed_heart.heal_oxy)
/obj/item/organ/internal/lungs
name = "lungs"
@@ -289,7 +291,7 @@
if(is_bruised())
if(prob(2))
owner.custom_emote(1, "coughs up blood!")
owner.drip(10)
owner.bleed(1)
if(prob(4))
owner.custom_emote(1, "gasps for air!")
owner.AdjustLoseBreath(5)
+1 -1
View File
@@ -244,7 +244,7 @@ var/static/regex/multispin_words = regex("like a record baby")
//BLEED
else if((findtext(message, bleed_words)))
for(var/mob/living/carbon/human/H in listeners)
H.drip(100 * power_multiplier)
H.bleed_rate += (5 * power_multiplier)
next_command = world.time + cooldown_damage
//FIRE