Skip to content

Commit

Permalink
Fixing blood spreading too much during surgery (#26266)
Browse files Browse the repository at this point in the history
* bloody blood

* ehhhh

* here too

* bloodwrite fix

* a

* review changes

* max blood amount to argument

* Update code/game/atoms.dm

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: HMBGERDO <[email protected]>

* Update code/modules/mob/living/carbon/human/human_defense.dm

Co-authored-by: DGamerL <[email protected]>
Signed-off-by: HMBGERDO <[email protected]>

* tab

---------

Signed-off-by: HMBGERDO <[email protected]>
Co-authored-by: DGamerL <[email protected]>
Co-authored-by: Burzah <[email protected]>
  • Loading branch information
3 people authored Aug 15, 2024
1 parent 6032712 commit fbe49da
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 23 deletions.
21 changes: 17 additions & 4 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
/obj/effect/decal/cleanable/blood/splatter/transfer_mob_blood_dna(mob/living/L)
..(L)
var/list/b_data = L.get_blood_data(L.get_blood_id())
if(b_data)
if(b_data && !isnull(b_data["blood_color"]))
basecolor = b_data["blood_color"]
else
basecolor = "#A10808"
Expand All @@ -878,7 +878,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
/obj/effect/decal/cleanable/blood/footprints/transfer_mob_blood_dna(mob/living/L)
..(L)
var/list/b_data = L.get_blood_data(L.get_blood_id())
if(b_data)
if(b_data && !isnull(b_data["blood_color"]))
basecolor = b_data["blood_color"]
else
basecolor = "#A10808"
Expand Down Expand Up @@ -920,9 +920,22 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
add_blood_overlay()
return TRUE //we applied blood to the item

/obj/item/clothing/gloves/add_blood(list/blood_dna, b_color)
/*
* This proc makes src gloves bloody, if you touch something with them you will leave a blood trace
* blood_dna: list of blood DNAs stored in each atom in blood_DNA variable or in get_blood_dna_list() on carbons
* b_color: blood color, simple. If there will be null, the blood will be red, otherwise the color you pass
* amount: amount of "blood charges" you want to give to the gloves, that will be used to make items/walls bloody.
You can make something bloody this amount - 1 times.
If this variable will be null, amount will be set randomly from 2 to max_amount
* max_amount: if amount is not set, amount will be random from 2 to this value, default 4
*/
/obj/item/clothing/gloves/add_blood(list/blood_dna, b_color, amount, max_amount = 4)
. = ..()
transfer_blood = rand(2, 4)
if(isnull(amount))
transfer_blood = rand(2, max_amount)
else
transfer_blood = max(1, amount)

/turf/add_blood(list/blood_dna, b_color)
if(isnull(b_color))
Expand Down
5 changes: 4 additions & 1 deletion code/game/objects/effects/decals/Cleanable/humans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@
user.blood_DNA = list()
user.blood_DNA |= blood_DNA.Copy()
user.bloody_hands += taken
user.hand_blood_color = basecolor
if(isnull(basecolor))
user.hand_blood_color = "#A10808"
else
user.hand_blood_color = basecolor
user.update_inv_gloves()
add_verb(user, /mob/living/carbon/human/proc/bloody_doodle)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/soap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
if(!istype(carried_item, /obj/item/bio_chip))//If it's not an implant.
carried_item.add_mob_blood(target)//Oh yes, there will be blood...
var/mob/living/carbon/human/H = target
H.make_bloody_hands(H.get_blood_dna_list(), H.get_blood_color())
H.make_bloody_hands(H.get_blood_dna_list(), H.get_blood_color(), 0)
H.bloody_body(target)

return
Expand Down
9 changes: 2 additions & 7 deletions code/modules/detective_work/detective_work.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@
G.transfer_blood--

if(blood_DNA && should_spread_blood)
var/old_transfer_blood = G.transfer_blood
G.add_blood(blood_DNA, blood_color)
G.transfer_blood = max(1, old_transfer_blood)
M.update_inv_gloves()
M.make_bloody_hands(G.blood_DNA, G.blood_color, G.transfer_blood)

else
if(M.bloody_hands > 1 && add_blood(M.blood_DNA, M.hand_blood_color))
M.bloody_hands--

if(blood_DNA && should_spread_blood)
var/old_bloody_hands = M.bloody_hands
M.make_bloody_hands(blood_DNA, blood_color)
M.bloody_hands = max(1, old_bloody_hands)
M.make_bloody_hands(blood_DNA, blood_color, M.bloody_hands)

if(!suit_fibers) suit_fibers = list()
var/fibertext
Expand Down
19 changes: 16 additions & 3 deletions code/modules/mob/living/carbon/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -616,14 +616,27 @@ emp_act
visible_message("<span class='danger'>[I] embeds itself in [src]'s [L.name]!</span>","<span class='userdanger'>[I] embeds itself in your [L.name]!</span>")
return TRUE

/mob/living/carbon/human/proc/make_bloody_hands(list/blood_dna, b_color)
/*
* This proc makes human hands bloody, if you touch something, you will leave a blood trace
* blood_dna: list of blood DNAs stored in each atom in blood_DNA variable or in get_blood_dna_list() on carbons
* b_color: blood color, simple. If there will be null, the blood will be red, otherwise the color you pass
* amount: amount of "blood charges" you want to give, that will be used to make items/walls bloody.
You can make something bloody this amount - 1 times.
If this variable will be null, amount will be set randomly from 2 to max_amount
* max_amount: if amount is not set, amount will be random from 2 to this value, default 4
*/
/mob/living/carbon/human/proc/make_bloody_hands(list/blood_dna, b_color, amount, max_amount = 4)
if(isnull(b_color))
b_color = "#A10808"
if(gloves)
gloves.add_blood(blood_dna, blood_color)
gloves.add_blood(blood_dna, blood_color, amount, max_amount)
else
hand_blood_color = b_color
bloody_hands = rand(2, 4)
if(isnull(amount))
bloody_hands = rand(2, max_amount)
else
bloody_hands = max(1, amount)
transfer_blood_dna(blood_dna)
add_verb(src, /mob/living/carbon/human/proc/bloody_doodle)
update_inv_gloves() //updates on-mob overlays for bloody hands and/or bloody gloves
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/carbon/human/human_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@
if(incapacitated())
to_chat(src, "<span class='warning'>You can't write on the floor in your current state!</span>")
return
if(!bloody_hands)
if(bloody_hands <= 1)
remove_verb(src, /mob/living/carbon/human/proc/bloody_doodle)

if(gloves)
Expand Down Expand Up @@ -1310,15 +1310,15 @@
to_chat(src, "<span class='warning'>There is no space to write on!</span>")
return

var/max_length = bloody_hands * 30 //tweeter style
var/max_length = (bloody_hands - 1) * 30 //tweeter style

var/message = tgui_input_text(src, "Write a message. It cannot be longer than [max_length] characters.", "Blood writing", max_length = max_length)
if(origin != loc)
to_chat(src, "<span class='notice'>Stay still while writing!</span>")
return
if(message)
var/used_blood_amount = round(length(message) / 30, 1)
bloody_hands = max(0, bloody_hands - used_blood_amount) //use up some blood
bloody_hands = max(1, bloody_hands - used_blood_amount) //use up some blood

if(length(message) > max_length)
message += "-"
Expand Down
10 changes: 8 additions & 2 deletions code/modules/surgery/organs/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@
drop.overlays |= I

drop.transfer_mob_blood_dna(src)
drop.basecolor = b_data["blood_color"]
if(b_data && !isnull(b_data["blood_color"]))
drop.basecolor = b_data["blood_color"]
else
drop.basecolor = "#A10808"
drop.update_icon()
else
temp_blood_DNA = list()
Expand All @@ -287,7 +290,10 @@
else
drop = new(T)
drop.transfer_mob_blood_dna(src)
drop.basecolor = b_data["blood_color"]
if(b_data && !isnull(b_data["blood_color"]))
drop.basecolor = b_data["blood_color"]
else
drop.basecolor = "#A10808"
drop.update_icon()
if(emittor_intertia)
drop.newtonian_move(emittor_intertia)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/other.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
affected.fix_internal_bleeding()
if(ishuman(user) && prob(40))
var/mob/living/carbon/human/U = user
U.make_bloody_hands(target.get_blood_dna_list(), target.get_blood_color())
U.make_bloody_hands(target.get_blood_dna_list(), target.get_blood_color(), 0)

return SURGERY_STEP_CONTINUE

Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/surgery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
switch(blood_level)
if(SURGERY_BLOODSPREAD_HANDS)
target.visible_message("<span class='notice'>Blood splashes onto [user]'s hands.</span>")
H.make_bloody_hands(target.get_blood_dna_list(), target.get_blood_color())
H.make_bloody_hands(target.get_blood_dna_list(), target.get_blood_color(), 0)
if(SURGERY_BLOODSPREAD_FULLBODY)
target.visible_message("<span class='notice'>A spray of blood coats [user].</span>")
H.bloody_body(target)
Expand Down

0 comments on commit fbe49da

Please sign in to comment.