From 12bb4f00bf8f8fd557b9dbdb7854fd01fffa33c0 Mon Sep 17 00:00:00 2001 From: Runa Dacino Date: Sun, 13 Aug 2023 20:11:00 +0200 Subject: [PATCH] fix(blood): Moves bloodloss scaling to before sanity checks Mob size affects how much blood you should lose, by default 1 (20/20). However, in cases this is not true (non-medium mobs), this can lead to overflow of blood taken as this scaling happens AFTER we ensure amt is not greater than whatever it takes to get 1 blood. This should safeguard against that. --- code/modules/organs/blood.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/organs/blood.dm b/code/modules/organs/blood.dm index b264c1eb95..c96a27e5d0 100644 --- a/code/modules/organs/blood.dm +++ b/code/modules/organs/blood.dm @@ -210,10 +210,12 @@ var/const/CE_STABLE_THRESHOLD = 0.5 if(!amt) return 0 + amt = amt * (src.mob_size/MOB_MEDIUM) + if(amt > vessel.get_reagent_amount("blood")) amt = vessel.get_reagent_amount("blood") - 1 // Bit of a safety net; it's impossible to add blood if there's not blood already in the vessel. - return vessel.remove_reagent("blood",amt * (src.mob_size/MOB_MEDIUM)) + return vessel.remove_reagent("blood",amt) /**************************************************** BLOOD TRANSFERS