[MIRROR] [READY] Several fixes/changes to mood, longterm mood effects, beauty component (#5992)

* [READY] Several fixes/changes to mood, longterm mood effects, beauty component (#36344)

cl Floyd / Qustinnus
del: Removes short-term effects of mood
add; Adds long-term effects of mood by implementing sanity which goes up with good mood, down with bad mood, but takes time to change. Your sanity can be seen as your average mood in the recent past. All effects of moods are now covered by this system
add: Beauty component, currently only attached to cleanables, but you could attach it to any atom/movable and make them pretty/ugly, affecting mood of anyone in the room.
refactor: Removes the original way of adding mood events, uses signals properly instead.
fix: Cleanables "giving" area's free beauty during initialization
fix: Fixes some events not clearing properly
/cl

Fixes #36444

From now on mood no longer affects you directly, instead it decides whether your sanity goes up or down, when your sanity gets too low you will get the effects of what mood did before.

This means getting hit with bad moods due to being attacked while not mean you are doomed anymore, and you get a large timeframe to get away and just fix your mood later.

I also added the beauty component, you could add this to any object and it would either make a room prettier or uglier, comparable to DF or Rimworld. You could add traits to make certain people ugly, for example.

* [READY] Several fixes/changes to mood, longterm mood effects, beauty component
This commit is contained in:
CitadelStationBot
2018-03-19 21:33:18 -05:00
committed by Poojawa
parent 088f3fda5d
commit dad2d44ea2
64 changed files with 394 additions and 345 deletions
+2 -5
View File
@@ -755,17 +755,14 @@
//called when we get cuffed/uncuffed
/mob/living/carbon/proc/update_handcuffed()
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if(handcuffed)
drop_all_held_items()
stop_pulling()
throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = src.handcuffed)
if(mood)
mood.add_event("handcuffed", /datum/mood_event/handcuffed)
SendSignal(COMSIG_ADD_MOOD_EVENT, "handcuffed", /datum/mood_event/handcuffed)
else
clear_alert("handcuffed")
if(mood)
mood.clear_event("handcuffed")
SendSignal(COMSIG_CLEAR_MOOD_EVENT, "handcuffed")
update_action_buttons_icon() //some of our action buttons might be unusable when we're handcuffed.
update_inv_handcuffed()
update_hud_handcuffed()
@@ -277,9 +277,7 @@
else
M.visible_message("<span class='notice'>[M] hugs [src] to make [p_them()] feel better!</span>", \
"<span class='notice'>You hug [src] to make [p_them()] feel better!</span>")
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if(mood)
mood.add_event("hug", /datum/mood_event/hug)
SendSignal(COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/hug)
AdjustStun(-60)
AdjustKnockdown(-60)
AdjustUnconscious(-60)
@@ -32,6 +32,7 @@
/mob/living/carbon/human/ComponentInitialize()
. = ..()
if(!CONFIG_GET(flag/disable_human_mood))
AddComponent(/datum/component/mood)
@@ -229,9 +230,7 @@
usr.visible_message("[usr] successfully rips [I] out of their [L.name]!","<span class='notice'>You successfully remove [I] from your [L.name].</span>")
if(!has_embedded_objects())
clear_alert("embeddedobject")
GET_COMPONENT_FROM(mood, /datum/component/mood, usr)
if(mood)
mood.clear_event("embeddedobject")
usr.SendSignal(COMSIG_CLEAR_MOOD_EVENT, "embedded")
return
if(href_list["item"])
@@ -660,9 +659,7 @@
return
src.visible_message("[src] performs CPR on [C.name]!", "<span class='notice'>You perform CPR on [C.name].</span>")
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if(mood)
mood.add_event("perform_cpr", /datum/mood_event/perform_cpr)
SendSignal(COMSIG_ADD_MOOD_EVENT, "perform_cpr", /datum/mood_event/perform_cpr)
C.cpr_time = world.time
add_logs(src, C, "CPRed")
@@ -144,9 +144,7 @@
I.forceMove(src)
L.receive_damage(I.w_class*I.embedding.embedded_impact_pain_multiplier)
visible_message("<span class='danger'>[I] embeds itself in [src]'s [L.name]!</span>","<span class='userdanger'>[I] embeds itself in your [L.name]!</span>")
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if(mood)
mood.add_event("embedded", /datum/mood_event/embedded)
SendSignal(COMSIG_ADD_MOOD_EVENT, "embedded", /datum/mood_event/embedded)
hitpush = FALSE
skipcatch = TRUE //can't catch the now embedded item
+5 -10
View File
@@ -85,18 +85,15 @@
to_chat(src, "<span class='notice'>You don't feel like harming anybody.</span>")
a_intent_change(INTENT_HELP)
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if (getBrainLoss() >= 60 && stat == CONSCIOUS)
if(mood)
mood.add_event("brain_damage", /datum/mood_event/brain_damage)
if (getBrainLoss() >= 60 && !incapacitated(TRUE))
SendSignal(COMSIG_ADD_MOOD_EVENT, "brain_damage", /datum/mood_event/brain_damage)
if(prob(3))
if(prob(25))
emote("drool")
else
say(pick_list_replacements(BRAIN_DAMAGE_FILE, "brain_damage"))
else
if(mood)
mood.clear_event("brain_damage")
SendSignal(COMSIG_CLEAR_MOOD_EVENT, "brain_damage")
/mob/living/carbon/human/handle_mutations_and_radiation()
if(!dna || !dna.species.handle_mutations_and_radiation(src))
@@ -343,9 +340,7 @@
visible_message("<span class='danger'>[I] falls out of [name]'s [BP.name]!</span>","<span class='userdanger'>[I] falls out of your [BP.name]!</span>")
if(!has_embedded_objects())
clear_alert("embeddedobject")
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if(mood)
mood.clear_event("embedded")
SendSignal(COMSIG_CLEAR_MOOD_EVENT, "embedded")
/mob/living/carbon/human/proc/handle_active_genes()
for(var/datum/mutation/human/HM in dna.mutations)
@@ -474,4 +469,4 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put
#undef THERMAL_PROTECTION_ARM_LEFT
#undef THERMAL_PROTECTION_ARM_RIGHT
#undef THERMAL_PROTECTION_HAND_LEFT
#undef THERMAL_PROTECTION_HAND_RIGHT
#undef THERMAL_PROTECTION_HAND_RIGHT
+19 -36
View File
@@ -1124,14 +1124,8 @@ GLOBAL_LIST_EMPTY(roundstart_races)
// THEY HUNGER
var/hunger_rate = HUNGER_FACTOR
GET_COMPONENT_FROM(mood, /datum/component/mood, H)
if(mood)
switch(mood.mood) //Alerts do_after delay based on how happy you are
if(MOOD_LEVEL_HAPPY2 to MOOD_LEVEL_HAPPY3)
hunger_rate *= 0.9
if(MOOD_LEVEL_HAPPY3 to MOOD_LEVEL_HAPPY4)
hunger_rate *= 0.8
if(MOOD_LEVEL_HAPPY4 to INFINITY)
hunger_rate *= 0.7
if(mood && mood.sanity > SANITY_DISTURBED)
hunger_rate *= min(0.5, 1 - 0.002 * mood.sanity) //0.85 to 0.75
if(H.satiety > 0)
H.satiety--
@@ -1166,31 +1160,24 @@ GLOBAL_LIST_EMPTY(roundstart_races)
to_chat(H, "<span class='notice'>You no longer feel vigorous.</span>")
H.metabolism_efficiency = 1
GET_COMPONENT_FROM(mood, /datum/component/mood, H)
switch(H.nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
if(mood)
mood.add_event("nutrition", /datum/mood_event/nutrition/fat)
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "nutrition", /datum/mood_event/nutrition/fat)
H.throw_alert("nutrition", /obj/screen/alert/fat)
if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL)
if(mood)
mood.add_event("nutrition", /datum/mood_event/nutrition/wellfed)
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "nutrition", /datum/mood_event/nutrition/wellfed)
H.clear_alert("nutrition")
if( NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
if(mood)
mood.add_event("nutrition", /datum/mood_event/nutrition/fed)
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "nutrition", /datum/mood_event/nutrition/fed)
H.clear_alert("nutrition")
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
if(mood)
mood.clear_event("nutrition")
H.SendSignal(COMSIG_CLEAR_MOOD_EVENT, "nutrition")
H.clear_alert("nutrition")
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
if(mood)
mood.add_event("nutrition", /datum/mood_event/nutrition/hungry)
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "nutrition", /datum/mood_event/nutrition/hungry)
H.throw_alert("nutrition", /obj/screen/alert/hungry)
if(0 to NUTRITION_LEVEL_STARVING)
if(mood)
mood.add_event("nutrition", /datum/mood_event/nutrition/starving)
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "nutrition", /datum/mood_event/nutrition/starving)
H.throw_alert("nutrition", /obj/screen/alert/starving)
/datum/species/proc/update_health_hud(mob/living/carbon/human/H)
@@ -1300,12 +1287,12 @@ GLOBAL_LIST_EMPTY(roundstart_races)
GET_COMPONENT_FROM(mood, /datum/component/mood, H)
if(mood && !flight) //How can depression slow you down if you can just fly away from your problems?
switch(mood.mood)
if(-INFINITY to MOOD_LEVEL_SAD4)
switch(mood.sanity)
if(SANITY_INSANE to SANITY_CRAZY)
. += 1.5
if(MOOD_LEVEL_SAD4 to MOOD_LEVEL_SAD3)
if(SANITY_CRAZY to SANITY_UNSTABLE)
. += 1
if(MOOD_LEVEL_SAD3 to MOOD_LEVEL_SAD2)
if(SANITY_UNSTABLE to SANITY_DISTURBED)
. += 0.5
if(H.has_trait(TRAIT_FAT))
@@ -1728,13 +1715,11 @@ GLOBAL_LIST_EMPTY(roundstart_races)
H.adjust_bodytemperature(natural*(1/(thermal_protection+1)) + min(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX))
// +/- 50 degrees from 310K is the 'safe' zone, where no damage is dealt.
GET_COMPONENT_FROM(mood, /datum/component/mood, H)
if(H.bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT && !H.has_trait(TRAIT_RESISTHEAT))
//Body temperature is too hot.
var/burn_damage
if(mood)
mood.clear_event("cold")
mood.add_event("hot", /datum/mood_event/hot)
H.SendSignal(COMSIG_CLEAR_MOOD_EVENT, "cold")
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "hot", /datum/mood_event/hot)
switch(H.bodytemperature)
if(BODYTEMP_HEAT_DAMAGE_LIMIT to 400)
H.throw_alert("temp", /obj/screen/alert/hot, 1)
@@ -1754,9 +1739,8 @@ GLOBAL_LIST_EMPTY(roundstart_races)
H.apply_damage(burn_damage, BURN)
else if(H.bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT && !(GLOB.mutations_list[COLDRES] in H.dna.mutations))
if(mood)
mood.clear_event("hot")
mood.add_event("cold", /datum/mood_event/cold)
H.SendSignal(COMSIG_CLEAR_MOOD_EVENT, "hot")
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "cold", /datum/mood_event/cold)
switch(H.bodytemperature)
if(200 to BODYTEMP_COLD_DAMAGE_LIMIT)
H.throw_alert("temp", /obj/screen/alert/cold, 1)
@@ -1770,9 +1754,8 @@ GLOBAL_LIST_EMPTY(roundstart_races)
else
H.clear_alert("temp")
if(mood)
mood.clear_event("cold")
mood.clear_event("hot")
H.SendSignal(COMSIG_CLEAR_MOOD_EVENT, "cold")
H.SendSignal(COMSIG_CLEAR_MOOD_EVENT, "hot")
var/pressure = environment.return_pressure()
var/adjusted_pressure = H.calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob.
@@ -1866,7 +1849,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
H.adjust_bodytemperature(11)
else
H.adjust_bodytemperature(BODYTEMP_HEATING_MAX + (H.fire_stacks * 12))
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "on_fire", /datum/mood_event/on_fire)
/datum/species/proc/CanIgniteMob(mob/living/carbon/human/H)
if(H.has_trait(TRAIT_NOFIRE))
+2 -5
View File
@@ -144,7 +144,6 @@
//OXYGEN
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if(O2_partialpressure < safe_oxy_min) //Not enough oxygen
if(prob(20))
emote("gasp")
@@ -157,8 +156,7 @@
adjustOxyLoss(3)
failed_last_breath = 1
throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
if(mood)
mood.add_event("suffocation", /datum/mood_event/suffocation)
SendSignal(COMSIG_ADD_MOOD_EVENT, "suffocation", /datum/mood_event/suffocation)
else //Enough oxygen
failed_last_breath = 0
@@ -166,8 +164,7 @@
adjustOxyLoss(-5)
oxygen_used = breath_gases[/datum/gas/oxygen][MOLES]
clear_alert("not_enough_oxy")
if(mood)
mood.clear_event("suffocation")
SendSignal(COMSIG_CLEAR_MOOD_EVENT, "suffocation")
breath_gases[/datum/gas/oxygen][MOLES] -= oxygen_used
breath_gases[/datum/gas/carbon_dioxide][MOLES] += oxygen_used
@@ -162,4 +162,4 @@
I.take_damage(fire_stacks, BURN, "fire", 0)
adjust_bodytemperature(BODYTEMP_HEATING_MAX)
SendSignal(COMSIG_ADD_MOOD_EVENT, "on_fire", /datum/mood_event/on_fire)
@@ -42,17 +42,14 @@
/mob/living/carbon/adjust_drugginess(amount)
druggy = max(druggy+amount, 0)
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if(druggy)
overlay_fullscreen("high", /obj/screen/fullscreen/high)
throw_alert("high", /obj/screen/alert/high)
if(mood)
mood.add_event("high", /datum/mood_event/drugs/high)
SendSignal(COMSIG_ADD_MOOD_EVENT, "high", /datum/mood_event/drugs/high)
else
clear_fullscreen("high")
clear_alert("high")
if(mood)
mood.clear_event("high")
SendSignal(COMSIG_CLEAR_MOOD_EVENT, "high")
/mob/living/carbon/set_drugginess(amount)
druggy = max(amount, 0)
+1 -6
View File
@@ -984,9 +984,6 @@
"<span class='userdanger'>You're set on fire!</span>")
new/obj/effect/dummy/fire(src)
throw_alert("fire", /obj/screen/alert/fire)
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if(mood)
mood.add_event("on_fire", /datum/mood_event/on_fire)
update_fire()
return TRUE
return FALSE
@@ -998,9 +995,7 @@
for(var/obj/effect/dummy/fire/F in src)
qdel(F)
clear_alert("fire")
GET_COMPONENT_FROM(mood, /datum/component/mood, src)
if(mood)
mood.clear_event("on_fire")
SendSignal(COMSIG_CLEAR_MOOD_EVENT, "on_fire")
update_fire()
/mob/living/proc/adjust_fire_stacks(add_fire_stacks) //Adjusting the amount of fire_stacks we have on person
@@ -231,9 +231,7 @@
return
if(!item_to_add)
user.visible_message("[user] pets [src].","<span class='notice'>You rest your hand on [src]'s head for a moment.</span>")
GET_COMPONENT_FROM(mood, /datum/component/mood, user)
if(mood)
mood.add_event("pet_corgi", /datum/mood_event/pet_corgi)
user.SendSignal(COMSIG_ADD_MOOD_EVENT, "pet_corgi", /datum/mood_event/pet_corgi)
return
if(user && !user.temporarilyRemoveItemFromInventory(item_to_add))
@@ -616,9 +614,7 @@
if(M && stat != DEAD) // Added check to see if this mob (the dog) is dead to fix issue 2454
new /obj/effect/temp_visual/heart(loc)
emote("me", 1, "yaps happily!")
GET_COMPONENT_FROM(mood, /datum/component/mood, M)
if(mood)
mood.add_event("pet_corgi", /datum/mood_event/pet_corgi)
M.SendSignal(COMSIG_ADD_MOOD_EVENT, "pet_corgi", /datum/mood_event/pet_corgi)
else
if(M && stat != DEAD) // Same check here, even though emote checks it as well (poor form to check it only in the help case)
emote("me", 1, "growls!")