Skip to content

Commit

Permalink
Fixes bloodstains getting stuck (shiptest-ss13#2456)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

![image](https://github.com/shiptest-ss13/Shiptest/assets/45698967/0cfb95d1-673a-47a9-94dc-af3fba94430a)
As shown in image, bloodstains were getting stuck in the shape of the
first item to draw blood that round

Ports the rest of
[https://github.com/BeeStation/BeeStation-Hornet/pull/3111](url), which
seems to fix it.

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

Blub :)

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

:cl:
fix: bloodstains no longer steal the shape of the first item to spill
blood
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
Sun-Soaked authored and Mirag1993 committed Nov 10, 2023
1 parent 777f093 commit ccf2396
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
4 changes: 3 additions & 1 deletion code/datums/components/forensics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,6 @@
return
if(!length(blood_DNA))
return
parent.AddElement(/datum/element/decal/blood, _color = get_blood_dna_color(blood_DNA))
if(isitem(parent))
var/obj/item/I = parent
I.AddElement(/datum/element/decal/blood, initial(I.icon) || I.icon, initial(I.icon_state) || I.icon_state, _color = get_blood_dna_color(blood_DNA))
26 changes: 7 additions & 19 deletions code/datums/elements/decals/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,15 @@
return ..()

/datum/element/decal/blood/generate_appearance(_icon, _icon_state, _dir, _layer, _color, _alpha, source)
var/obj/item/I = source
if(!_icon)
_icon = 'icons/effects/blood.dmi'
if(!_icon_state)
_icon_state = "itemblood"
if(!_icon || !_icon_state)
return FALSE
if(!_color)
_color = COLOR_BLOOD
var/item_icon = I.icon
var/item_icon_state = I.icon_state
var/static/list/blood_splatter_appearances = list()
//try to find a pre-processed blood-splatter. otherwise, make a new one
var/index = "[REF(item_icon)]-[item_icon_state]"
pic = blood_splatter_appearances[index]

if(!pic)
var/icon/blood_splatter_icon = icon(I.icon, I.icon_state, null, 1) //we only want to apply blood-splatters to the initial icon_state for each object
blood_splatter_icon.Blend("#fff", ICON_ADD) //fills the icon_state with white (except where it's transparent)
blood_splatter_icon.Blend(icon(_icon, _icon_state), ICON_MULTIPLY) //adds blood and the remaining white areas become transparant
pic = mutable_appearance(blood_splatter_icon, initial(I.icon_state))
pic.color = _color
blood_splatter_appearances[index] = pic
var/icon/blood_splatter_icon = icon(_icon, _icon_state, , 1) //we only want to apply blood-splatters to the initial icon_state for each object
blood_splatter_icon.Blend("#fff", ICON_ADD) //fills the icon_state with white (except where it's transparent)
blood_splatter_icon.Blend(icon('icons/effects/blood.dmi', "itemblood"), ICON_MULTIPLY) //adds blood and the remaining white areas become transparant
pic = mutable_appearance(blood_splatter_icon)
pic.color = _color
return TRUE

/datum/element/decal/blood/proc/get_examine_name(datum/source, mob/user, list/override)
Expand Down

0 comments on commit ccf2396

Please sign in to comment.