Fixes the unstable quirk (#49309)

* Fixes mood 100% super duper for real this time

* fixes mood for real, removes a bit of convoluted code.
This commit is contained in:
nemvar
2020-02-12 19:01:04 -05:00
committed by GitHub
parent 44a5d54b9c
commit b7134336d7
+4 -7
View File
@@ -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