From b7134336d7b20307b1a945fadfb1bb2e50da0780 Mon Sep 17 00:00:00 2001 From: nemvar <47324920+nemvar@users.noreply.github.com> Date: Thu, 13 Feb 2020 01:01:04 +0100 Subject: [PATCH] Fixes the unstable quirk (#49309) * Fixes mood 100% super duper for real this time * fixes mood for real, removes a bit of convoluted code. --- code/datums/components/mood.dm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/code/datums/components/mood.dm b/code/datums/components/mood.dm index 9b5ae3572ba..b98fa8d87e8 100644 --- a/code/datums/components/mood.dm +++ b/code/datums/components/mood.dm @@ -192,15 +192,12 @@ ///Sets sanity to the specified amount and applies effects. /datum/component/mood/proc/setSanity(amount, minimum=SANITY_INSANE, maximum=SANITY_GREAT, override = FALSE) - // If we're out of the acceptable minimum-maximum range move back towards it in steps of 0.5 + // If we're out of the acceptable minimum-maximum range move back towards it in steps of 0.7 // If the new amount would move towards the acceptable range faster then use it instead if(amount < minimum) - amount += CLAMP(minimum - sanity, 0, 0.7) - else - if(!override && HAS_TRAIT(parent, TRAIT_UNSTABLE)) - maximum = sanity - if(amount > maximum) - amount = min(maximum, sanity) + amount += clamp(minimum - amount, 0, 0.7) + if((!override && HAS_TRAIT(parent, TRAIT_UNSTABLE)) || amount > maximum) + amount = min(sanity, amount) if(amount == sanity) //Prevents stuff from flicking around. return sanity = amount