Files
Bubberstation/code/modules/unit_tests/bloody_footprints.dm
SmArtKar d841c9df40 [MDB IGNORE] Blood Refactor Chapter 2: Collector's Edition (#91054)
Refactors most of blood handling code untouched by #90593 and completely
rewrites all blood decals, components and reagents.

- Blood types now have behavioral flags which allow them to control
where they leave decals/DNA/viruses. Oil no longer transfers DNA and
viruses with it, while podpeople water-blood doesn't leave visible
decals on turfs and items, but still can be picked up by DNA scanners.
- Multiple blood types have received unique handling - liquid
electricity blood now glows in the dark, oil trails are flammable and
lube ones are slippery. Oil blood can be restored with fuel, lube with
silicon and slime with stable plasma (as normal plasma already passively
regenerates their blood), instead of everything using iron. Saline
solution only supplements on iron-based blood and won't do anything to
help with bloodloss for species who rely on different blood types.
(Roundstart this applies only to Ethereals)
- All blood logic has been moved away from the blood reagent itself into
a blood element that is assigned to the blood reagent by default, and to
any reagent that's drawn from a mob as their "blood" (in
``transfer_blood_to``). This means that blood you draw from lizards will
be green and have lizard's blood description instead of mentioning red
blood cells, Ethereal "blood" will actually contain their DNA and genes,
etc.
- Refactored all blood decals. Blood states are no more, everything is
now handled via blood DNA. Credits to MrMelbert and Maplestation, as a
significant amount of code has been taken from
https://github.com/MrMelbert/MapleStationCode/pull/436 and many of his
followup PRs. Oil and xenomorph splatters are now subtypes of blood,
blood drying is now animated, blood trails now curve and can be
diagonal.
- Rewrote bloodysoles and bloody_spreader components, credits to Melbert
again for the former, while latter now makes more sense with its
interactions. Bloody soles no longer share blood DNA with your hands.
- Ported Melbert's bloody footprint sprites and bot-blood-spreading
functionality.
- Removed all species-side reagent interactions, instead they're handled
by said species' livers. (This previously included exotic blood
handling, thus the removal)
- Slightly optimized human rendering by removing inbetween overlay
holders for clothing when they're not needed.
- Blood-transmitted diseases will now get added to many more decals than
before.
- Cleaned up and partially refactored replica pods, fixed an issue where
monkeys/manipulators were unable to harvest mindless pods.
- Exotic bloodtype on species now automatically assigns their blood
reagent, without the need to assign them separately.
- Clown mobs now bleed (with colorful reagent instead of blood during
april fools), and so do vatbeasts (lizard blood)
- Implemented generic procs for handling bleeding checks, all sorts of
scanners now also correctly call your blood for what it is.
- Podpeople's guts are now lime-green like their organs, instead of
being weirdly greyish like their water-blood. (Their bleeding overlays
are still grey, as they're bleeding water)
- Slimepeople now can bleed. Their jelly is pale purple in color, but
their wound overlays copy their body color.
- Injecting/spraying/splashing/etc mob with a reagent preserves its
data, so you could theoretically recycle fine wines from someone's
bloodstream
- Fixed burdened chaplain's sect never actually giving a blessing when
applying effects, and giving a blessing when nothing can be healed.
Inverted check strikes again.

- Closes #91039

A lot of blood here has dried, visually the blood colors are almost
exactly the same as before either of the blood refactors.

![dreamseeker_BSP7FE9pRB](https://github.com/user-attachments/assets/45711fa0-ae65-4ec2-9e89-753fa7dd876f)

![dreamseeker_zyv9ssh5VN](https://github.com/user-attachments/assets/7b112854-b7e3-4bfe-b78b-199a55b5b051)
2025-06-05 19:47:01 -04:00

59 lines
2.4 KiB
Plaintext

///Tests to make sure bloody footprits work as expected
///So no stacking, they actually apply, and shoe staining thrown in for free
/datum/unit_test/bloody_footprints
/datum/unit_test/bloody_footprints/Run()
var/mob/living/carbon/human/blood_master = allocate(/mob/living/carbon/human/consistent)
var/obj/item/clothing/shoes/holds_blood = allocate(/obj/item/clothing/shoes)
blood_master.equip_to_slot_if_possible(holds_blood, ITEM_SLOT_FEET)
var/turf/open/move_to = get_step(blood_master, get_dir(blood_master, run_loc_floor_top_right))
//We need to not be "on" the same tile as the pool
blood_master.forceMove(move_to)
var/obj/effect/decal/cleanable/blood/pool = allocate(/obj/effect/decal/cleanable/blood)
//Max out the pools blood, so each step will make things stained enough to matter
pool.bloodiness = BLOOD_POOL_MAX
pool.forceMove(run_loc_floor_bottom_left)
blood_master.forceMove(run_loc_floor_bottom_left)
var/datum/component/bloodysoles/soles = holds_blood.GetComponent(/datum/component/bloodysoles)
TEST_ASSERT(soles.total_bloodiness, "Shoes didn't become stained after stepping in a pool of blood")
//The bloody soles component handles the order of stepping on blood/stepping on a bloody tile in a constranating way
//Which means it needs to check and see if any time has passed between steps, so it can be sure the player is stepping onto a new tile (that should become bloody)
//I on the other hand need to do all my movements in one tick, so we need to sidestep this check
//Please kill me slowly
soles.last_pickup -= 1
//Move off the bloody tile, time to do some testing
blood_master.forceMove(move_to)
soles.last_pickup -= 1
blood_master.forceMove(run_loc_floor_bottom_left)
var/footprint_total = 0
for(var/obj/effect/decal/cleanable/blood/footprints/print_set in move_to)
footprint_total += 1
TEST_ASSERT(footprint_total, "The floor didn't get covered in blood after being walked over")
soles.last_pickup -= 1
//Another set of movements to try and make some doubled up prints
blood_master.forceMove(move_to)
soles.last_pickup -= 1
blood_master.forceMove(run_loc_floor_bottom_left)
footprint_total = 0
for(var/obj/effect/decal/cleanable/blood/footprints/print_set in move_to)
footprint_total += 1
TEST_ASSERT(footprint_total, "The floor somehow lost its footprints after being walked over")
TEST_ASSERT_EQUAL(footprint_total, 1, "The floor had more than one set of footprints in it, something is fucked")