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 -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)