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
This commit is contained in:
NightRed
2020-11-18 11:31:29 -05:00
committed by GitHub
parent 88c860a18b
commit de0b8397b7
+12 -2
View File
@@ -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, "<span class='warning'>Your stomach reels in pain as you're incapable of holding down all that food!</span>")
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, "<span class='warning'>Your stomach reels in pain as you're incapable of holding down all that food!</span>")