From de0b8397b7752ebbb5e0394b5dc1b8b405f478e2 Mon Sep 17 00:00:00 2001 From: NightRed Date: Wed, 18 Nov 2020 10:31:29 -0600 Subject: [PATCH] Stomach food reagents on vomit (#55002) Missed check for stomach food reagents in stomach vomit code causing pain. Now vomit code checks that the reagents it has are not in the food reagents when applying damage. fixes #55000 --- code/modules/surgery/organs/stomach.dm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/code/modules/surgery/organs/stomach.dm b/code/modules/surgery/organs/stomach.dm index 985da6480bb..f9480287af1 100755 --- a/code/modules/surgery/organs/stomach.dm +++ b/code/modules/surgery/organs/stomach.dm @@ -85,14 +85,24 @@ if(!nutri) return + // remove the food reagent amount + var/nutri_vol = nutri.volume + var/amount_food = food_reagents[nutri.type] + if(amount_food) + nutri_vol = max(nutri_vol - amount_food, 0) + + // found nutriment was stomach food reagent + if(!(nutri_vol > 0)) + return + //The stomach is damage has nutriment but low on theshhold, lo prob of vomit - if(prob(damage * 0.025 * nutri.volume * nutri.volume)) + if(prob(damage * 0.025 * nutri_vol * nutri_vol)) body.vomit(damage) to_chat(body, "Your stomach reels in pain as you're incapable of holding down all that food!") return // the change of vomit is now high - if(damage > high_threshold && prob(damage * 0.1 * nutri.volume * nutri.volume)) + if(damage > high_threshold && prob(damage * 0.1 * nutri_vol * nutri_vol)) body.vomit(damage) to_chat(body, "Your stomach reels in pain as you're incapable of holding down all that food!")