Preliminary blood refactor (#93854)

## About The Pull Request

Moves all blood handling into procs and adds ways to easily hook into
basically every basic blood behavior.

This PR is not meant to fix every single case of janky blood logic in
the game. The main point and motivation of this PR is to add hooks for
blood behaviors. This allows for way more flexibility with blood code.

I am not going to fix our 3000 instances of single-letter vars, wacky
blood transfers, etc. This is just the groundwork for future PRs to
build off of, and by itself, should do very little to change blood
behavior.

I also added a rigorous set of unit tests for verifying that all of the
basic blood volume procs work correctly.

## Why It's Good For The Game

Previously, blood was handled via directly reading/writing
[var/blood_volume]. This was INCREDIBLY inconsistent and there was no
way to hook into it. This PR makes blood handling way more consistent,
which is great for all sorts of features.
This commit is contained in:
RikuTheKiller
2025-11-13 11:45:36 -06:00
committed by GitHub
parent fc6307f8c5
commit c7cb0674cc
92 changed files with 660 additions and 378 deletions
@@ -47,7 +47,7 @@
unsuitable_heat_damage = 20
ai_controller = /datum/ai_controller/basic_controller/alien
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
///List of loot items to drop when deleted, if this is set then we apply DEL_ON_DEATH
var/list/loot
+1 -1
View File
@@ -25,7 +25,7 @@
habitable_atmos = list("min_oxy" = 5, "max_oxy" = 0, "min_plas" = 0, "max_plas" = 1, "min_co2" = 0, "max_co2" = 5, "min_n2" = 0, "max_n2" = 0)
minimum_survivable_temperature = (T0C - 10)
maximum_survivable_temperature = (T0C + 100)
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
faction = list(FACTION_CLOWN)
ai_controller = /datum/ai_controller/basic_controller/clown
///list of stuff we drop on death
@@ -27,7 +27,7 @@
lighting_cutoff_blue = 20
ai_controller = /datum/ai_controller/basic_controller/vatbeast
faction = list(FACTION_HOSTILE)
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
/// What can you feed a vatbeast to tame it?
var/static/list/enjoyed_food = list(
/obj/item/food/carrotfries,
@@ -25,7 +25,7 @@
health = 50
maxHealth = 50
gold_core_spawnable = FRIENDLY_SPAWN
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
ai_controller = /datum/ai_controller/basic_controller/cow
/// what this cow munches on, and what can be used to tame it.
var/list/food_types = list(/obj/item/food/grown/wheat)
@@ -19,7 +19,7 @@
attack_sound = 'sound/items/weapons/punch1.ogg'
health = 75
maxHealth = 75
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
ai_controller = /datum/ai_controller/basic_controller/deer
/// Things that will scare us into being stationary. Vehicles are scary to deers because they might have headlights.
var/static/list/stationary_scary_things = list(/obj/vehicle)
@@ -31,7 +31,7 @@
minimum_survivable_temperature = COLD_ROOM_TEMP - 75 // enough so that they can survive the cold room spawn with plenty of room for comfort
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
ai_controller = /datum/ai_controller/basic_controller/goat
/// How often will we develop an evil gleam in our eye?
@@ -25,7 +25,7 @@
health = 50
maxHealth = 50
gold_core_spawnable = FRIENDLY_SPAWN
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
ai_controller = /datum/ai_controller/basic_controller/pig
/datum/emote/pig
@@ -22,7 +22,7 @@
health = 50
maxHealth = 50
gold_core_spawnable = FRIENDLY_SPAWN
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
ai_controller = /datum/ai_controller/basic_controller/pony
/// Do we register a unique rider?
var/unique_tamer = FALSE
@@ -23,7 +23,7 @@
health = 50
maxHealth = 50
gold_core_spawnable = FRIENDLY_SPAWN
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
ai_controller = /datum/ai_controller/basic_controller/sheep
/// Were we sacrificed by cultists?
+1 -1
View File
@@ -2,7 +2,7 @@
icon = 'icons/mob/simple/pets.dmi'
mob_size = MOB_SIZE_SMALL
mob_biotypes = MOB_ORGANIC|MOB_BEAST
blood_volume = BLOOD_VOLUME_NORMAL
default_blood_volume = BLOOD_VOLUME_NORMAL
basic_mob_flags = SENDS_DEATH_MOODLETS
/// if the mob is protected from being renamed by collars.
var/unique_pet = FALSE