Skip to content

Commit

Permalink
moodproc tweaking
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCastmer committed Feb 9, 2024
1 parent ed0f6ed commit f0c2d9c
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/datums/components/mood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
if(9)
screen_obj.color = "#2eeb9a"
break

/*
/datum/component/mood/process(delta_time) //Called on SSmood process
var/mob/living/owner = parent
if(!owner)
Expand Down Expand Up @@ -259,7 +259,7 @@
master.remove_movespeed_modifier(MOVESPEED_ID_SANITY, TRUE)
sanity_level = 1
update_mood_icon()

*/
/datum/component/mood/proc/setInsanityEffect(newval)
if(newval == insanity_effect)
return
Expand Down
80 changes: 80 additions & 0 deletions modular_dripstation/code/datum/component/mood.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#define MINOR_INSANITY_PEN 5
#define MAJOR_INSANITY_PEN 10
//Okey, just mood rebalance
/datum/component/mood/process(delta_time)
var/mob/living/owner = parent
if(!owner)
qdel(src)
return

switch(mood_level)
if(1)
setSanity(sanity-0.3*delta_time, minimum=SANITY_INSANE)
if(2)
setSanity(sanity-0.15*delta_time, minimum=SANITY_INSANE)
if(3)
setSanity(sanity-0.1*delta_time, minimum=SANITY_CRAZY)
if(4)
setSanity(sanity-0.05*delta_time, minimum=SANITY_UNSTABLE)
if(5)
setSanity(sanity, minimum=SANITY_UNSTABLE) //This makes sure that mood gets increased should you be below the minimum.
if(6)
setSanity(sanity+0.15*delta_time, minimum=SANITY_UNSTABLE)
if(7)
setSanity(sanity+0.2*delta_time, minimum=SANITY_UNSTABLE)
if(8)
setSanity(sanity+0.25*delta_time, minimum=SANITY_NEUTRAL, maximum=SANITY_GREAT)
if(9)
setSanity(sanity+0.4*delta_time, minimum=SANITY_NEUTRAL, maximum=INFINITY)


if(HAS_TRAIT(owner, TRAIT_DEPRESSION))
if(prob(0.05))
add_event(null, "depression", /datum/mood_event/depression_mild)
clear_event(null, "jolly")
if(HAS_TRAIT(owner, TRAIT_JOLLY))
if(prob(0.05))
add_event(null, "jolly", /datum/mood_event/jolly)
clear_event(null, "depression")

HandleNutrition(owner)


/datum/component/mood/proc/setSanity(amount, minimum=SANITY_INSANE, maximum=SANITY_NEUTRAL)
if(amount < minimum)
amount += clamp(minimum - amount, 0, 0.7)
if(HAS_TRAIT(parent, TRAIT_UNSTABLE) || amount > maximum)
amount = min(sanity, amount)
if(amount == sanity) //Prevents stuff from flicking around.
return
sanity = amount
var/mob/living/master = parent
switch(sanity)
if(SANITY_INSANE to SANITY_CRAZY)
setInsanityEffect(MAJOR_INSANITY_PEN)
master.add_movespeed_modifier(MOVESPEED_ID_SANITY, TRUE, 100, override=TRUE, multiplicative_slowdown=0.75, movetypes=(~FLYING))
sanity_level = 6
if(SANITY_CRAZY to SANITY_UNSTABLE)
setInsanityEffect(MINOR_INSANITY_PEN)
master.add_movespeed_modifier(MOVESPEED_ID_SANITY, TRUE, 100, override=TRUE, multiplicative_slowdown=0.5, movetypes=(~FLYING))
sanity_level = 5
if(SANITY_UNSTABLE to SANITY_DISTURBED)
setInsanityEffect(0)
master.add_movespeed_modifier(MOVESPEED_ID_SANITY, TRUE, 100, override=TRUE, multiplicative_slowdown=0.25, movetypes=(~FLYING))
sanity_level = 4
if(SANITY_DISTURBED to SANITY_NEUTRAL)
setInsanityEffect(0)
master.remove_movespeed_modifier(MOVESPEED_ID_SANITY, TRUE)
sanity_level = 3
if(SANITY_NEUTRAL+1 to SANITY_GREAT+1) //shitty hack but +1 to prevent it from responding to super small differences
setInsanityEffect(0)
master.remove_movespeed_modifier(MOVESPEED_ID_SANITY, TRUE)
sanity_level = 2
if(SANITY_GREAT+1 to INFINITY)
setInsanityEffect(0)
master.remove_movespeed_modifier(MOVESPEED_ID_SANITY, TRUE)
sanity_level = 1
update_mood_icon()

#undef MINOR_INSANITY_PEN
#undef MAJOR_INSANITY_PEN
1 change: 1 addition & 0 deletions modular_dripstation/includes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "code\datum\component\transforming.dm"
#include "code\datum\reagent\baldium.dm"
#include "code\datum\reagent\chemoverride.dm"
#include "code\datum\component\mood.dm"
#include "code\datum\reagent\leadacetate.dm"
#include "code\datum\strong_pull.dm"
#include "code\datum\keybinding\communication.dm"
Expand Down

0 comments on commit f0c2d9c

Please sign in to comment.