[MIRROR] Addiction rework (#3445)

* Addiction rework

* a

Co-authored-by: Qustinnus <Floydje123@hotmail.com>
Co-authored-by: Gandalf2k15 <jzo123@hotmail.com>
This commit is contained in:
SkyratBot
2021-02-17 14:26:44 +00:00
committed by GitHub
co-authored by Qustinnus Gandalf2k15
parent 43febe3145
commit 3b85cf1430
45 changed files with 607 additions and 500 deletions
+15
View File
@@ -257,6 +257,8 @@
add_event(null, "jolly", /datum/mood_event/jolly)
///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.7
@@ -478,5 +480,18 @@
add_event(null, "slipped", /datum/mood_event/slipped)
/datum/component/mood/proc/HandleAddictions()
if(!iscarbon(parent))
return
var/mob/living/carbon/affected_carbon = parent
if(sanity < SANITY_GREAT) ///Sanity is low, stay addicted.
return
for(var/addiction_type in affected_carbon.mind.addiction_points)
var/datum/addiction/addiction_to_remove = SSaddiction.all_addictions[type]
affected_carbon.mind.remove_addiction_points(type, addiction_to_remove.high_sanity_addiction_loss) //If true was returned, we lost the addiction!
#undef MINOR_INSANITY_PEN
#undef MAJOR_INSANITY_PEN