Improve, cleanup, and expand wound code (#20757)

This PR includes several changes to bring our wound code up to date with
baystation, nebula, and modern standards. Highlights include:
- The usage of integers between 0 and 100 for ratios (expressed as a
percentage), instead of 0.0 to 1.0. Small decimal values are prone to
floating point precision errors, but by moving to a percentage instead,
we can reduce the impact of this.
- The untangling of damage flags and injury flags, which were used
interchangably in the code. This could have caused issues should we
expand any of these.
- Larger embedded objects now halt bleeding in wounds, until they are
pulled out. In exchange however, embedded objects will halt healing in
wounds (it is difficult to close an open wound that currently has a rod
stuck in it)
- A lot of data, such as implanted objects and organs, are now stored in
amputated limbs.
This commit is contained in:
Cody Brittain
2025-12-19 20:22:29 +00:00
committed by GitHub
parent 034d0e4cb1
commit 96a2951608
23 changed files with 861 additions and 575 deletions
+14 -7
View File
@@ -422,7 +422,14 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)
surge_damage = clamp(0, surge + surge_damage, MAXIMUM_SURGE_DAMAGE) //We want X seconds at most of hampered movement or what have you.
surge_time = world.time
/obj/item/organ/proc/removed(var/mob/living/carbon/human/target,var/mob/living/user)
/**
* Remove an organ
*
* drop_organ - if true, organ will be dropped at the loc of its former owner
* detach - if true, organ will be detached from parent. Keep false for organs
* removed together with parent, as with an amputation.
*/
/obj/item/organ/proc/removed(mob/living/carbon/human/target, mob/living/user, drop_organ = TRUE, detach = TRUE)
if(!istype(owner))
return
@@ -433,13 +440,13 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)
owner.internal_organs_by_name -= null
owner.internal_organs -= src
var/obj/item/organ/external/affected = owner.get_organ(parent_organ)
if(affected) affected.internal_organs -= src
if(detach)
var/obj/item/organ/external/affected = owner.get_organ(parent_organ)
if(affected)
affected.internal_organs -= src
var/turf/T = get_turf(owner)
// to avoid brains and things like that getting put into nullspace and thus entering spatial grids
if(!isnull(T))
loc = T
if(drop_organ)
dropInto(owner.loc)
START_PROCESSING(SSprocessing, src)
rejecting = null
if (!reagents)