From 34b4034777020d6b5e7d0245899f5ecdec7531eb Mon Sep 17 00:00:00 2001 From: Seth Scherer Date: Thu, 11 Aug 2022 16:59:20 -0400 Subject: [PATCH] Replaces the mood component with a mood datum (#68592) About The Pull Request Mood was abusing signals and get component pretty badly, so I redid it as a datum to stop this. Why It's Good For The CODEBASE Better code pratices, also gives admins easier tools to manage mood Changelog cl admin: Added two new procs into the VV dropdown menu to add and remove mood events from living mobs. /cl --- code/__DEFINES/dcs/signals/signals_heretic.dm | 3 - .../signals/signals_mob/signals_mob_carbon.dm | 2 + code/__DEFINES/dcs/signals/signals_mood.dm | 7 - code/__DEFINES/is_helpers.dm | 2 + code/__DEFINES/mobs.dm | 29 +- code/__DEFINES/traits.dm | 2 +- code/__DEFINES/vv.dm | 2 + code/__HELPERS/memory_helpers.dm | 9 +- code/_onclick/hud/alert.dm | 4 +- code/datums/brain_damage/creepy_trauma.dm | 6 +- code/datums/brain_damage/mild.dm | 4 +- code/datums/components/creamed.dm | 5 +- code/datums/components/embedded.dm | 4 +- code/datums/components/food/edible.dm | 8 +- code/datums/components/gunpoint.dm | 6 +- code/datums/components/mood.dm | 452 ---------------- code/datums/components/omen.dm | 6 +- code/datums/elements/art.dm | 22 +- code/datums/elements/eyestab.dm | 2 +- code/datums/elements/pet_bonus.dm | 2 +- code/datums/memory/memory.dm | 6 +- code/datums/mood.dm | 486 ++++++++++++++++++ code/datums/mood_events/_mood_event.dm | 25 +- .../mood_events/generic_positive_events.dm | 1 + code/datums/mutations/body.dm | 2 +- .../mutations/holy_mutation/honorbound.dm | 8 +- code/datums/mutations/hulk.dm | 4 +- code/datums/quirks/good.dm | 10 +- code/datums/quirks/negative.dm | 60 +-- code/datums/quirks/neutral.dm | 16 +- code/datums/status_effects/buffs.dm | 2 +- code/datums/status_effects/debuffs/debuffs.dm | 9 +- .../status_effects/debuffs/drugginess.dm | 4 +- code/datums/status_effects/debuffs/drunk.dm | 4 +- .../status_effects/debuffs/fire_stacks.dm | 4 +- .../status_effects/debuffs/jitteriness.dm | 4 +- code/datums/status_effects/drug_effects.dm | 4 +- code/datums/status_effects/neutral.dm | 5 +- code/game/machinery/computer/arcade/arcade.dm | 4 +- code/game/objects/items/cigs_lighters.dm | 2 +- code/game/objects/items/clown_items.dm | 2 +- code/game/objects/items/defib.dm | 2 +- code/game/objects/items/hand_items.dm | 21 +- code/game/objects/items/storage/book.dm | 2 +- code/game/objects/items/toys.dm | 14 +- code/game/objects/structures/guillotine.dm | 4 +- code/game/objects/structures/gym.dm | 4 +- code/game/objects/structures/shower.dm | 5 +- code/game/objects/structures/tables_racks.dm | 4 +- code/game/turfs/open/_open.dm | 1 + .../antagonists/_common/antag_datum.dm | 4 +- .../antagonists/ashwalker/ashwalker.dm | 2 +- .../modules/antagonists/heretic/influences.dm | 2 +- .../antagonists/heretic/items/madness_mask.dm | 2 +- .../sacrifice_knowledge.dm | 8 +- .../heretic/magic/flesh_ascension.dm | 2 +- .../heretic/magic/madness_touch.dm | 4 +- .../heretic/structures/carving_knife.dm | 2 +- .../traitor/components/demoraliser.dm | 11 +- .../antagonists/wizard/equipment/artefact.dm | 5 +- code/modules/cards/deck/deck.dm | 6 +- code/modules/client/verbs/suicide.dm | 2 +- code/modules/clothing/head/garlands.dm | 8 +- code/modules/clothing/shoes/_shoes.dm | 6 +- code/modules/clothing/shoes/clown.dm | 8 +- .../modules/clothing/suits/reactive_armour.dm | 2 +- code/modules/clothing/under/_under.dm | 4 +- code/modules/clothing/under/accessories.dm | 8 +- code/modules/fishing/aquarium/aquarium.dm | 6 +- code/modules/fishing/fishing_minigame.dm | 4 +- code/modules/food_and_drinks/drinks/drinks.dm | 10 +- code/modules/food_and_drinks/food.dm | 8 +- code/modules/hydroponics/grown/melon.dm | 2 +- code/modules/library/book.dm | 4 +- .../lavalandruin_code/elephantgraveyard.dm | 4 +- .../ruins/objects_and_mobs/ash_walker_den.dm | 4 +- .../mining/equipment/regenerative_core.dm | 2 +- code/modules/mob/living/carbon/carbon.dm | 14 +- .../mob/living/carbon/carbon_defense.dm | 17 +- code/modules/mob/living/carbon/examine.dm | 17 +- .../mob/living/carbon/human/examine.dm | 8 +- code/modules/mob/living/carbon/human/human.dm | 20 +- code/modules/mob/living/carbon/human/life.dm | 4 +- .../mob/living/carbon/human/species.dm | 18 +- .../carbon/human/species_types/golems.dm | 6 +- .../modules/mob/living/carbon/init_signals.dm | 6 +- code/modules/mob/living/carbon/life.dm | 24 +- code/modules/mob/living/living.dm | 50 ++ code/modules/mob/living/living_defines.dm | 3 + .../mob/living/silicon/silicon_defense.dm | 2 +- .../mob/living/simple_animal/friendly/dog.dm | 4 +- .../hostile/mining_mobs/elites/pandora.dm | 4 +- code/modules/mob/mob_arcade.dm | 7 +- code/modules/mod/modules/modules_service.dm | 4 +- .../delamination_effects.dm | 13 +- .../projectiles/guns/ballistic/revolver.dm | 4 +- .../projectiles/projectile/energy/stun.dm | 2 +- code/modules/projectiles/projectile/magic.dm | 2 +- code/modules/reagents/chemistry/reagents.dm | 4 +- .../chemistry/reagents/alcohol_reagents.dm | 4 +- .../reagents/cat2_medicine_reagents.dm | 2 +- .../chemistry/reagents/drink_reagents.dm | 4 +- .../chemistry/reagents/drug_reagents.dm | 30 +- .../chemistry/reagents/food_reagents.dm | 12 +- .../chemistry/reagents/medicine_reagents.dm | 7 +- .../chemistry/reagents/other_reagents.dm | 2 +- .../chemistry/reagents/toxin_reagents.dm | 2 +- .../modules/reagents/withdrawal/_addiction.dm | 10 +- .../reagents/withdrawal/generic_addictions.dm | 4 +- .../religion/festival/instrument_rites.dm | 2 +- code/modules/religion/religion_sects.dm | 12 +- code/modules/religion/rites.dm | 2 +- .../religion/sparring/sparring_datum.dm | 2 +- .../spells/spell_types/self/mime_vow.dm | 4 +- .../surgery/bodyparts/dismemberment.dm | 4 +- code/modules/surgery/organs/external/tails.dm | 12 +- code/modules/surgery/organs/external/wings.dm | 2 +- code/modules/surgery/organs/lungs.dm | 16 +- .../surgery/organs/stomach/_stomach.dm | 15 +- .../organs/stomach/stomach_ethereal.dm | 16 +- tgstation.dme | 3 +- 121 files changed, 968 insertions(+), 858 deletions(-) delete mode 100644 code/__DEFINES/dcs/signals/signals_mood.dm delete mode 100644 code/datums/components/mood.dm create mode 100644 code/datums/mood.dm diff --git a/code/__DEFINES/dcs/signals/signals_heretic.dm b/code/__DEFINES/dcs/signals/signals_heretic.dm index a3be544fec6..a80526f96ab 100644 --- a/code/__DEFINES/dcs/signals/signals_heretic.dm +++ b/code/__DEFINES/dcs/signals/signals_heretic.dm @@ -1,8 +1,5 @@ /// Heretic signals -/// From /obj/item/clothing/mask/madness_mask/process : (amount) -#define COMSIG_HERETIC_MASK_ACT "void_mask_act" - /// From /obj/item/melee/touch_attack/mansus_fist/on_mob_hit : (mob/living/source, mob/living/target) #define COMSIG_HERETIC_MANSUS_GRASP_ATTACK "mansus_grasp_attack" /// Default behavior is to use the hand, so return this to blocks the mansus fist from being consumed after use. diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm index 8d8e741416d..b7caf31c2cf 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm @@ -66,6 +66,8 @@ #define COMSIG_CARBON_SANITY_UPDATE "carbon_sanity_update" ///Called when a carbon breathes, before the breath has actually occured #define COMSIG_CARBON_PRE_BREATHE "carbon_pre_breathe" +///Called when a carbon updates their mood +#define COMSIG_CARBON_MOOD_UPDATE "carbon_mood_update" // /mob/living/carbon/human signals diff --git a/code/__DEFINES/dcs/signals/signals_mood.dm b/code/__DEFINES/dcs/signals/signals_mood.dm deleted file mode 100644 index fd5f5c9606e..00000000000 --- a/code/__DEFINES/dcs/signals/signals_mood.dm +++ /dev/null @@ -1,7 +0,0 @@ -//Mood -///called when you send a mood event from anywhere in the code. -#define COMSIG_ADD_MOOD_EVENT "add_mood" -///Mood event that only RnD members listen for -#define COMSIG_ADD_MOOD_EVENT_RND "RND_add_mood" -///called when you clear a mood event from anywhere in the code. -#define COMSIG_CLEAR_MOOD_EVENT "clear_mood" diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 1e39cb0d8e4..c97d36730c1 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -66,6 +66,8 @@ GLOBAL_LIST_INIT(turfs_openspace, typecacheof(list( #define ishuman(A) (istype(A, /mob/living/carbon/human)) +#define isdummy(A) (istype(A, /mob/living/carbon/human/dummy)) + //Human sub-species #define isabductor(A) (is_species(A, /datum/species/abductor)) #define isgolem(A) (is_species(A, /datum/species/golem)) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 6e0bca82b86..477e17cf990 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -221,15 +221,26 @@ #define BEAUTY_LEVEL_GREAT 100 //Moods levels for humans -#define MOOD_LEVEL_HAPPY4 15 -#define MOOD_LEVEL_HAPPY3 10 -#define MOOD_LEVEL_HAPPY2 6 -#define MOOD_LEVEL_HAPPY1 2 -#define MOOD_LEVEL_NEUTRAL 0 -#define MOOD_LEVEL_SAD1 -3 -#define MOOD_LEVEL_SAD2 -7 -#define MOOD_LEVEL_SAD3 -15 -#define MOOD_LEVEL_SAD4 -20 +#define MOOD_HAPPY4 15 +#define MOOD_HAPPY3 10 +#define MOOD_HAPPY2 6 +#define MOOD_HAPPY1 2 +#define MOOD_NEUTRAL 0 +#define MOOD_SAD1 -3 +#define MOOD_SAD2 -7 +#define MOOD_SAD3 -15 +#define MOOD_SAD4 -20 + +//Moods levels for humans +#define MOOD_LEVEL_HAPPY4 9 +#define MOOD_LEVEL_HAPPY3 8 +#define MOOD_LEVEL_HAPPY2 7 +#define MOOD_LEVEL_HAPPY1 6 +#define MOOD_LEVEL_NEUTRAL 5 +#define MOOD_LEVEL_SAD1 4 +#define MOOD_LEVEL_SAD2 3 +#define MOOD_LEVEL_SAD3 2 +#define MOOD_LEVEL_SAD4 1 //Sanity values for humans #define SANITY_MAXIMUM 150 diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 4e22c169ec5..f654d213b4e 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -813,7 +813,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define LIPSTICK_TRAIT "lipstick_trait" /// Self-explainatory. #define BEAUTY_ELEMENT_TRAIT "beauty_element" -#define MOOD_COMPONENT_TRAIT "mood_component" +#define MOOD_DATUM_TRAIT "mood_datum" #define DRONE_SHY_TRAIT "drone_shy" /// Pacifism trait given by stabilized light pink extracts. #define STABILIZED_LIGHT_PINK_TRAIT "stabilized_light_pink" diff --git a/code/__DEFINES/vv.dm b/code/__DEFINES/vv.dm index bd6d2fac721..58988ddb696 100644 --- a/code/__DEFINES/vv.dm +++ b/code/__DEFINES/vv.dm @@ -124,6 +124,8 @@ // /mob/living #define VV_HK_GIVE_SPEECH_IMPEDIMENT "impede_speech" +#define VV_HK_ADD_MOOD "addmood" +#define VV_HK_REMOVE_MOOD "removemood" // /mob/living/carbon #define VV_HK_MAKE_AI "aiify" diff --git a/code/__HELPERS/memory_helpers.dm b/code/__HELPERS/memory_helpers.dm index ff66ab12bf1..abda83bcbc9 100644 --- a/code/__HELPERS/memory_helpers.dm +++ b/code/__HELPERS/memory_helpers.dm @@ -42,16 +42,13 @@ extra_info[DETAIL_WHERE] = get_area(victim) if(!(memory_flags & MEMORY_FLAG_NOMOOD)) - var/datum/component/mood/victim_mood_component = current.GetComponent(/datum/component/mood) - if(victim_mood_component) - victim_mood = victim_mood_component.mood_level + if (current.mob_mood) + victim_mood = current.mob_mood.mood_level if(victim == current) story_mood = victim_mood else - var/datum/component/mood/memorizer_mood_component = current.GetComponent(/datum/component/mood) - if(memorizer_mood_component) - story_mood = memorizer_mood_component.mood_level + story_mood = current.mob_mood.mood_level extra_info[DETAIL_PROTAGONIST_MOOD] = victim_mood diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index 88ce60cf904..2caeb32c3c0 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -374,8 +374,8 @@ or shoot a gun to move around via Newton's 3rd Law of Motion." to_chat(rube, span_userdanger("[all_caps_for_emphasis]")) playsound(offerer, 'sound/weapons/thudswoosh.ogg', 100, TRUE, 1) rube.Knockdown(1 SECONDS) - SEND_SIGNAL(offerer, COMSIG_ADD_MOOD_EVENT, "high_five", /datum/mood_event/down_low) - SEND_SIGNAL(rube, COMSIG_ADD_MOOD_EVENT, "high_five", /datum/mood_event/too_slow) + offerer.add_mood_event("high_five", /datum/mood_event/down_low) + rube.add_mood_event("high_five", /datum/mood_event/too_slow) qdel(src) /// If someone examine_more's the offerer while they're trying to pull a too-slow, it'll tip them off to the offerer's trickster ways diff --git a/code/datums/brain_damage/creepy_trauma.dm b/code/datums/brain_damage/creepy_trauma.dm index bb7a210ead1..b4ab0a1b7a2 100644 --- a/code/datums/brain_damage/creepy_trauma.dm +++ b/code/datums/brain_damage/creepy_trauma.dm @@ -49,7 +49,7 @@ else viewing = FALSE if(viewing) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "creeping", /datum/mood_event/creeping, obsession.name) + owner.add_mood_event("creeping", /datum/mood_event/creeping, obsession.name) total_time_creeping += delta_time SECONDS time_spent_away = 0 if(attachedobsessedobj)//if an objective needs to tick down, we can do that since traumas coexist with the antagonist datum @@ -60,9 +60,9 @@ /datum/brain_trauma/special/obsessed/proc/out_of_view() time_spent_away += 20 if(time_spent_away > 1800) //3 minutes - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "creeping", /datum/mood_event/notcreepingsevere, obsession.name) + owner.add_mood_event("creeping", /datum/mood_event/notcreepingsevere, obsession.name) else - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "creeping", /datum/mood_event/notcreeping, obsession.name) + owner.add_mood_event("creeping", /datum/mood_event/notcreeping, obsession.name) /datum/brain_trauma/special/obsessed/on_lose() ..() diff --git a/code/datums/brain_damage/mild.dm b/code/datums/brain_damage/mild.dm index 844a910910b..09262e5940d 100644 --- a/code/datums/brain_damage/mild.dm +++ b/code/datums/brain_damage/mild.dm @@ -42,7 +42,7 @@ /datum/brain_trauma/mild/dumbness/on_gain() ADD_TRAIT(owner, TRAIT_DUMB, TRAUMA_TRAIT) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "dumb", /datum/mood_event/oblivious) + owner.add_mood_event("dumb", /datum/mood_event/oblivious) return ..() /datum/brain_trauma/mild/dumbness/on_life(delta_time, times_fired) @@ -55,7 +55,7 @@ /datum/brain_trauma/mild/dumbness/on_lose() REMOVE_TRAIT(owner, TRAIT_DUMB, TRAUMA_TRAIT) owner.remove_status_effect(/datum/status_effect/speech/stutter/derpspeech) - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "dumb") + owner.clear_mood_event("dumb") return ..() /datum/brain_trauma/mild/speech_impediment diff --git a/code/datums/components/creamed.dm b/code/datums/components/creamed.dm index 53c92ba2513..a00086a322a 100644 --- a/code/datums/components/creamed.dm +++ b/code/datums/components/creamed.dm @@ -31,7 +31,7 @@ GLOBAL_LIST_INIT(creamable, typecacheof(list( creamface.icon_state = "creampie_monkey" else creamface.icon_state = "creampie_human" - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "creampie", /datum/mood_event/creampie) + H.add_mood_event("creampie", /datum/mood_event/creampie) else if(iscorgi(parent)) creamface.icon_state = "creampie_corgi" else if(isAI(parent)) @@ -45,7 +45,8 @@ GLOBAL_LIST_INIT(creamable, typecacheof(list( A.cut_overlay(creamface) qdel(creamface) if(ishuman(A)) - SEND_SIGNAL(A, COMSIG_CLEAR_MOOD_EVENT, "creampie") + var/mob/living/carbon/human/human_parent = A + human_parent.clear_mood_event("creampie") return ..() /datum/component/creamed/RegisterWithParent() diff --git a/code/datums/components/embedded.dm b/code/datums/components/embedded.dm index 8e906890cf7..9c86fb938ff 100644 --- a/code/datums/components/embedded.dm +++ b/code/datums/components/embedded.dm @@ -95,7 +95,7 @@ playsound(victim,'sound/weapons/bladeslice.ogg', 40) weapon.add_mob_blood(victim)//it embedded itself in you, of course it's bloody! damage += weapon.w_class * impact_pain_mult - SEND_SIGNAL(victim, COMSIG_ADD_MOOD_EVENT, "embedded", /datum/mood_event/embedded) + victim.add_mood_event("embedded", /datum/mood_event/embedded) if(damage > 0) var/armor = victim.run_armor_check(limb.body_zone, MELEE, "Your armor has protected your [limb.plaintext_zone].", "Your armor has softened a hit to your [limb.plaintext_zone].",I.armour_penetration, weak_against_armour = I.weak_against_armour) @@ -105,7 +105,7 @@ var/mob/living/carbon/victim = parent if(victim && !victim.has_embedded_objects()) victim.clear_alert(ALERT_EMBEDDED_OBJECT) - SEND_SIGNAL(victim, COMSIG_CLEAR_MOOD_EVENT, "embedded") + victim.clear_mood_event("embedded") if(weapon) UnregisterSignal(weapon, list(COMSIG_MOVABLE_MOVED, COMSIG_PARENT_QDELETING)) weapon = null diff --git a/code/datums/components/food/edible.dm b/code/datums/components/food/edible.dm index 9bd95cfce62..eb1f806101e 100644 --- a/code/datums/components/food/edible.dm +++ b/code/datums/components/food/edible.dm @@ -463,7 +463,7 @@ Behavior that's still missing from this component that original food items had t //Bruh this breakfast thing is cringe and shouldve been handled separately from food-types, remove this in the future (Actually, just kill foodtypes in general) if((foodtypes & BREAKFAST) && world.time - SSticker.round_start_time < STOP_SERVING_BREAKFAST) - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "breakfast", /datum/mood_event/breakfast) + H.add_mood_event("breakfast", /datum/mood_event/breakfast) last_check_time = world.time if(HAS_TRAIT(H, TRAIT_AGEUSIA)) @@ -491,15 +491,15 @@ Behavior that's still missing from this component that original food items had t if(FOOD_TOXIC) to_chat(H,span_warning("What the hell was that thing?!")) H.adjust_disgust(25 + 30 * fraction) - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "toxic_food", /datum/mood_event/disgusting_food) + H.add_mood_event("toxic_food", /datum/mood_event/disgusting_food) if(FOOD_DISLIKED) to_chat(H,span_notice("That didn't taste very good...")) H.adjust_disgust(11 + 15 * fraction) - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "gross_food", /datum/mood_event/gross_food) + H.add_mood_event("gross_food", /datum/mood_event/gross_food) if(FOOD_LIKED) to_chat(H,span_notice("I love this taste!")) H.adjust_disgust(-5 + -2.5 * fraction) - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "fav_food", /datum/mood_event/favorite_food) + H.add_mood_event("fav_food", /datum/mood_event/favorite_food) if(istype(parent, /obj/item/food)) var/obj/item/food/memorable_food = parent if(memorable_food.venue_value >= FOOD_PRICE_EXOTIC) diff --git a/code/datums/components/gunpoint.dm b/code/datums/components/gunpoint.dm index 38799370ee6..aac05f094e0 100644 --- a/code/datums/components/gunpoint.dm +++ b/code/datums/components/gunpoint.dm @@ -51,7 +51,7 @@ target.do_alert_animation() target.playsound_local(target.loc, 'sound/machines/chime.ogg', 50, TRUE) - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, "gunpoint", /datum/mood_event/gunpoint) + target.add_mood_event("gunpoint", /datum/mood_event/gunpoint) addtimer(CALLBACK(src, .proc/update_stage, 2), GUNPOINT_DELAY_STAGE_2) @@ -59,7 +59,7 @@ var/mob/living/shooter = parent shooter.remove_status_effect(/datum/status_effect/holdup) target.remove_status_effect(/datum/status_effect/grouped/heldup, REF(shooter)) - SEND_SIGNAL(target, COMSIG_CLEAR_MOOD_EVENT, "gunpoint") + target.clear_mood_event("gunpoint") return ..() /datum/component/gunpoint/RegisterWithParent() @@ -131,7 +131,7 @@ var/mob/living/shooter = parent shooter.remove_status_effect(/datum/status_effect/holdup) // try doing these before the trigger gets pulled since the target (or shooter even) may not exist after pulling the trigger, dig? target.remove_status_effect(/datum/status_effect/grouped/heldup, REF(shooter)) - SEND_SIGNAL(target, COMSIG_CLEAR_MOOD_EVENT, "gunpoint") + target.clear_mood_event("gunpoint") if(point_of_no_return) return diff --git a/code/datums/components/mood.dm b/code/datums/components/mood.dm deleted file mode 100644 index 3ad561e741b..00000000000 --- a/code/datums/components/mood.dm +++ /dev/null @@ -1,452 +0,0 @@ -#define MINOR_INSANITY_PEN 5 -#define MAJOR_INSANITY_PEN 10 - -/datum/component/mood - var/mood //Real happiness - var/sanity = SANITY_NEUTRAL //Current sanity - var/shown_mood //Shown happiness, this is what others can see when they try to examine you, prevents antag checking by noticing traitors are always very happy. - var/mood_level = 5 //To track what stage of moodies they're on - var/sanity_level = SANITY_LEVEL_NEUTRAL //To track what stage of sanity they're on - var/mood_modifier = 1 //Modifier to allow certain mobs to be less affected by moodlets - var/list/datum/mood_event/mood_events = list() - var/insanity_effect = 0 //is the owner being punished for low mood? If so, how much? - var/atom/movable/screen/mood/screen_obj - -/datum/component/mood/Initialize() - if(!isliving(parent)) - return COMPONENT_INCOMPATIBLE - - START_PROCESSING(SSmood, src) - - RegisterSignal(parent, COMSIG_ADD_MOOD_EVENT, .proc/add_event) - RegisterSignal(parent, COMSIG_CLEAR_MOOD_EVENT, .proc/clear_event) - RegisterSignal(parent, COMSIG_ENTER_AREA, .proc/check_area_mood) - RegisterSignal(parent, COMSIG_LIVING_REVIVE, .proc/on_revive) - RegisterSignal(parent, COMSIG_MOB_HUD_CREATED, .proc/modify_hud) - RegisterSignal(parent, COMSIG_JOB_RECEIVED, .proc/register_job_signals) - RegisterSignal(parent, COMSIG_HERETIC_MASK_ACT, .proc/direct_sanity_drain) - RegisterSignal(parent, COMSIG_ON_CARBON_SLIP, .proc/on_slip) - - var/mob/living/owner = parent - owner.become_area_sensitive(MOOD_COMPONENT_TRAIT) - if(owner.hud_used) - modify_hud() - var/datum/hud/hud = owner.hud_used - hud.show_hud(hud.hud_version) - -/datum/component/mood/Destroy() - STOP_PROCESSING(SSmood, src) - var/atom/movable/movable_parent = parent - movable_parent.lose_area_sensitivity(MOOD_COMPONENT_TRAIT) - unmodify_hud() - return ..() - -/datum/component/mood/proc/register_job_signals(datum/source, job) - SIGNAL_HANDLER - - if(job in list(JOB_RESEARCH_DIRECTOR, JOB_SCIENTIST, JOB_ROBOTICIST, JOB_GENETICIST)) - RegisterSignal(parent, COMSIG_ADD_MOOD_EVENT_RND, .proc/add_event) //Mood events that are only for RnD members - -/datum/component/mood/proc/print_mood(mob/user) - var/msg = "[span_info("My current mental status:")]\n" - msg += span_notice("My current sanity: ") //Long term - switch(sanity) - if(SANITY_GREAT to INFINITY) - msg += "[span_boldnicegreen("My mind feels like a temple!")]\n" - if(SANITY_NEUTRAL to SANITY_GREAT) - msg += "[span_nicegreen("I have been feeling great lately!")]\n" - if(SANITY_DISTURBED to SANITY_NEUTRAL) - msg += "[span_nicegreen("I have felt quite decent lately.")]\n" - if(SANITY_UNSTABLE to SANITY_DISTURBED) - msg += "[span_warning("I'm feeling a little bit unhinged...")]\n" - if(SANITY_CRAZY to SANITY_UNSTABLE) - msg += "[span_warning("I'm freaking out!!")]\n" - if(SANITY_INSANE to SANITY_CRAZY) - msg += "[span_boldwarning("AHAHAHAHAHAHAHAHAHAH!!")]\n" - - msg += span_notice("My current mood: ") //Short term - switch(mood_level) - if(1) - msg += "[span_boldwarning("I wish I was dead!")]\n" - if(2) - msg += "[span_boldwarning("I feel terrible...")]\n" - if(3) - msg += "[span_boldwarning("I feel very upset.")]\n" - if(4) - msg += "[span_warning("I'm a bit sad.")]\n" - if(5) - msg += "[span_grey("I'm alright.")]\n" - if(6) - msg += "[span_nicegreen("I feel pretty okay.")]\n" - if(7) - msg += "[span_boldnicegreen("I feel pretty good.")]\n" - if(8) - msg += "[span_boldnicegreen("I feel amazing!")]\n" - if(9) - msg += "[span_boldnicegreen("I love life!")]\n" - - msg += "[span_notice("Moodlets:")]\n"//All moodlets - if(mood_events.len) - for(var/i in mood_events) - var/datum/mood_event/event = mood_events[i] - switch(event.mood_change) - if(-INFINITY to MOOD_LEVEL_SAD2) - msg += span_boldwarning(event.description + "\n") - if(MOOD_LEVEL_SAD2 to MOOD_LEVEL_SAD1) - msg += span_warning(event.description + "\n") - if(MOOD_LEVEL_SAD1 to MOOD_LEVEL_HAPPY1) - msg += span_grey(event.description + "\n") - if(MOOD_LEVEL_HAPPY1 to MOOD_LEVEL_HAPPY2) - msg += span_nicegreen(event.description + "\n") - if(MOOD_LEVEL_HAPPY2 to INFINITY) - msg += span_boldnicegreen(event.description + "\n") - else - msg += "[span_grey("I don't have much of a reaction to anything right now.")]\n" - to_chat(user, examine_block(msg)) - -///Called after moodevent/s have been added/removed. -/datum/component/mood/proc/update_mood() - mood = 0 - shown_mood = 0 - for(var/i in mood_events) - var/datum/mood_event/event = mood_events[i] - mood += event.mood_change - if(!event.hidden) - shown_mood += event.mood_change - mood *= mood_modifier - shown_mood *= mood_modifier - - switch(mood) - if(-INFINITY to MOOD_LEVEL_SAD4) - mood_level = 1 - if(MOOD_LEVEL_SAD4 to MOOD_LEVEL_SAD3) - mood_level = 2 - if(MOOD_LEVEL_SAD3 to MOOD_LEVEL_SAD2) - mood_level = 3 - if(MOOD_LEVEL_SAD2 to MOOD_LEVEL_SAD1) - mood_level = 4 - if(MOOD_LEVEL_SAD1 to MOOD_LEVEL_HAPPY1) - mood_level = 5 - if(MOOD_LEVEL_HAPPY1 to MOOD_LEVEL_HAPPY2) - mood_level = 6 - if(MOOD_LEVEL_HAPPY2 to MOOD_LEVEL_HAPPY3) - mood_level = 7 - if(MOOD_LEVEL_HAPPY3 to MOOD_LEVEL_HAPPY4) - mood_level = 8 - if(MOOD_LEVEL_HAPPY4 to INFINITY) - mood_level = 9 - update_mood_icon() - -/datum/component/mood/proc/update_mood_icon() - var/mob/living/owner = parent - if(!(owner.client || owner.hud_used)) - return - screen_obj.cut_overlays() - screen_obj.color = initial(screen_obj.color) - //lets see if we have any special icons to show instead of the normal mood levels - var/list/conflicting_moodies = list() - var/highest_absolute_mood = 0 - for(var/i in mood_events) //adds overlays and sees which special icons need to vie for which one gets the icon_state - var/datum/mood_event/event = mood_events[i] - if(!event.special_screen_obj) - continue - if(!event.special_screen_replace) - screen_obj.add_overlay(event.special_screen_obj) - else - conflicting_moodies += event - var/absmood = abs(event.mood_change) - if(absmood > highest_absolute_mood) - highest_absolute_mood = absmood - - switch(sanity_level) - if(1) - screen_obj.color = "#2eeb9a" - if(2) - screen_obj.color = "#86d656" - if(3) - screen_obj.color = "#4b96c4" - if(4) - screen_obj.color = "#dfa65b" - if(5) - screen_obj.color = "#f38943" - if(6) - screen_obj.color = "#f15d36" - - if(!conflicting_moodies.len) //no special icons- go to the normal icon states - screen_obj.icon_state = "mood[mood_level]" - return - - for(var/i in conflicting_moodies) - var/datum/mood_event/event = i - if(abs(event.mood_change) == highest_absolute_mood) - screen_obj.icon_state = "[event.special_screen_obj]" - break - -///Called on SSmood process -/datum/component/mood/process(delta_time) - var/mob/living/moody_fellow = parent - if(moody_fellow.stat == DEAD) - return //updating sanity during death leads to people getting revived and being completely insane for simply being dead for a long time - switch(mood_level) - if(1) - setSanity(sanity-0.3*delta_time, SANITY_INSANE) - if(2) - setSanity(sanity-0.15*delta_time, SANITY_INSANE) - if(3) - setSanity(sanity-0.1*delta_time, SANITY_CRAZY) - if(4) - setSanity(sanity-0.05*delta_time, SANITY_UNSTABLE) - if(5) - setSanity(sanity, SANITY_UNSTABLE) //This makes sure that mood gets increased should you be below the minimum. - if(6) - setSanity(sanity+0.2*delta_time, SANITY_UNSTABLE) - if(7) - setSanity(sanity+0.3*delta_time, SANITY_UNSTABLE) - if(8) - setSanity(sanity+0.4*delta_time, SANITY_NEUTRAL, SANITY_MAXIMUM) - if(9) - setSanity(sanity+0.6*delta_time, SANITY_NEUTRAL, SANITY_MAXIMUM) - HandleNutrition() - - // 0.416% is 15 successes / 3600 seconds. Calculated with 2 minute - // mood runtime, so 50% average uptime across the hour. - if(HAS_TRAIT(parent, TRAIT_DEPRESSION) && DT_PROB(0.416, delta_time)) - add_event(null, "depression_mild", /datum/mood_event/depression_mild) - - if(HAS_TRAIT(parent, TRAIT_JOLLY) && DT_PROB(0.416, delta_time)) - 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 - // If the new amount would move towards the acceptable range faster then use it instead - if(amount < minimum) - 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 - var/mob/living/master = parent - SEND_SIGNAL(master, COMSIG_CARBON_SANITY_UPDATE, amount) - switch(sanity) - if(SANITY_INSANE to SANITY_CRAZY) - setInsanityEffect(MAJOR_INSANITY_PEN) - master.add_movespeed_modifier(/datum/movespeed_modifier/sanity/insane) - master.add_actionspeed_modifier(/datum/actionspeed_modifier/low_sanity) - sanity_level = SANITY_LEVEL_INSANE - if(SANITY_CRAZY to SANITY_UNSTABLE) - setInsanityEffect(MINOR_INSANITY_PEN) - master.add_movespeed_modifier(/datum/movespeed_modifier/sanity/crazy) - master.add_actionspeed_modifier(/datum/actionspeed_modifier/low_sanity) - sanity_level = SANITY_LEVEL_CRAZY - if(SANITY_UNSTABLE to SANITY_DISTURBED) - setInsanityEffect(0) - master.add_movespeed_modifier(/datum/movespeed_modifier/sanity/disturbed) - master.add_actionspeed_modifier(/datum/actionspeed_modifier/low_sanity) - sanity_level = SANITY_LEVEL_UNSTABLE - if(SANITY_DISTURBED to SANITY_NEUTRAL) - setInsanityEffect(0) - master.remove_movespeed_modifier(MOVESPEED_ID_SANITY) - master.remove_actionspeed_modifier(ACTIONSPEED_ID_SANITY) - sanity_level = SANITY_LEVEL_DISTURBED - 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) - master.add_actionspeed_modifier(/datum/actionspeed_modifier/high_sanity) - sanity_level = SANITY_LEVEL_NEUTRAL - if(SANITY_GREAT+1 to INFINITY) - setInsanityEffect(0) - master.remove_movespeed_modifier(MOVESPEED_ID_SANITY) - master.add_actionspeed_modifier(/datum/actionspeed_modifier/high_sanity) - sanity_level = SANITY_LEVEL_GREAT - update_mood_icon() - -/datum/component/mood/proc/setInsanityEffect(newval) - if(newval == insanity_effect) - return - var/mob/living/master = parent - master.crit_threshold = (master.crit_threshold - insanity_effect) + newval - insanity_effect = newval - -/datum/component/mood/proc/add_event(datum/source, category, type, ...) //Category will override any events in the same category, should be unique unless the event is based on the same thing like hunger. - SIGNAL_HANDLER - - var/datum/mood_event/the_event - if(!ispath(type, /datum/mood_event)) - return - if(!istext(category)) - category = REF(category) - if(mood_events[category]) - the_event = mood_events[category] - if(the_event.type != type) - clear_event(null, category) - else - if(the_event.timeout) - addtimer(CALLBACK(src, .proc/clear_event, null, category), the_event.timeout, TIMER_UNIQUE|TIMER_OVERRIDE) - return //Don't have to update the event. - var/list/params = args.Copy(4) - params.Insert(1, parent) - the_event = new type(arglist(params)) - - mood_events[category] = the_event - the_event.category = category - update_mood() - - if(the_event.timeout) - addtimer(CALLBACK(src, .proc/clear_event, null, category), the_event.timeout, TIMER_UNIQUE|TIMER_OVERRIDE) - -/** - * Returns true if you already have a mood from a provided category. - * You may think to yourself, why am I trying to get a boolean from a component? Well, this system probably should not be a component. - * - * Arguments - * * category - Mood category to validate against. - */ -/datum/component/mood/proc/has_mood_of_category(category) - for(var/i in mood_events) - var/datum/mood_event/moodlet = mood_events[i] - if (moodlet.category == category) - return TRUE - - return FALSE - -/datum/component/mood/proc/clear_event(datum/source, category) - SIGNAL_HANDLER - - if(!istext(category)) - category = REF(category) - var/datum/mood_event/event = mood_events[category] - if(!event) - return - - mood_events -= category - qdel(event) - update_mood() - -/datum/component/mood/proc/remove_temp_moods() //Removes all temp moods - for(var/i in mood_events) - var/datum/mood_event/moodlet = mood_events[i] - if(!moodlet || !moodlet.timeout) - continue - mood_events -= moodlet.category - qdel(moodlet) - update_mood() - -/datum/component/mood/proc/modify_hud(datum/source) - SIGNAL_HANDLER - - var/mob/living/owner = parent - var/datum/hud/hud = owner.hud_used - screen_obj = new - screen_obj.color = "#4b96c4" - hud.infodisplay += screen_obj - RegisterSignal(hud, COMSIG_PARENT_QDELETING, .proc/unmodify_hud) - RegisterSignal(screen_obj, COMSIG_CLICK, .proc/hud_click) - -/datum/component/mood/proc/unmodify_hud(datum/source) - SIGNAL_HANDLER - - if(!screen_obj) - return - var/mob/living/owner = parent - var/datum/hud/hud = owner.hud_used - if(hud?.infodisplay) - hud.infodisplay -= screen_obj - QDEL_NULL(screen_obj) - -/datum/component/mood/proc/hud_click(datum/source, location, control, params, mob/user) - SIGNAL_HANDLER - - if(user != parent) - return - print_mood(user) - -/datum/component/mood/proc/HandleNutrition() - var/mob/living/L = parent - if(HAS_TRAIT(L, TRAIT_NOHUNGER)) - return FALSE //no mood events for nutrition - switch(L.nutrition) - if(NUTRITION_LEVEL_FULL to INFINITY) - if (!HAS_TRAIT(L, TRAIT_VORACIOUS)) - add_event(null, "nutrition", /datum/mood_event/fat) - else - add_event(null, "nutrition", /datum/mood_event/wellfed) // round and full - if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL) - add_event(null, "nutrition", /datum/mood_event/wellfed) - if( NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED) - add_event(null, "nutrition", /datum/mood_event/fed) - if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED) - clear_event(null, "nutrition") - if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY) - add_event(null, "nutrition", /datum/mood_event/hungry) - if(0 to NUTRITION_LEVEL_STARVING) - add_event(null, "nutrition", /datum/mood_event/starving) - -/datum/component/mood/proc/check_area_mood(datum/source, area/A) - SIGNAL_HANDLER - - update_beauty(A) - if(A.mood_bonus && (!A.mood_trait || HAS_TRAIT(source, A.mood_trait))) - add_event(null, "area", /datum/mood_event/area, A.mood_bonus, A.mood_message) - else - clear_event(null, "area") - -/datum/component/mood/proc/update_beauty(area/A) - if(A.outdoors) //if we're outside, we don't care. - clear_event(null, "area_beauty") - return FALSE - if(HAS_TRAIT(parent, TRAIT_SNOB)) - switch(A.beauty) - if(-INFINITY to BEAUTY_LEVEL_HORRID) - add_event(null, "area_beauty", /datum/mood_event/horridroom) - return - if(BEAUTY_LEVEL_HORRID to BEAUTY_LEVEL_BAD) - add_event(null, "area_beauty", /datum/mood_event/badroom) - return - switch(A.beauty) - if(BEAUTY_LEVEL_BAD to BEAUTY_LEVEL_DECENT) - clear_event(null, "area_beauty") - if(BEAUTY_LEVEL_DECENT to BEAUTY_LEVEL_GOOD) - add_event(null, "area_beauty", /datum/mood_event/decentroom) - if(BEAUTY_LEVEL_GOOD to BEAUTY_LEVEL_GREAT) - add_event(null, "area_beauty", /datum/mood_event/goodroom) - if(BEAUTY_LEVEL_GREAT to INFINITY) - add_event(null, "area_beauty", /datum/mood_event/greatroom) - -///Called when parent is ahealed. -/datum/component/mood/proc/on_revive(datum/source, full_heal) - SIGNAL_HANDLER - - if(!full_heal) - return - remove_temp_moods() - setSanity(initial(sanity), override = TRUE) - - -///Causes direct drain of someone's sanity, call it with a numerical value corresponding how badly you want to hurt their sanity -/datum/component/mood/proc/direct_sanity_drain(datum/source, amount) - SIGNAL_HANDLER - setSanity(sanity + amount, override = TRUE) - -///Called when parent slips. -/datum/component/mood/proc/on_slip(datum/source) - SIGNAL_HANDLER - - 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 diff --git a/code/datums/components/omen.dm b/code/datums/components/omen.dm index ce2740d81b0..8cf7b8ba3c3 100644 --- a/code/datums/components/omen.dm +++ b/code/datums/components/omen.dm @@ -39,10 +39,10 @@ /datum/component/omen/RegisterWithParent() RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/check_accident) RegisterSignal(parent, COMSIG_LIVING_STATUS_KNOCKDOWN, .proc/check_slip) - RegisterSignal(parent, COMSIG_ADD_MOOD_EVENT, .proc/check_bless) + RegisterSignal(parent, COMSIG_CARBON_MOOD_UPDATE, .proc/check_bless) /datum/component/omen/UnregisterFromParent() - UnregisterSignal(parent, list(COMSIG_LIVING_STATUS_KNOCKDOWN, COMSIG_MOVABLE_MOVED, COMSIG_ADD_MOOD_EVENT)) + UnregisterSignal(parent, list(COMSIG_LIVING_STATUS_KNOCKDOWN, COMSIG_MOVABLE_MOVED, COMSIG_CARBON_MOOD_UPDATE)) /** * check_accident() is called each step we take @@ -112,7 +112,7 @@ if(permanent) return - if(category != "blessing") + if (!("blessing" in our_guy.mob_mood.mood_events)) return qdel(src) diff --git a/code/datums/elements/art.dm b/code/datums/elements/art.dm index 4b8ba3d0751..55512c5a46a 100644 --- a/code/datums/elements/art.dm +++ b/code/datums/elements/art.dm @@ -14,22 +14,22 @@ UnregisterSignal(target, COMSIG_PARENT_EXAMINE) return ..() -/datum/element/art/proc/apply_moodlet(atom/source, mob/user, impress) +/datum/element/art/proc/apply_moodlet(atom/source, mob/living/user, impress) SIGNAL_HANDLER var/msg switch(impress) if(GREAT_ART to INFINITY) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artgreat", /datum/mood_event/artgreat) + user.add_mood_event("artgreat", /datum/mood_event/artgreat) msg = "What \a [pick("masterpiece", "chef-d'oeuvre")]. So [pick("trascended", "awe-inspiring", "bewitching", "impeccable")]!" if (GOOD_ART to GREAT_ART) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artgood", /datum/mood_event/artgood) + user.add_mood_event("artgood", /datum/mood_event/artgood) msg = "[source.p_theyre(TRUE)] a [pick("respectable", "commendable", "laudable")] art piece, easy on the keen eye." if (BAD_ART to GOOD_ART) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artok", /datum/mood_event/artok) + user.add_mood_event("artok", /datum/mood_event/artok) msg = "[source.p_theyre(TRUE)] fair to middling, enough to be called an \"art object\"." if (0 to BAD_ART) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artbad", /datum/mood_event/artbad) + user.add_mood_event("artbad", /datum/mood_event/artbad) msg = "Wow, [source.p_they()] sucks." user.visible_message(span_notice("[user] stops and looks intently at [source]."), \ @@ -54,13 +54,13 @@ /datum/element/art/rev -/datum/element/art/rev/apply_moodlet(atom/source, mob/user, impress) +/datum/element/art/rev/apply_moodlet(atom/source, mob/living/user, impress) var/msg if(user.mind?.has_antag_datum(/datum/antagonist/rev)) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artgreat", /datum/mood_event/artgreat) + user.add_mood_event("artgreat", /datum/mood_event/artgreat) msg = "What \a [pick("masterpiece", "chef-d'oeuvre")] [source.p_theyre()]. So [pick("subversive", "revolutionary", "unitizing", "egalitarian")]!" else - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artbad", /datum/mood_event/artbad) + user.add_mood_event("artbad", /datum/mood_event/artbad) msg = "Wow, [source.p_they()] sucks." user.visible_message(span_notice("[user] stops to inspect [source]."), \ @@ -68,7 +68,7 @@ /datum/element/art/commoner -/datum/element/art/commoner/apply_moodlet(atom/source, mob/user, impress) +/datum/element/art/commoner/apply_moodlet(atom/source, mob/living/user, impress) var/msg var/list/haters = list() for(var/hater_department_type as anything in list(/datum/job_department/security, /datum/job_department/command)) @@ -79,10 +79,10 @@ haters += fucking_quartermaster.title if(!(user.mind.assigned_role.title in haters)) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artgreat", /datum/mood_event/artgreat) + user.add_mood_event("artgreat", /datum/mood_event/artgreat) msg = "What \a [pick("masterpiece", "chef-d'oeuvre")] [source.p_theyre()]. So [pick("relatable", "down to earth", "true", "real")]!" else - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artbad", /datum/mood_event/artbad) + user.add_mood_event("artbad", /datum/mood_event/artbad) msg = "Wow, [source.p_they()] sucks." user.visible_message(span_notice("[user] stops to inspect [source]."), \ diff --git a/code/datums/elements/eyestab.dm b/code/datums/elements/eyestab.dm index 8fb57149734..e752799ffe5 100644 --- a/code/datums/elements/eyestab.dm +++ b/code/datums/elements/eyestab.dm @@ -76,7 +76,7 @@ else target.take_bodypart_damage(damage) - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, "eye_stab", /datum/mood_event/eye_stab) + target.add_mood_event("eye_stab", /datum/mood_event/eye_stab) log_combat(user, target, "attacked", "[item.name]", "(Combat mode: [user.combat_mode ? "On" : "Off"])") diff --git a/code/datums/elements/pet_bonus.dm b/code/datums/elements/pet_bonus.dm index 7936882b3cd..290344a88bc 100644 --- a/code/datums/elements/pet_bonus.dm +++ b/code/datums/elements/pet_bonus.dm @@ -35,4 +35,4 @@ new /obj/effect/temp_visual/heart(pet.loc) if(emote_message && prob(33)) pet.manual_emote(emote_message) - SEND_SIGNAL(petter, COMSIG_ADD_MOOD_EVENT, "petting_bonus", moodlet, pet) + petter.add_mood_event("petting_bonus", moodlet, pet) diff --git a/code/datums/memory/memory.dm b/code/datums/memory/memory.dm index e1fe64e8f9f..15c42558922 100644 --- a/code/datums/memory/memory.dm +++ b/code/datums/memory/memory.dm @@ -107,15 +107,15 @@ if(victim_mood != MOODLESS_MEMORY) //How the victim felt when it all happend. switch(victim_mood) - if(MOOD_LEVEL_SAD4 to MOOD_LEVEL_SAD2) + if(MOOD_SAD4 to MOOD_SAD2) story_moods = strings(MEMORY_FILE, "sad") if("[action]_sad" in GLOB.string_cache[MEMORY_FILE]) story_moods += strings(MEMORY_FILE, "[action]_sad") - if(MOOD_LEVEL_SAD2 to MOOD_LEVEL_HAPPY2) + if(MOOD_SAD2 to MOOD_HAPPY2) story_moods = strings(MEMORY_FILE, "neutral") if("[action]_neutral" in GLOB.string_cache[MEMORY_FILE]) story_moods += strings(MEMORY_FILE, "[action]_neutral") - if(MOOD_LEVEL_HAPPY2 to MOOD_LEVEL_HAPPY4) + if(MOOD_HAPPY2 to MOOD_HAPPY4) story_moods = strings(MEMORY_FILE, "happy") if("[action]_happy" in GLOB.string_cache[MEMORY_FILE]) story_moods += strings(MEMORY_FILE, "[action]_happy") diff --git a/code/datums/mood.dm b/code/datums/mood.dm new file mode 100644 index 00000000000..45d9f1157c4 --- /dev/null +++ b/code/datums/mood.dm @@ -0,0 +1,486 @@ +#define MINOR_INSANITY_PEN 5 +#define MAJOR_INSANITY_PEN 10 +#define MOOD_CATEGORY_NUTRITION "nutrition" +#define MOOD_CATEGORY_AREA_BEAUTY "area_beauty" + +/** + * Mood datum + * + * Contains the logic for controlling a living mob's mood and sanity. + */ +/datum/mood + /// The parent (living) mob + var/mob/living/mob_parent + + /// The total combined value of all moodlets for the mob + var/mood + /// Current sanity of the mob (ranges from 0 - 150) + var/sanity = SANITY_NEUTRAL + /// the total combined value of all visible moodlets for the mob + var/shown_mood + /// Moodlet value modifier + var/mood_modifier = 1 + /// Used to track what stage of moodies they're on (1-9) + var/mood_level = MOOD_LEVEL_NEUTRAL + /// To track what stage of sanity they're on (1-6) + var/sanity_level = SANITY_LEVEL_NEUTRAL + /// Is the owner being punished for low mood? if so, how much? + var/insanity_effect = 0 + /// The screen object for the current mood level + var/atom/movable/screen/mood/mood_screen_object + + /// List of mood events currently active on this datum + var/list/mood_events = list() + + /// Tracks the last mob stat, updates on change + /// Used to stop processing SSmood + var/last_stat = CONSCIOUS + +/datum/mood/New(mob/living/mob_to_make_moody) + if (!istype(mob_to_make_moody)) + stack_trace("Tried to apply mood to a non-living atom!") + qdel(src) + return + + START_PROCESSING(SSmood, src) + + mob_parent = mob_to_make_moody + + RegisterSignal(mob_to_make_moody, COMSIG_MOB_HUD_CREATED, .proc/modify_hud) + RegisterSignal(mob_to_make_moody, COMSIG_ENTER_AREA, .proc/check_area_mood) + RegisterSignal(mob_to_make_moody, COMSIG_LIVING_REVIVE, .proc/on_revive) + RegisterSignal(mob_to_make_moody, COMSIG_MOB_STATCHANGE, .proc/handle_mob_death) + RegisterSignal(mob_to_make_moody, COMSIG_PARENT_QDELETING, .proc/clear_parent_ref) + + mob_to_make_moody.become_area_sensitive(MOOD_DATUM_TRAIT) + if(mob_to_make_moody.hud_used) + modify_hud() + var/datum/hud/hud = mob_to_make_moody.hud_used + hud.show_hud(hud.hud_version) + +/datum/mood/proc/clear_parent_ref() + SIGNAL_HANDLER + + unmodify_hud() + mob_parent.lose_area_sensitivity(MOOD_DATUM_TRAIT) + UnregisterSignal(mob_parent, list(COMSIG_MOB_HUD_CREATED, COMSIG_ENTER_AREA, COMSIG_LIVING_REVIVE, COMSIG_MOB_STATCHANGE, COMSIG_PARENT_QDELETING)) + + mob_parent = null + +/datum/mood/Destroy(force, ...) + STOP_PROCESSING(SSmood, src) + QDEL_LIST_ASSOC_VAL(mood_events) + return ..() + +/datum/mood/process(delta_time) + switch(mood_level) + if(MOOD_LEVEL_SAD4) + set_sanity(sanity - 0.3 * delta_time, SANITY_INSANE) + if(MOOD_LEVEL_SAD3) + set_sanity(sanity - 0.15 * delta_time, SANITY_INSANE) + if(MOOD_LEVEL_SAD2) + set_sanity(sanity - 0.1 * delta_time, SANITY_CRAZY) + if(MOOD_LEVEL_SAD1) + set_sanity(sanity - 0.05 * delta_time, SANITY_UNSTABLE) + if(MOOD_LEVEL_NEUTRAL) + set_sanity(sanity, SANITY_UNSTABLE) //This makes sure that mood gets increased should you be below the minimum. + if(MOOD_LEVEL_HAPPY1) + set_sanity(sanity + 0.2 * delta_time, SANITY_UNSTABLE) + if(MOOD_LEVEL_HAPPY2) + set_sanity(sanity + 0.3 * delta_time, SANITY_UNSTABLE) + if(MOOD_LEVEL_HAPPY3) + set_sanity(sanity + 0.4 * delta_time, SANITY_NEUTRAL, SANITY_MAXIMUM) + if(MOOD_LEVEL_HAPPY4) + set_sanity(sanity + 0.6 * delta_time, SANITY_NEUTRAL, SANITY_MAXIMUM) + handle_nutrition() + + // 0.416% is 15 successes / 3600 seconds. Calculated with 2 minute + // mood runtime, so 50% average uptime across the hour. + if(HAS_TRAIT(mob_parent, TRAIT_DEPRESSION) && DT_PROB(0.416, delta_time)) + add_mood_event("depression_mild", /datum/mood_event/depression_mild) + + if(HAS_TRAIT(mob_parent, TRAIT_JOLLY) && DT_PROB(0.416, delta_time)) + add_mood_event("jolly", /datum/mood_event/jolly) + +/datum/mood/proc/handle_mob_death(datum/source) + SIGNAL_HANDLER + + if (last_stat == DEAD && mob_parent.stat != DEAD) + START_PROCESSING(SSmood, src) + else if (last_stat != DEAD && mob_parent.stat == DEAD) + STOP_PROCESSING(SSmood, src) + last_stat = mob_parent.stat + +/// Handles mood given by nutrition +/datum/mood/proc/handle_nutrition() + if (HAS_TRAIT(mob_parent, TRAIT_NOHUNGER)) + return FALSE // no moods for nutrition + switch(mob_parent.nutrition) + if(NUTRITION_LEVEL_FULL to INFINITY) + if (!HAS_TRAIT(mob_parent, TRAIT_VORACIOUS)) + add_mood_event(MOOD_CATEGORY_NUTRITION, /datum/mood_event/fat) + else + add_mood_event(MOOD_CATEGORY_NUTRITION, /datum/mood_event/wellfed) // round and full + if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL) + add_mood_event(MOOD_CATEGORY_NUTRITION, /datum/mood_event/wellfed) + if( NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED) + add_mood_event(MOOD_CATEGORY_NUTRITION, /datum/mood_event/fed) + if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED) + clear_mood_event(MOOD_CATEGORY_NUTRITION) + if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY) + add_mood_event(MOOD_CATEGORY_NUTRITION, /datum/mood_event/hungry) + if(0 to NUTRITION_LEVEL_STARVING) + add_mood_event(MOOD_CATEGORY_NUTRITION, /datum/mood_event/starving) + +/** + * Adds a mood event to the mob + * + * Arguments: + * * category - (text) category of the mood event - see /datum/mood_event for category explanation + * * type - (path) any /datum/mood_event + */ +/datum/mood/proc/add_mood_event(category, type, ...) + if (!ispath(type, /datum/mood_event)) + CRASH("A non path ([type]), was used to add a mood event. This shouldn't be happening.") + if (!istext(category)) + category = REF(category) + + var/datum/mood_event/the_event + if (mood_events[category]) + the_event = mood_events[category] + if (the_event.type != type) + clear_mood_event(category) + else + if (the_event.timeout) + addtimer(CALLBACK(src, .proc/clear_mood_event, category), the_event.timeout, (TIMER_UNIQUE|TIMER_OVERRIDE)) + return // Don't need to update the event. + var/list/params = args.Copy(3) + + params.Insert(1, mob_parent) + the_event = new type(arglist(params)) + if (QDELETED(the_event)) // the mood event has been deleted for whatever reason (requires a job, etc) + return + + mood_events[category] = the_event + the_event.category = category + update_mood() + + if (the_event.timeout) + addtimer(CALLBACK(src, .proc/clear_mood_event, category), the_event.timeout, (TIMER_UNIQUE|TIMER_OVERRIDE)) + +/** + * Removes a mood event from the mob + * + * Arguments: + * * category - (Text) Removes the mood event with the given category + */ +/datum/mood/proc/clear_mood_event(category) + if (!istext(category)) + category = REF(category) + + var/datum/mood_event/event = mood_events[category] + if (!event) + return + + mood_events -= category + qdel(event) + update_mood() + +/// Updates the mobs mood. +/// Called after mood events have been added/removed. +/datum/mood/proc/update_mood() + mood = 0 + shown_mood = 0 + + SEND_SIGNAL(mob_parent, COMSIG_CARBON_MOOD_UPDATE) + + for(var/category in mood_events) + var/datum/mood_event/the_event = mood_events[category] + mood += the_event.mood_change + if (!the_event.hidden) + shown_mood += the_event.mood_change + mood *= mood_modifier + shown_mood *= mood_modifier + + switch(mood) + if (-INFINITY to MOOD_SAD4) + mood_level = MOOD_LEVEL_SAD4 + if (MOOD_SAD4 to MOOD_SAD3) + mood_level = MOOD_LEVEL_SAD3 + if (MOOD_SAD3 to MOOD_SAD2) + mood_level = MOOD_LEVEL_SAD2 + if (MOOD_SAD2 to MOOD_SAD1) + mood_level = MOOD_LEVEL_SAD1 + if (MOOD_SAD1 to MOOD_HAPPY1) + mood_level = MOOD_LEVEL_NEUTRAL + if (MOOD_HAPPY1 to MOOD_HAPPY2) + mood_level = MOOD_LEVEL_HAPPY1 + if (MOOD_HAPPY2 to MOOD_HAPPY3) + mood_level = MOOD_LEVEL_HAPPY2 + if (MOOD_HAPPY3 to MOOD_HAPPY4) + mood_level = MOOD_LEVEL_HAPPY3 + if (MOOD_HAPPY4 to INFINITY) + mood_level = MOOD_LEVEL_HAPPY4 + + update_mood_icon() + +/// Updates the mob's mood icon +/datum/mood/proc/update_mood_icon() + if (!(mob_parent.client || mob_parent.hud_used)) + return + + mood_screen_object.cut_overlays() + mood_screen_object.color = initial(mood_screen_object.color) + + // lets see if we have an special icons to show instead of the normal mood levels + var/list/conflicting_moodies = list() + var/highest_absolute_mood = 0 + for (var/category in mood_events) + var/datum/mood_event/the_event = mood_events[category] + if (!the_event.special_screen_obj) + continue + if (!the_event.special_screen_replace) + mood_screen_object.add_overlay(the_event.special_screen_obj) + else + conflicting_moodies += the_event + var/absmood = abs(the_event.mood_change) + highest_absolute_mood = absmood > highest_absolute_mood ? absmood : highest_absolute_mood + + switch(sanity_level) + if (SANITY_LEVEL_GREAT) + mood_screen_object.color = "#2eeb9a" + if (SANITY_LEVEL_NEUTRAL) + mood_screen_object.color = "#86d656" + if (SANITY_LEVEL_DISTURBED) + mood_screen_object.color = "#4b96c4" + if (SANITY_LEVEL_UNSTABLE) + mood_screen_object.color = "#dfa65b" + if (SANITY_LEVEL_CRAZY) + mood_screen_object.color = "#f38943" + if (SANITY_LEVEL_INSANE) + mood_screen_object.color = "#f15d36" + + if (!conflicting_moodies.len) // theres no special icons, use the normal icon states + mood_screen_object.icon_state = "mood[mood_level]" + return + + for (var/datum/mood_event/conflicting_event as anything in conflicting_moodies) + if (abs(conflicting_event.mood_change) == highest_absolute_mood) + mood_screen_object.icon_state = "[conflicting_event.special_screen_obj]" + break + +/// Sets up the mood HUD object +/datum/mood/proc/modify_hud(datum/source) + SIGNAL_HANDLER + + var/datum/hud/hud = mob_parent.hud_used + mood_screen_object = new + mood_screen_object.color = "#4b96c4" + hud.infodisplay += mood_screen_object + RegisterSignal(hud, COMSIG_PARENT_QDELETING, .proc/unmodify_hud) + RegisterSignal(mood_screen_object, COMSIG_CLICK, .proc/hud_click) + +/// Removes the mood HUD object +/datum/mood/proc/unmodify_hud(datum/source) + SIGNAL_HANDLER + + if(!mood_screen_object) + return + var/datum/hud/hud = mob_parent.hud_used + if(hud?.infodisplay) + hud.infodisplay -= mood_screen_object + QDEL_NULL(mood_screen_object) + +/// Handles clicking on the mood HUD object +/datum/mood/proc/hud_click(datum/source, location, control, params, mob/user) + SIGNAL_HANDLER + + if(user != mob_parent) + return + print_mood(user) + +/// Prints the users mood, sanity, and moodies to chat +/datum/mood/proc/print_mood(mob/user) + var/msg = "[span_info("My current mental status:")]\n" + msg += span_notice("My current sanity: ") //Long term + switch(sanity) + if(SANITY_GREAT to INFINITY) + msg += "[span_boldnicegreen("My mind feels like a temple!")]\n" + if(SANITY_NEUTRAL to SANITY_GREAT) + msg += "[span_nicegreen("I have been feeling great lately!")]\n" + if(SANITY_DISTURBED to SANITY_NEUTRAL) + msg += "[span_nicegreen("I have felt quite decent lately.")]\n" + if(SANITY_UNSTABLE to SANITY_DISTURBED) + msg += "[span_warning("I'm feeling a little bit unhinged...")]\n" + if(SANITY_CRAZY to SANITY_UNSTABLE) + msg += "[span_warning("I'm freaking out!!")]\n" + if(SANITY_INSANE to SANITY_CRAZY) + msg += "[span_boldwarning("AHAHAHAHAHAHAHAHAHAH!!")]\n" + + msg += span_notice("My current mood: ") //Short term + switch(mood_level) + if(MOOD_LEVEL_SAD4) + msg += "[span_boldwarning("I wish I was dead!")]\n" + if(MOOD_LEVEL_SAD3) + msg += "[span_boldwarning("I feel terrible...")]\n" + if(MOOD_LEVEL_SAD2) + msg += "[span_boldwarning("I feel very upset.")]\n" + if(MOOD_LEVEL_SAD1) + msg += "[span_warning("I'm a bit sad.")]\n" + if(MOOD_LEVEL_NEUTRAL) + msg += "[span_grey("I'm alright.")]\n" + if(MOOD_LEVEL_HAPPY1) + msg += "[span_nicegreen("I feel pretty okay.")]\n" + if(MOOD_LEVEL_HAPPY2) + msg += "[span_boldnicegreen("I feel pretty good.")]\n" + if(MOOD_LEVEL_HAPPY3) + msg += "[span_boldnicegreen("I feel amazing!")]\n" + if(MOOD_LEVEL_HAPPY4) + msg += "[span_boldnicegreen("I love life!")]\n" + + msg += "[span_notice("Moodlets:")]\n"//All moodlets + if(mood_events.len) + for(var/category in mood_events) + var/datum/mood_event/event = mood_events[category] + switch(event.mood_change) + if(-INFINITY to MOOD_SAD2) + msg += span_boldwarning(event.description + "\n") + if(MOOD_SAD2 to MOOD_SAD1) + msg += span_warning(event.description + "\n") + if(MOOD_SAD1 to MOOD_HAPPY1) + msg += span_grey(event.description + "\n") + if(MOOD_HAPPY1 to MOOD_HAPPY2) + msg += span_nicegreen(event.description + "\n") + if(MOOD_HAPPY2 to INFINITY) + msg += span_boldnicegreen(event.description + "\n") + else + msg += "[span_grey("I don't have much of a reaction to anything right now.")]\n" + to_chat(user, examine_block(msg)) + +/// Updates the mob's moodies, if the area provides a mood bonus +/datum/mood/proc/check_area_mood(datum/source, area/new_area) + SIGNAL_HANDLER + + update_beauty(new_area) + if (new_area.mood_bonus && (!new_area.mood_trait || HAS_TRAIT(source, new_area.mood_trait))) + add_mood_event("area", /datum/mood_event/area, new_area.mood_bonus, new_area.mood_message) + else + clear_mood_event("area") + +/// Updates the mob's given beauty moodie, based on the area +/datum/mood/proc/update_beauty(area/area_to_beautify) + if (area_to_beautify.outdoors) // if we're outside, we don't care + clear_mood_event(MOOD_CATEGORY_AREA_BEAUTY) + return + + if(HAS_TRAIT(mob_parent, TRAIT_SNOB)) + switch(area_to_beautify.beauty) + if(-INFINITY to BEAUTY_LEVEL_HORRID) + add_mood_event(MOOD_CATEGORY_AREA_BEAUTY, /datum/mood_event/horridroom) + return + if(BEAUTY_LEVEL_HORRID to BEAUTY_LEVEL_BAD) + add_mood_event(MOOD_CATEGORY_AREA_BEAUTY, /datum/mood_event/badroom) + return + switch(area_to_beautify.beauty) + if(BEAUTY_LEVEL_BAD to BEAUTY_LEVEL_DECENT) + clear_mood_event(MOOD_CATEGORY_AREA_BEAUTY) + if(BEAUTY_LEVEL_DECENT to BEAUTY_LEVEL_GOOD) + add_mood_event(MOOD_CATEGORY_AREA_BEAUTY, /datum/mood_event/decentroom) + if(BEAUTY_LEVEL_GOOD to BEAUTY_LEVEL_GREAT) + add_mood_event(MOOD_CATEGORY_AREA_BEAUTY, /datum/mood_event/goodroom) + if(BEAUTY_LEVEL_GREAT to INFINITY) + add_mood_event(MOOD_CATEGORY_AREA_BEAUTY, /datum/mood_event/greatroom) + +/// Called when parent is ahealed. +/datum/mood/proc/on_revive(datum/source, full_heal) + SIGNAL_HANDLER + + if (!full_heal) + return + remove_temp_moods() + set_sanity(initial(sanity), override = TRUE) + +/// Sets sanity to the specified amount and applies effects. +/datum/mood/proc/set_sanity(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 + // If the new amount would move towards the acceptable range faster then use it instead + if(amount < minimum) + amount += clamp(minimum - amount, 0, 0.7) + if((!override && HAS_TRAIT(mob_parent, TRAIT_UNSTABLE)) || amount > maximum) + amount = min(sanity, amount) + if(amount == sanity) //Prevents stuff from flicking around. + return + sanity = amount + SEND_SIGNAL(mob_parent, COMSIG_CARBON_SANITY_UPDATE, amount) + switch(sanity) + if(SANITY_INSANE to SANITY_CRAZY) + set_insanity_effect(MAJOR_INSANITY_PEN) + mob_parent.add_movespeed_modifier(/datum/movespeed_modifier/sanity/insane) + mob_parent.add_actionspeed_modifier(/datum/actionspeed_modifier/low_sanity) + sanity_level = SANITY_LEVEL_INSANE + if(SANITY_CRAZY to SANITY_UNSTABLE) + set_insanity_effect(MINOR_INSANITY_PEN) + mob_parent.add_movespeed_modifier(/datum/movespeed_modifier/sanity/crazy) + mob_parent.add_actionspeed_modifier(/datum/actionspeed_modifier/low_sanity) + sanity_level = SANITY_LEVEL_CRAZY + if(SANITY_UNSTABLE to SANITY_DISTURBED) + set_insanity_effect(0) + mob_parent.add_movespeed_modifier(/datum/movespeed_modifier/sanity/disturbed) + mob_parent.add_actionspeed_modifier(/datum/actionspeed_modifier/low_sanity) + sanity_level = SANITY_LEVEL_UNSTABLE + if(SANITY_DISTURBED to SANITY_NEUTRAL) + set_insanity_effect(0) + mob_parent.remove_movespeed_modifier(MOVESPEED_ID_SANITY) + mob_parent.remove_actionspeed_modifier(ACTIONSPEED_ID_SANITY) + sanity_level = SANITY_LEVEL_DISTURBED + if(SANITY_NEUTRAL+1 to SANITY_GREAT+1) //shitty hack but +1 to prevent it from responding to super small differences + set_insanity_effect(0) + mob_parent.remove_movespeed_modifier(MOVESPEED_ID_SANITY) + mob_parent.add_actionspeed_modifier(/datum/actionspeed_modifier/high_sanity) + sanity_level = SANITY_LEVEL_NEUTRAL + if(SANITY_GREAT+1 to INFINITY) + set_insanity_effect(0) + mob_parent.remove_movespeed_modifier(MOVESPEED_ID_SANITY) + mob_parent.add_actionspeed_modifier(/datum/actionspeed_modifier/high_sanity) + sanity_level = SANITY_LEVEL_GREAT + update_mood_icon() + +/// Sets the insanity effect on the mob +/datum/mood/proc/set_insanity_effect(newval) + if (newval == insanity_effect) + return + mob_parent.crit_threshold = (mob_parent.crit_threshold - insanity_effect) + newval + insanity_effect = newval + +/// Removes all temporary moods +/datum/mood/proc/remove_temp_moods() + for (var/category in mood_events) + var/datum/mood_event/moodlet = mood_events[category] + if (!moodlet || !moodlet.timeout) + continue + mood_events -= moodlet.category + qdel(moodlet) + update_mood() + +/// Helper to forcefully drain sanity +/datum/mood/proc/direct_sanity_drain(amount) + set_sanity(sanity + amount, override = TRUE) + +/** + * Returns true if you already have a mood from a provided category. + * You may think to yourself, why am I trying to get a boolean from a component? Well, this system probably should not be a component. + * + * Arguments + * * category - Mood category to validate against. + */ +/datum/mood/proc/has_mood_of_category(category) + for(var/i in mood_events) + var/datum/mood_event/moodlet = mood_events[i] + if (moodlet.category == category) + return TRUE + return FALSE + +#undef MINOR_INSANITY_PEN +#undef MAJOR_INSANITY_PEN +#undef MOOD_CATEGORY_NUTRITION +#undef MOOD_CATEGORY_AREA_BEAUTY diff --git a/code/datums/mood_events/_mood_event.dm b/code/datums/mood_events/_mood_event.dm index 9517cb1ed44..a07dbe0d48e 100644 --- a/code/datums/mood_events/_mood_event.dm +++ b/code/datums/mood_events/_mood_event.dm @@ -1,16 +1,33 @@ /datum/mood_event + /// Description of the mood event var/description + /// An integer value that affects overall sanity over time var/mood_change = 0 + /// How long this mood event should last var/timeout = 0 - var/hidden = FALSE//Not shown on examine - var/category //string of what category this mood was added in as - var/special_screen_obj //if it isn't null, it will replace or add onto the mood icon with this (same file). see happiness drug for example - var/special_screen_replace = TRUE //if false, it will be an overlay instead + /// Is this mood event hidden on examine + var/hidden = FALSE + /** + * A category to put multiple mood events. If one of the mood events in the category + * is active while another mood event (from the same category) is triggered it will remove + * the effects of the current mood event and replace it with the new one + */ + var/category + /// Icon state of the unique mood event icon, if applicable + var/special_screen_obj + /// if false, it will be an overlay instead + var/special_screen_replace = TRUE + /// Owner of this mood event var/mob/owner + /// List of required jobs for this mood event + var/list/required_job = list() /datum/mood_event/New(mob/M, ...) owner = M var/list/params = args.Copy(2) + if ((length(required_job) > 0) && M.mind && !(M.mind.assigned_role.type in required_job)) + qdel(src) + return add_effects(arglist(params)) /datum/mood_event/Destroy() diff --git a/code/datums/mood_events/generic_positive_events.dm b/code/datums/mood_events/generic_positive_events.dm index ad3b54efce7..0332b7b079c 100644 --- a/code/datums/mood_events/generic_positive_events.dm +++ b/code/datums/mood_events/generic_positive_events.dm @@ -181,6 +181,7 @@ description = "I just love my robotic friends!" mood_change = 3 timeout = 5 MINUTES + required_job = list(/datum/job/research_director, /datum/job/scientist, /datum/job/roboticist, /datum/job/geneticist) /datum/mood_event/bottle_flip description = "The bottle landing like that was satisfying." diff --git a/code/datums/mutations/body.dm b/code/datums/mutations/body.dm index 59b6700311f..82714300df9 100644 --- a/code/datums/mutations/body.dm +++ b/code/datums/mutations/body.dm @@ -19,7 +19,7 @@ owner.visible_message(span_danger("[owner] starts having a seizure!"), span_userdanger("You have a seizure!")) owner.Unconscious(200 * GET_MUTATION_POWER(src)) owner.set_timed_status_effect(2000 SECONDS * GET_MUTATION_POWER(src), /datum/status_effect/jitter) //yes this number looks crazy but the jitter animations are amplified based on the duration. - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "epilepsy", /datum/mood_event/epilepsy) + owner.add_mood_event("epilepsy", /datum/mood_event/epilepsy) addtimer(CALLBACK(src, .proc/jitter_less), 90) /datum/mutation/human/epilepsy/proc/jitter_less() diff --git a/code/datums/mutations/holy_mutation/honorbound.dm b/code/datums/mutations/holy_mutation/honorbound.dm index 46de73bea5e..eeecbf9d6c1 100644 --- a/code/datums/mutations/holy_mutation/honorbound.dm +++ b/code/datums/mutations/holy_mutation/honorbound.dm @@ -17,7 +17,7 @@ if(..()) return //moodlet - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "honorbound", /datum/mood_event/honorbound) + owner.add_mood_event("honorbound", /datum/mood_event/honorbound) //checking spells cast by honorbound RegisterSignal(owner, COMSIG_MOB_CAST_SPELL, .proc/spell_check) RegisterSignal(owner, COMSIG_MOB_FIRED_GUN, .proc/staff_check) @@ -33,7 +33,7 @@ RegisterSignal(owner, COMSIG_MOB_CLICKON, .proc/attack_honor) /datum/mutation/human/honorbound/on_losing(mob/living/carbon/human/owner) - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "honorbound") + owner.clear_mood_event("honorbound") UnregisterSignal(owner, list( COMSIG_PARENT_ATTACKBY, COMSIG_ATOM_HULK_ATTACK, @@ -192,14 +192,14 @@ if(SCHOOL_NECROMANCY, SCHOOL_FORBIDDEN) to_chat(user, span_userdanger("[GLOB.deity] is enraged by your use of forbidden magic!")) lightningbolt(user) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "honorbound", /datum/mood_event/banished) + owner.add_mood_event("honorbound", /datum/mood_event/banished) user.dna.remove_mutation(/datum/mutation/human/honorbound) user.mind.holy_role = NONE to_chat(user, span_userdanger("You have been excommunicated! You are no longer holy!")) else to_chat(user, span_userdanger("[GLOB.deity] is angered by your use of [school] magic!")) lightningbolt(user) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "honorbound", /datum/mood_event/holy_smite)//permanently lose your moodlet after this + owner.add_mood_event("honorbound", /datum/mood_event/holy_smite)//permanently lose your moodlet after this /datum/action/cooldown/spell/pointed/declare_evil name = "Declare Evil" diff --git a/code/datums/mutations/hulk.dm b/code/datums/mutations/hulk.dm index 64b3c07d3c5..f806327ecb4 100644 --- a/code/datums/mutations/hulk.dm +++ b/code/datums/mutations/hulk.dm @@ -22,7 +22,7 @@ ADD_TRAIT(owner, TRAIT_IGNOREDAMAGESLOWDOWN, GENETIC_MUTATION) ADD_TRAIT(owner, TRAIT_HULK, GENETIC_MUTATION) owner.update_body_parts() - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "hulk", /datum/mood_event/hulk) + owner.add_mood_event("hulk", /datum/mood_event/hulk) RegisterSignal(owner, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, .proc/on_attack_hand) RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech) RegisterSignal(owner, COMSIG_MOB_CLICKON, .proc/check_swing) @@ -79,7 +79,7 @@ REMOVE_TRAIT(owner, TRAIT_IGNOREDAMAGESLOWDOWN, GENETIC_MUTATION) REMOVE_TRAIT(owner, TRAIT_HULK, GENETIC_MUTATION) owner.update_body_parts() - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "hulk") + owner.clear_mood_event("hulk") UnregisterSignal(owner, COMSIG_HUMAN_EARLY_UNARMED_ATTACK) UnregisterSignal(owner, COMSIG_MOB_SAY) UnregisterSignal(owner, COMSIG_MOB_CLICKON) diff --git a/code/datums/quirks/good.dm b/code/datums/quirks/good.dm index ccb66016440..0face68a89c 100644 --- a/code/datums/quirks/good.dm +++ b/code/datums/quirks/good.dm @@ -20,14 +20,12 @@ medical_record_text = "Patient was administered the Apathy Evaluation Scale but did not bother to complete it." /datum/quirk/apathetic/add() - var/datum/component/mood/mood = quirk_holder.GetComponent(/datum/component/mood) - if(mood) - mood.mood_modifier -= 0.2 + if (quirk_holder.mob_mood) + quirk_holder.mob_mood.mood_modifier -= 0.2 /datum/quirk/apathetic/remove() - var/datum/component/mood/mood = quirk_holder.GetComponent(/datum/component/mood) - if(mood) - mood.mood_modifier += 0.2 + if (quirk_holder.mob_mood) + quirk_holder.mob_mood.mood_modifier += 0.2 /datum/quirk/drunkhealing name = "Drunken Resilience" diff --git a/code/datums/quirks/negative.dm b/code/datums/quirks/negative.dm index c8f135a26c4..ceae05c8a6a 100644 --- a/code/datums/quirks/negative.dm +++ b/code/datums/quirks/negative.dm @@ -16,7 +16,7 @@ var/mob/living/carbon/human/human_holder = quirk_holder var/obj/item/storage/backpack/equipped_backpack = human_holder.back if(istype(equipped_backpack)) - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "back_pain", /datum/mood_event/back_pain) + quirk_holder.add_mood_event("back_pain", /datum/mood_event/back_pain) RegisterSignal(human_holder.back, COMSIG_ITEM_POST_UNEQUIP, .proc/on_unequipped_backpack) else RegisterSignal(quirk_holder, COMSIG_MOB_EQUIPPED_ITEM, .proc/on_equipped_item) @@ -27,7 +27,7 @@ var/obj/item/storage/equipped_backpack = backpack?.resolve() if(equipped_backpack) UnregisterSignal(equipped_backpack, COMSIG_ITEM_POST_UNEQUIP) - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "back_pain") + quirk_holder.clear_mood_event("back_pain") /// Signal handler for when the quirk_holder equips an item. If it's a backpack, adds the back_pain mood event. /datum/quirk/badback/proc/on_equipped_item(mob/living/source, obj/item/equipped_item, slot) @@ -36,7 +36,7 @@ if((slot != ITEM_SLOT_BACK) || !istype(equipped_item, /obj/item/storage/backpack)) return - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "back_pain", /datum/mood_event/back_pain) + quirk_holder.add_mood_event("back_pain", /datum/mood_event/back_pain) RegisterSignal(equipped_item, COMSIG_ITEM_POST_UNEQUIP, .proc/on_unequipped_backpack) UnregisterSignal(quirk_holder, COMSIG_MOB_EQUIPPED_ITEM) backpack = WEAKREF(equipped_item) @@ -46,7 +46,7 @@ SIGNAL_HANDLER UnregisterSignal(source, COMSIG_ITEM_POST_UNEQUIP) - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "back_pain") + quirk_holder.clear_mood_event("back_pain") backpack = null RegisterSignal(quirk_holder, COMSIG_MOB_EQUIPPED_ITEM, .proc/on_equipped_item) @@ -214,15 +214,15 @@ var/obj/family_heirloom = heirloom?.resolve() if(family_heirloom && (family_heirloom in quirk_holder.get_all_contents())) - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "family_heirloom_missing") - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "family_heirloom", /datum/mood_event/family_heirloom) + quirk_holder.clear_mood_event("family_heirloom_missing") + quirk_holder.add_mood_event("family_heirloom", /datum/mood_event/family_heirloom) else - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "family_heirloom") - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "family_heirloom_missing", /datum/mood_event/family_heirloom_missing) + quirk_holder.clear_mood_event("family_heirloom") + quirk_holder.add_mood_event("family_heirloom_missing", /datum/mood_event/family_heirloom_missing) /datum/quirk/item_quirk/family_heirloom/remove() - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "family_heirloom_missing") - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "family_heirloom") + quirk_holder.clear_mood_event("family_heirloom_missing") + quirk_holder.clear_mood_event("family_heirloom") /datum/quirk/frail name = "Frail" @@ -257,14 +257,12 @@ hardcore_value = 3 /datum/quirk/hypersensitive/add() - var/datum/component/mood/mood = quirk_holder.GetComponent(/datum/component/mood) - if(mood) - mood.mood_modifier += 0.5 + if (quirk_holder.mob_mood) + quirk_holder.mob_mood.mood_modifier += 0.5 /datum/quirk/hypersensitive/remove() - var/datum/component/mood/mood = quirk_holder.GetComponent(/datum/component/mood) - if(mood) - mood.mood_modifier -= 0.5 + if (quirk_holder.mob_mood) + quirk_holder.mob_mood.mood_modifier -= 0.5 /datum/quirk/light_drinker name = "Light Drinker" @@ -321,7 +319,7 @@ /datum/quirk/nyctophobia/remove() UnregisterSignal(quirk_holder, COMSIG_MOVABLE_MOVED) - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "nyctophobia") + quirk_holder.clear_mood_event("nyctophobia") /// Called when the quirk holder moves. Updates the quirk holder's mood. /datum/quirk/nyctophobia/proc/on_holder_moved(mob/living/source, atom/old_loc, dir, forced) @@ -343,13 +341,13 @@ var/lums = holder_turf.get_lumcount() if(lums > LIGHTING_TILE_IS_DARK) - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "nyctophobia") + quirk_holder.clear_mood_event("nyctophobia") return if(quirk_holder.m_intent == MOVE_INTENT_RUN) to_chat(quirk_holder, span_warning("Easy, easy, take it slow... you're in the dark...")) quirk_holder.toggle_move_intent() - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "nyctophobia", /datum/mood_event/nyctophobia) + quirk_holder.add_mood_event("nyctophobia", /datum/mood_event/nyctophobia) /datum/quirk/nonviolent name = "Pacifist" @@ -519,10 +517,9 @@ if(HAS_TRAIT(quirk_holder, TRAIT_FEARLESS)) return - var/datum/component/mood/mood = quirk_holder.GetComponent(/datum/component/mood) var/moodmod - if(mood) - moodmod = (1+0.02*(50-(max(50, mood.mood_level*(7-mood.sanity_level))))) //low sanity levels are better, they max at 6 + if(quirk_holder.mob_mood) + moodmod = (1+0.02*(50-(max(50, quirk_holder.mob_mood.mood_level*(7-quirk_holder.mob_mood.sanity_level))))) //low sanity levels are better, they max at 6 else moodmod = (1+0.02*(50-(max(50, 0.1*quirk_holder.nutrition)))) var/nearby_people = 0 @@ -598,7 +595,7 @@ quirk_holder.Stun(2 SECONDS) msg += "causing you to freeze up!" - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "anxiety_eyecontact", /datum/mood_event/anxiety_eyecontact) + quirk_holder.add_mood_event("anxiety_eyecontact", /datum/mood_event/anxiety_eyecontact) addtimer(CALLBACK(GLOBAL_PROC, .proc/to_chat, quirk_holder, span_userdanger("[msg]")), 3) // so the examine signal has time to fire and this will print after return COMSIG_BLOCK_EYECONTACT @@ -736,9 +733,9 @@ if (istype(mask_item, /obj/item/clothing/mask/cigarette)) var/obj/item/storage/fancy/cigarettes/cigarettes = drug_container_type if(istype(mask_item, initial(cigarettes.spawn_type))) - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "wrong_cigs") + quirk_holder.clear_mood_event("wrong_cigs") return - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "wrong_cigs", /datum/mood_event/wrong_brand) + quirk_holder.add_mood_event("wrong_cigs", /datum/mood_event/wrong_brand) /datum/quirk/unstable name = "Unstable" @@ -839,11 +836,10 @@ return new /obj/effect/temp_visual/annoyed(quirk_holder.loc) - var/datum/component/mood/mood = quirk_holder.GetComponent(/datum/component/mood) - if(mood.sanity <= SANITY_NEUTRAL) - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "bad_touch", /datum/mood_event/very_bad_touch) + if(quirk_holder.mob_mood.sanity <= SANITY_NEUTRAL) + quirk_holder.add_mood_event("bad_touch", /datum/mood_event/very_bad_touch) else - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "bad_touch", /datum/mood_event/bad_touch) + quirk_holder.add_mood_event("bad_touch", /datum/mood_event/bad_touch) /datum/quirk/claustrophobia name = "Claustrophobia" @@ -855,7 +851,7 @@ processing_quirk = TRUE /datum/quirk/claustrophobia/remove() - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "claustrophobia") + quirk_holder.clear_mood_event("claustrophobia") /datum/quirk/claustrophobia/process(delta_time) if(quirk_holder.stat != CONSCIOUS || quirk_holder.IsSleeping() || quirk_holder.IsUnconscious()) @@ -869,10 +865,10 @@ break if(!nick_spotted && isturf(quirk_holder.loc)) - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "claustrophobia", /datum/mood_event/claustrophobia) + quirk_holder.clear_mood_event("claustrophobia") return - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "claustrophobia") + quirk_holder.add_mood_event("claustrophobia", /datum/mood_event/claustrophobia) quirk_holder.losebreath += 0.25 // miss a breath one in four times if(DT_PROB(25, delta_time)) if(nick_spotted) diff --git a/code/datums/quirks/neutral.dm b/code/datums/quirks/neutral.dm index 38d136b2b2f..6386405770a 100644 --- a/code/datums/quirks/neutral.dm +++ b/code/datums/quirks/neutral.dm @@ -316,22 +316,22 @@ human_holder.hairstyle = old_hair human_holder.update_hair(is_creating = TRUE) UnregisterSignal(human_holder, list(COMSIG_CARBON_EQUIP_HAT, COMSIG_CARBON_UNEQUIP_HAT)) - SEND_SIGNAL(human_holder, COMSIG_CLEAR_MOOD_EVENT, "bad_hair_day") + human_holder.clear_mood_event("bad_hair_day") ///Checks if the headgear equipped is a wig and sets the mood event accordingly /datum/quirk/item_quirk/bald/proc/equip_hat(mob/user, obj/item/hat) SIGNAL_HANDLER if(istype(hat, /obj/item/clothing/head/wig)) - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "bad_hair_day", /datum/mood_event/confident_mane) //Our head is covered, but also by a wig so we're happy. + quirk_holder.add_mood_event("bad_hair_day", /datum/mood_event/confident_mane) //Our head is covered, but also by a wig so we're happy. else - SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "bad_hair_day") //Our head is covered + quirk_holder.clear_mood_event("bad_hair_day") //Our head is covered ///Applies a bad moodlet for having an uncovered head /datum/quirk/item_quirk/bald/proc/unequip_hat(mob/user, obj/item/clothing, force, newloc, no_move, invdrop, silent) SIGNAL_HANDLER - SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "bad_hair_day", /datum/mood_event/bald) + quirk_holder.add_mood_event("bad_hair_day", /datum/mood_event/bald) /datum/quirk/item_quirk/tongue_tied name = "Tongue Tied" @@ -449,7 +449,7 @@ SIGNAL_HANDLER // Epic gamer victory var/mob/living/carbon/human/human_holder = quirk_holder - SEND_SIGNAL(human_holder, COMSIG_ADD_MOOD_EVENT, "gamer_won", /datum/mood_event/gamer_won) + human_holder.add_mood_event("gamer_won", /datum/mood_event/gamer_won) /** * Gamer lost a game @@ -462,7 +462,7 @@ SIGNAL_HANDLER // Executed when a gamer has lost var/mob/living/carbon/human/human_holder = quirk_holder - SEND_SIGNAL(human_holder, COMSIG_ADD_MOOD_EVENT, "gamer_lost", /datum/mood_event/gamer_lost) + human_holder.add_mood_event("gamer_lost", /datum/mood_event/gamer_lost) // Executed asynchronously due to say() INVOKE_ASYNC(src, .proc/gamer_moment) /** @@ -476,7 +476,7 @@ var/mob/living/carbon/human/human_holder = quirk_holder // Remove withdrawal malus - SEND_SIGNAL(human_holder, COMSIG_CLEAR_MOOD_EVENT, "gamer_withdrawal") + human_holder.clear_mood_event("gamer_withdrawal") // Reset withdrawal timer if (gaming_withdrawal_timer) deltimer(gaming_withdrawal_timer) @@ -490,6 +490,6 @@ /datum/quirk/gamer/proc/enter_withdrawal() var/mob/living/carbon/human/human_holder = quirk_holder - SEND_SIGNAL(human_holder, COMSIG_ADD_MOOD_EVENT, "gamer_withdrawal", /datum/mood_event/gamer_withdrawal) + human_holder.add_mood_event("gamer_withdrawal", /datum/mood_event/gamer_withdrawal) #undef GAMING_WITHDRAWAL_TIME diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index c91c418a5a3..726507848c9 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -321,7 +321,7 @@ owner.adjust_timed_status_effect(-4 SECONDS, /datum/status_effect/dizziness) owner.adjust_timed_status_effect(-4 SECONDS, /datum/status_effect/jitter) owner.adjust_timed_status_effect(-1 SECONDS, /datum/status_effect/confusion) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "goodmusic", /datum/mood_event/goodmusic) + owner.add_mood_event("goodmusic", /datum/mood_event/goodmusic) /atom/movable/screen/alert/status_effect/regenerative_core name = "Regenerative Core Tendrils" diff --git a/code/datums/status_effects/debuffs/debuffs.dm b/code/datums/status_effects/debuffs/debuffs.dm index ba42ad8a753..8f963106f17 100644 --- a/code/datums/status_effects/debuffs/debuffs.dm +++ b/code/datums/status_effects/debuffs/debuffs.dm @@ -171,9 +171,8 @@ var/healing = HEALING_SLEEP_DEFAULT // having high spirits helps us recover - var/datum/component/mood/mood = owner.GetComponent(/datum/component/mood) - if(mood != null) - switch(mood.sanity_level) + if(owner.mob_mood) + switch(owner.mob_mood.sanity_level) if(SANITY_LEVEL_GREAT) healing = 0.2 if(SANITY_LEVEL_NEUTRAL) @@ -527,13 +526,13 @@ . = ..() ADD_TRAIT(owner, TRAIT_PACIFISM, CLOTHING_TRAIT) ADD_TRAIT(owner, TRAIT_MUTE, CLOTHING_TRAIT) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, type, /datum/mood_event/gondola) + owner.add_mood_event(type, /datum/mood_event/gondola) to_chat(owner, span_notice("You suddenly feel at peace and feel no need to make any sudden or rash actions...")) /datum/status_effect/gonbola_pacify/on_remove() REMOVE_TRAIT(owner, TRAIT_PACIFISM, CLOTHING_TRAIT) REMOVE_TRAIT(owner, TRAIT_MUTE, CLOTHING_TRAIT) - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, type) + owner.clear_mood_event(type) return ..() /datum/status_effect/trance diff --git a/code/datums/status_effects/debuffs/drugginess.dm b/code/datums/status_effects/debuffs/drugginess.dm index fcd0705f4f6..d3c5aa5e584 100644 --- a/code/datums/status_effects/debuffs/drugginess.dm +++ b/code/datums/status_effects/debuffs/drugginess.dm @@ -10,7 +10,7 @@ /datum/status_effect/drugginess/on_apply() RegisterSignal(owner, list(COMSIG_LIVING_POST_FULLY_HEAL, COMSIG_LIVING_DEATH), .proc/remove_drugginess) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, id, /datum/mood_event/high) + owner.add_mood_event(id, /datum/mood_event/high) owner.overlay_fullscreen(id, /atom/movable/screen/fullscreen/high) owner.sound_environment_override = SOUND_ENVIRONMENT_DRUGGED owner.grant_language(/datum/language/beachbum, TRUE, TRUE, id) @@ -19,7 +19,7 @@ /datum/status_effect/drugginess/on_remove() UnregisterSignal(owner, list(COMSIG_LIVING_POST_FULLY_HEAL, COMSIG_LIVING_DEATH)) - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, id) + owner.clear_mood_event(id) owner.clear_fullscreen(id) if(owner.sound_environment_override == SOUND_ENVIRONMENT_DRUGGED) owner.sound_environment_override = SOUND_ENVIRONMENT_NONE diff --git a/code/datums/status_effects/debuffs/drunk.dm b/code/datums/status_effects/debuffs/drunk.dm index 7a7192d8a83..00214676272 100644 --- a/code/datums/status_effects/debuffs/drunk.dm +++ b/code/datums/status_effects/debuffs/drunk.dm @@ -117,7 +117,7 @@ /datum/status_effect/inebriated/drunk/on_apply() . = ..() owner.sound_environment_override = SOUND_ENVIRONMENT_PSYCHOTIC - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, id, /datum/mood_event/drunk) + owner.add_mood_event(id, /datum/mood_event/drunk) /datum/status_effect/inebriated/drunk/on_remove() clear_effects() @@ -130,7 +130,7 @@ /// Clears any side effects we set due to being drunk. /datum/status_effect/inebriated/drunk/proc/clear_effects() - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, id) + owner.clear_mood_event(id) if(owner.sound_environment_override == SOUND_ENVIRONMENT_PSYCHOTIC) owner.sound_environment_override = SOUND_ENVIRONMENT_NONE diff --git a/code/datums/status_effects/debuffs/fire_stacks.dm b/code/datums/status_effects/debuffs/fire_stacks.dm index bc601ef167a..cb6fe43bb73 100644 --- a/code/datums/status_effects/debuffs/fire_stacks.dm +++ b/code/datums/status_effects/debuffs/fire_stacks.dm @@ -195,7 +195,7 @@ return victim.adjust_bodytemperature((BODYTEMP_HEATING_MAX + (stacks * 12)) * 0.5 * delta_time) - SEND_SIGNAL(victim, COMSIG_ADD_MOOD_EVENT, "on_fire", /datum/mood_event/on_fire) + victim.add_mood_event("on_fire", /datum/mood_event/on_fire) victim.mind?.add_memory(MEMORY_FIRE, list(DETAIL_PROTAGONIST = victim), story_value = STORY_VALUE_OKAY) /** @@ -231,7 +231,7 @@ qdel(firelight_ref) on_fire = FALSE - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "on_fire") + owner.clear_mood_event("on_fire") SEND_SIGNAL(owner, COMSIG_LIVING_EXTINGUISHED, owner) cache_stacks() update_overlay() diff --git a/code/datums/status_effects/debuffs/jitteriness.dm b/code/datums/status_effects/debuffs/jitteriness.dm index dea467e68c3..6c2a77cdfd6 100644 --- a/code/datums/status_effects/debuffs/jitteriness.dm +++ b/code/datums/status_effects/debuffs/jitteriness.dm @@ -15,12 +15,12 @@ return FALSE RegisterSignal(owner, list(COMSIG_LIVING_POST_FULLY_HEAL, COMSIG_LIVING_DEATH), .proc/remove_jitter) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, id, /datum/mood_event/jittery) + owner.add_mood_event(id, /datum/mood_event/jittery) return TRUE /datum/status_effect/jitter/on_remove() UnregisterSignal(owner, list(COMSIG_LIVING_POST_FULLY_HEAL, COMSIG_LIVING_DEATH)) - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, id) + owner.clear_mood_event(id) // juuust in case, reset our x and y's from our jittering owner.pixel_x = 0 owner.pixel_y = 0 diff --git a/code/datums/status_effects/drug_effects.dm b/code/datums/status_effects/drug_effects.dm index 6f6232adc21..295c253c6f4 100644 --- a/code/datums/status_effects/drug_effects.dm +++ b/code/datums/status_effects/drug_effects.dm @@ -80,7 +80,7 @@ human_owner.update_body() //updates eye color ADD_TRAIT(human_owner, TRAIT_BLOODSHOT_EYES, type) //dilates blood vessels in eyes ADD_TRAIT(human_owner, TRAIT_CLUMSY, type) //impairs motor coordination - SEND_SIGNAL(human_owner, COMSIG_ADD_MOOD_EVENT, "stoned", /datum/mood_event/stoned) //improves mood + human_owner.add_mood_event("stoned", /datum/mood_event/stoned) //improves mood human_owner.sound_environment_override = SOUND_ENVIRONMENT_DRUGGED //not realistic but very immersive return TRUE @@ -94,7 +94,7 @@ human_owner.update_body() REMOVE_TRAIT(human_owner, TRAIT_BLOODSHOT_EYES, type) REMOVE_TRAIT(human_owner, TRAIT_CLUMSY, type) - SEND_SIGNAL(human_owner, COMSIG_CLEAR_MOOD_EVENT, "stoned") + human_owner.clear_mood_event("stoned") human_owner.sound_environment_override = SOUND_ENVIRONMENT_NONE /atom/movable/screen/alert/status_effect/stoned diff --git a/code/datums/status_effects/neutral.dm b/code/datums/status_effects/neutral.dm index 37f6eed34da..5b5204b1eb6 100644 --- a/code/datums/status_effects/neutral.dm +++ b/code/datums/status_effects/neutral.dm @@ -413,10 +413,9 @@ //new you new stuff SSquirks.randomise_quirks(owner) owner.reagents.remove_all(1000) - var/datum/component/mood/mood = owner.GetComponent(/datum/component/mood) - mood.remove_temp_moods() //New you, new moods. + owner.mob_mood.remove_temp_moods() //New you, new moods. var/mob/living/carbon/human/human_mob = owner - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "Eigentrip", /datum/mood_event/eigentrip) + owner.add_mood_event("Eigentrip", /datum/mood_event/eigentrip) if(QDELETED(human_mob)) return if(prob(1))//low chance of the alternative reality returning to monkey diff --git a/code/game/machinery/computer/arcade/arcade.dm b/code/game/machinery/computer/arcade/arcade.dm index b6b71eeb1f3..e98fd035701 100644 --- a/code/game/machinery/computer/arcade/arcade.dm +++ b/code/game/machinery/computer/arcade/arcade.dm @@ -84,7 +84,7 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( Reset() -/obj/machinery/computer/arcade/proc/prizevend(mob/user, prizes = 1) +/obj/machinery/computer/arcade/proc/prizevend(mob/living/user, prizes = 1) SEND_SIGNAL(src, COMSIG_ARCADE_PRIZEVEND, user, prizes) if(user.mind?.get_skill_level(/datum/skill/gaming) >= SKILL_LEVEL_LEGENDARY && HAS_TRAIT(user, TRAIT_GAMERGOD)) visible_message("[user] inputs an intense cheat code!",\ @@ -92,7 +92,7 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( say("CODE ACTIVATED: EXTRA PRIZES.") prizes *= 2 for(var/i in 1 to prizes) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "arcade", /datum/mood_event/arcade) + user.add_mood_event("arcade", /datum/mood_event/arcade) if(prob(0.0001)) //1 in a million new /obj/item/gun/energy/pulse/prize(src) visible_message(span_notice("[src] dispenses.. woah, a gun! Way past cool."), span_notice("You hear a chime and a shot.")) diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index 36215ef5d99..fc3b0086636 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -799,7 +799,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM span_warning("After a few attempts, [user] manages to light [src] - however, [user.p_they()] burn [user.p_their()] finger in the process."), span_warning("You burn yourself while lighting the lighter!") ) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "burnt_thumb", /datum/mood_event/burnt_thumb) + user.add_mood_event("burnt_thumb", /datum/mood_event/burnt_thumb) /obj/item/lighter/attack(mob/living/carbon/M, mob/living/carbon/user) diff --git a/code/game/objects/items/clown_items.dm b/code/game/objects/items/clown_items.dm index cc6cf03ea1b..c1db2cd29fe 100644 --- a/code/game/objects/items/clown_items.dm +++ b/code/game/objects/items/clown_items.dm @@ -190,7 +190,7 @@ if(user != M && ishuman(user)) var/mob/living/carbon/human/H = user if (HAS_TRAIT(H, TRAIT_CLUMSY)) //only clowns can unlock its true powers - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "honk", /datum/mood_event/honk) + M.add_mood_event("honk", /datum/mood_event/honk) return ..() /obj/item/bikehorn/suicide_act(mob/user) diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index 3fb43247ce4..85523154ad5 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -636,7 +636,7 @@ H.emote("gasp") H.set_timed_status_effect(200 SECONDS, /datum/status_effect/jitter, only_if_higher = TRUE) SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "saved_life", /datum/mood_event/saved_life) + user.add_mood_event("saved_life", /datum/mood_event/saved_life) log_combat(user, H, "revived", defib) do_success() return diff --git a/code/game/objects/items/hand_items.dm b/code/game/objects/items/hand_items.dm index 4161337ab2c..16589280b64 100644 --- a/code/game/objects/items/hand_items.dm +++ b/code/game/objects/items/hand_items.dm @@ -158,9 +158,9 @@ return if(brutal_noogie) - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, "noogie_harsh", /datum/mood_event/noogie_harsh) + target.add_mood_event("noogie_harsh", /datum/mood_event/noogie_harsh) else - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, "noogie", /datum/mood_event/noogie) + target.add_mood_event("noogie", /datum/mood_event/noogie) noogie_loop(user, target, 0) @@ -321,7 +321,7 @@ if(!open_hands_taker) to_chat(taker, span_warning("You can't high-five [offerer] with no open hands!")) - SEND_SIGNAL(taker, COMSIG_ADD_MOOD_EVENT, "high_five", /datum/mood_event/high_five_full_hand) // not so successful now! + taker.add_mood_event("high_five", /datum/mood_event/high_five_full_hand) // not so successful now! return for(var/i in offerer.held_items) @@ -335,16 +335,16 @@ playsound(offerer, 'sound/weapons/slap.ogg', 100, TRUE, 1) offerer.mind.add_memory(MEMORY_HIGH_FIVE, list(DETAIL_DEUTERAGONIST = taker, DETAIL_HIGHFIVE_TYPE = "high ten"), story_value = STORY_VALUE_OKAY) taker.mind.add_memory(MEMORY_HIGH_FIVE, list(DETAIL_DEUTERAGONIST = offerer, DETAIL_HIGHFIVE_TYPE = "high ten"), story_value = STORY_VALUE_OKAY) - SEND_SIGNAL(offerer, COMSIG_ADD_MOOD_EVENT, "high_five", /datum/mood_event/high_ten) - SEND_SIGNAL(taker, COMSIG_ADD_MOOD_EVENT, "high_five", /datum/mood_event/high_ten) + offerer.add_mood_event("high_five", /datum/mood_event/high_ten) + taker.add_mood_event("high_five", /datum/mood_event/high_ten) else offerer.visible_message(span_notice("[taker] high-fives [offerer]!"), span_nicegreen("All right! You're high-fived by [taker]!"), span_hear("You hear a sickening sound of flesh hitting flesh!"), ignored_mobs=taker) to_chat(taker, span_nicegreen("You high-five [offerer]!")) playsound(offerer, 'sound/weapons/slap.ogg', 50, TRUE, -1) offerer.mind.add_memory(MEMORY_HIGH_FIVE, list(DETAIL_DEUTERAGONIST = taker, DETAIL_HIGHFIVE_TYPE = "high five"), story_value = STORY_VALUE_OKAY) taker.mind.add_memory(MEMORY_HIGH_FIVE, list(DETAIL_DEUTERAGONIST = offerer, DETAIL_HIGHFIVE_TYPE = "high five"), story_value = STORY_VALUE_OKAY) - SEND_SIGNAL(offerer, COMSIG_ADD_MOOD_EVENT, "high_five", /datum/mood_event/high_five) - SEND_SIGNAL(taker, COMSIG_ADD_MOOD_EVENT, "high_five", /datum/mood_event/high_five) + offerer.add_mood_event("high_five", /datum/mood_event/high_five) + taker.add_mood_event("high_five", /datum/mood_event/high_five) qdel(src) /obj/item/hand_item/kisser @@ -445,7 +445,7 @@ living_target.visible_message(span_danger("[living_target] is hit by \a [src]."), span_userdanger("You're hit by \a [src]!"), vision_distance=COMBAT_MESSAGE_RANGE) living_target.mind?.add_memory(MEMORY_KISS, list(DETAIL_PROTAGONIST = living_target, DETAIL_KISSER = firer), story_value = STORY_VALUE_OKAY) - SEND_SIGNAL(living_target, COMSIG_ADD_MOOD_EVENT, "kiss", /datum/mood_event/kiss, firer, suppressed) + living_target.add_mood_event("kiss", /datum/mood_event/kiss, firer, suppressed) if(isliving(firer)) var/mob/living/kisser = firer kisser.mind?.add_memory(MEMORY_KISS, list(DETAIL_PROTAGONIST = living_target, DETAIL_KISSER = firer), story_value = STORY_VALUE_OKAY, memory_flags = MEMORY_CHECK_BLINDNESS) @@ -483,8 +483,9 @@ def_zone = BODY_ZONE_HEAD // let's keep it PG, people . = ..() if(isliving(target)) - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, "kiss", /datum/mood_event/kiss, firer, suppressed) - try_fluster(target) + var/mob/living/living_target = target + living_target.add_mood_event("kiss", /datum/mood_event/kiss, firer, suppressed) + try_fluster(living_target) /obj/projectile/kiss/death name = "kiss of death" diff --git a/code/game/objects/items/storage/book.dm b/code/game/objects/items/storage/book.dm index f0f80ed08d5..348c71b0f25 100644 --- a/code/game/objects/items/storage/book.dm +++ b/code/game/objects/items/storage/book.dm @@ -143,7 +143,7 @@ GLOBAL_LIST_INIT(bibleitemstates, list("bible", "koran", "scrapbook", "burning", H.visible_message(span_notice("[user] heals [H] with the power of [deity_name]!")) to_chat(H, span_boldnotice("May the power of [deity_name] compel you to be healed!")) playsound(src.loc, SFX_PUNCH, 25, TRUE, -1) - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing) + H.add_mood_event("blessing", /datum/mood_event/blessing) return TRUE /obj/item/storage/book/bible/attack(mob/living/M, mob/living/carbon/human/user, heal_mode = TRUE) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index a7743e3b067..5c256f740e6 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -176,20 +176,20 @@ inhand_icon_state = "syndballoon" random_color = FALSE -/obj/item/toy/balloon/syndicate/pickup(mob/user) +/obj/item/toy/balloon/syndicate/pickup(mob/living/user) . = ..() if(user && user.mind && user.mind.has_antag_datum(/datum/antagonist, TRUE)) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "badass_antag", /datum/mood_event/badass_antag) + user.add_mood_event("badass_antag", /datum/mood_event/badass_antag) -/obj/item/toy/balloon/syndicate/dropped(mob/user) +/obj/item/toy/balloon/syndicate/dropped(mob/living/user) if(user) - SEND_SIGNAL(user, COMSIG_CLEAR_MOOD_EVENT, "badass_antag", /datum/mood_event/badass_antag) + user.clear_mood_event("badass_antag") . = ..() /obj/item/toy/balloon/syndicate/Destroy() if(ismob(loc)) - var/mob/M = loc - SEND_SIGNAL(M, COMSIG_CLEAR_MOOD_EVENT, "badass_antag", /datum/mood_event/badass_antag) + var/mob/living/M = loc + M.clear_mood_event("badass_antag") . = ..() /obj/item/toy/balloon/arrest @@ -1487,7 +1487,7 @@ GLOBAL_LIST_EMPTY(intento_players) switch(intent) if(HELP) to_chat(victim, span_danger("[src] hugs you to make you feel better!")) - SEND_SIGNAL(victim, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/hug) + victim.add_mood_event("hug", /datum/mood_event/hug) if(DISARM) to_chat(victim, span_danger("You're knocked down from a shove by [src]!")) victim.Knockdown(2 SECONDS) diff --git a/code/game/objects/structures/guillotine.dm b/code/game/objects/structures/guillotine.dm index 08ab8a00cc8..749cbfcc6ba 100644 --- a/code/game/objects/structures/guillotine.dm +++ b/code/game/objects/structures/guillotine.dm @@ -217,7 +217,7 @@ if (!istype(M, /mob/living/carbon/human)) return - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "dying", /datum/mood_event/deaths_door) + M.add_mood_event("dying", /datum/mood_event/deaths_door) var/mob/living/carbon/human/H = M if (H.dna) @@ -242,7 +242,7 @@ M.regenerate_icons() M.pixel_y -= -GUILLOTINE_HEAD_OFFSET // Move their body back M.layer -= GUILLOTINE_LAYER_DIFF - SEND_SIGNAL(M, COMSIG_CLEAR_MOOD_EVENT, "dying") + M.clear_mood_event("dying") ..() /obj/structure/guillotine/can_be_unfasten_wrench(mob/user, silent) diff --git a/code/game/objects/structures/gym.dm b/code/game/objects/structures/gym.dm index 11e9e40482a..58ae81b14f0 100644 --- a/code/game/objects/structures/gym.dm +++ b/code/game/objects/structures/gym.dm @@ -17,7 +17,7 @@ playsound(loc, pick(hit_sounds), 25, TRUE, -1) if(isliving(user)) var/mob/living/L = user - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "exercise", /datum/mood_event/exercise) + L.add_mood_event("exercise", /datum/mood_event/exercise) L.apply_status_effect(/datum/status_effect/exercised) /obj/structure/weightmachine @@ -64,7 +64,7 @@ update_appearance() user.pixel_y = user.base_pixel_y var/finishmessage = pick("You feel stronger!","You feel like you can take on the world!","You feel robust!","You feel indestructible!") - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "exercise", /datum/mood_event/exercise) + user.add_mood_event("exercise", /datum/mood_event/exercise) to_chat(user, finishmessage) user.apply_status_effect(/datum/status_effect/exercised) diff --git a/code/game/objects/structures/shower.dm b/code/game/objects/structures/shower.dm index 84d8485a648..c87d0745499 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -238,10 +238,11 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/shower, (-16)) /obj/machinery/shower/proc/wash_atom(atom/target) target.wash(CLEAN_RAD | CLEAN_WASH) - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, "shower", /datum/mood_event/nice_shower) reagents.expose(target, (TOUCH), SHOWER_EXPOSURE_MULTIPLIER * SHOWER_SPRAY_VOLUME / max(reagents.total_volume, SHOWER_SPRAY_VOLUME)) if(isliving(target)) - check_heat(target) + var/mob/living/living_target = target + check_heat(living_target) + living_target.add_mood_event("shower", /datum/mood_event/nice_shower) /** * Toggle whether shower is actually on and outputting water. diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index dd66862ece9..8ffa6a27da9 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -164,7 +164,7 @@ pushed_mob.visible_message(span_danger("[user] slams [pushed_mob] onto \the [src]!"), \ span_userdanger("[user] slams you onto \the [src]!")) log_combat(user, pushed_mob, "tabled", null, "onto [src]") - SEND_SIGNAL(pushed_mob, COMSIG_ADD_MOOD_EVENT, "table", /datum/mood_event/table) + pushed_mob.add_mood_event("table", /datum/mood_event/table) /obj/structure/table/proc/tablelimbsmash(mob/living/user, mob/living/pushed_mob) pushed_mob.Knockdown(30) @@ -181,7 +181,7 @@ pushed_mob.visible_message(span_danger("[user] smashes [pushed_mob]'s [banged_limb.name] against \the [src]!"), span_userdanger("[user] smashes your [banged_limb.name] against \the [src]")) log_combat(user, pushed_mob, "head slammed", null, "against [src]") - SEND_SIGNAL(pushed_mob, COMSIG_ADD_MOOD_EVENT, "table", /datum/mood_event/table_limbsmash, banged_limb) + pushed_mob.add_mood_event("table", /datum/mood_event/table_limbsmash, banged_limb) /obj/structure/table/screwdriver_act_secondary(mob/living/user, obj/item/tool) if(flags_1 & NODECONSTRUCT_1 || !deconstruction_ready) diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm index ccaef8fb9f1..0429891bc42 100644 --- a/code/game/turfs/open/_open.dm +++ b/code/game/turfs/open/_open.dm @@ -229,6 +229,7 @@ playsound(slipper.loc, 'sound/misc/slip.ogg', 50, TRUE, -3) SEND_SIGNAL(slipper, COMSIG_ON_CARBON_SLIP) + slipper.add_mood_event("slipped", /datum/mood_event/slipped) if(force_drop) for(var/obj/item/I in slipper.held_items) slipper.accident(I) diff --git a/code/modules/antagonists/_common/antag_datum.dm b/code/modules/antagonists/_common/antag_datum.dm index c75737a6d90..8df48dbc60c 100644 --- a/code/modules/antagonists/_common/antag_datum.dm +++ b/code/modules/antagonists/_common/antag_datum.dm @@ -246,7 +246,7 @@ GLOBAL_LIST_EMPTY(antagonists) /datum/antagonist/proc/give_antag_moodies() if(!antag_moodlet) return - SEND_SIGNAL(owner.current, COMSIG_ADD_MOOD_EVENT, "antag_moodlet", antag_moodlet) + owner.current.add_mood_event("antag_moodlet", antag_moodlet) /** * Proc that removes this antagonist's ascribed moodlet from the player. @@ -254,7 +254,7 @@ GLOBAL_LIST_EMPTY(antagonists) /datum/antagonist/proc/clear_antag_moodies() if(!antag_moodlet) return - SEND_SIGNAL(owner.current, COMSIG_CLEAR_MOOD_EVENT, "antag_moodlet") + owner.current.clear_mood_event("antag_moodlet") /** * Proc that will return the team this antagonist belongs to, when called. Helpful with antagonists that may belong to multiple potential teams in a single round. diff --git a/code/modules/antagonists/ashwalker/ashwalker.dm b/code/modules/antagonists/ashwalker/ashwalker.dm index cee1ba44c9b..909bf26709a 100644 --- a/code/modules/antagonists/ashwalker/ashwalker.dm +++ b/code/modules/antagonists/ashwalker/ashwalker.dm @@ -42,4 +42,4 @@ SIGNAL_HANDLER if(istype(A, /obj/structure/headpike)) - SEND_SIGNAL(owner.current, COMSIG_ADD_MOOD_EVENT, "oogabooga", /datum/mood_event/sacrifice_good) + owner.current.add_mood_event("oogabooga", /datum/mood_event/sacrifice_good) diff --git a/code/modules/antagonists/heretic/influences.dm b/code/modules/antagonists/heretic/influences.dm index 3c037571ea9..9ee71582914 100644 --- a/code/modules/antagonists/heretic/influences.dm +++ b/code/modules/antagonists/heretic/influences.dm @@ -192,7 +192,7 @@ var/mob/living/carbon/human/human_user = user to_chat(human_user, span_userdanger("Your mind burns as you stare at the tear!")) human_user.adjustOrganLoss(ORGAN_SLOT_BRAIN, 10, 190) - SEND_SIGNAL(human_user, COMSIG_ADD_MOOD_EVENT, "gates_of_mansus", /datum/mood_event/gates_of_mansus) + human_user.add_mood_event("gates_of_mansus", /datum/mood_event/gates_of_mansus) /obj/effect/heretic_influence name = "reality smash" diff --git a/code/modules/antagonists/heretic/items/madness_mask.dm b/code/modules/antagonists/heretic/items/madness_mask.dm index 035bb3e9cd2..82b94b25d07 100644 --- a/code/modules/antagonists/heretic/items/madness_mask.dm +++ b/code/modules/antagonists/heretic/items/madness_mask.dm @@ -58,7 +58,7 @@ if(human_in_range.is_blind()) continue - SEND_SIGNAL(human_in_range, COMSIG_HERETIC_MASK_ACT, rand(-2, -20) * delta_time) + human_in_range.mob_mood.direct_sanity_drain(rand(-2, -20) * delta_time) if(DT_PROB(60, delta_time)) human_in_range.hallucination = min(human_in_range.hallucination + 5, 120) diff --git a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm index 8a9491bb08a..b0b2a5c310b 100644 --- a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm +++ b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm @@ -307,7 +307,7 @@ sac_target.reagents?.add_reagent(/datum/reagent/inverse/helgrasp/heretic, helgrasp_time / 20) sac_target.apply_necropolis_curse(CURSE_BLINDING | CURSE_GRASPING) - SEND_SIGNAL(sac_target, COMSIG_ADD_MOOD_EVENT, "shadow_realm", /datum/mood_event/shadow_realm) + sac_target.add_mood_event("shadow_realm", /datum/mood_event/shadow_realm) sac_target.flash_act() sac_target.blur_eyes(15) @@ -360,7 +360,7 @@ sac_target.remove_status_effect(/datum/status_effect/necropolis_curse) sac_target.remove_status_effect(/datum/status_effect/unholy_determination) sac_target.reagents?.del_reagent(/datum/reagent/inverse/helgrasp/heretic) - SEND_SIGNAL(sac_target, COMSIG_CLEAR_MOOD_EVENT, "shadow_realm") + sac_target.clear_mood_event("shadow_realm") // Wherever we end up, we sure as hell won't be able to explain sac_target.adjust_timed_status_effect(40 SECONDS, /datum/status_effect/speech/slurring/heretic) @@ -439,8 +439,8 @@ sac_target.adjustStaminaLoss(120) // Glad i'm outta there, though! - SEND_SIGNAL(sac_target, COMSIG_ADD_MOOD_EVENT, "shadow_realm_survived", /datum/mood_event/shadow_realm_live) - SEND_SIGNAL(sac_target, COMSIG_ADD_MOOD_EVENT, "shadow_realm_survived_sadness", /datum/mood_event/shadow_realm_live_sad) + sac_target.add_mood_event("shadow_realm_survived", /datum/mood_event/shadow_realm_live) + sac_target.add_mood_event("shadow_realm_survived_sadness", /datum/mood_event/shadow_realm_live_sad) // Could use a little pick-me-up... sac_target.reagents?.add_reagent(/datum/reagent/medicine/atropine, 8) diff --git a/code/modules/antagonists/heretic/magic/flesh_ascension.dm b/code/modules/antagonists/heretic/magic/flesh_ascension.dm index 7cb5913c1c7..ebe1f89d273 100644 --- a/code/modules/antagonists/heretic/magic/flesh_ascension.dm +++ b/code/modules/antagonists/heretic/magic/flesh_ascension.dm @@ -45,7 +45,7 @@ for(var/mob/living/carbon/human/nearby_human in view(scare_radius, new_armsy)) if(IS_HERETIC_OR_MONSTER(nearby_human)) continue - SEND_SIGNAL(nearby_human, COMSIG_ADD_MOOD_EVENT, "gates_of_mansus", /datum/mood_event/gates_of_mansus) + nearby_human.add_mood_event("gates_of_mansus", /datum/mood_event/gates_of_mansus) if(prob(25)) var/datum/brain_trauma/trauma = pick(subtypesof(BRAIN_TRAUMA_MILD) + subtypesof(BRAIN_TRAUMA_SEVERE)) diff --git a/code/modules/antagonists/heretic/magic/madness_touch.dm b/code/modules/antagonists/heretic/magic/madness_touch.dm index ac9e2b3b87c..a3e20477e9b 100644 --- a/code/modules/antagonists/heretic/magic/madness_touch.dm +++ b/code/modules/antagonists/heretic/magic/madness_touch.dm @@ -28,5 +28,7 @@ return FALSE to_chat(caster, span_warning("[human_victim.name] has been cursed!")) - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, "gates_of_mansus", /datum/mood_event/gates_of_mansus) + if (isliving(target)) + var/mob/living/target_mob = target + target_mob.add_mood_event("gates_of_mansus", /datum/mood_event/gates_of_mansus) return TRUE diff --git a/code/modules/antagonists/heretic/structures/carving_knife.dm b/code/modules/antagonists/heretic/structures/carving_knife.dm index 4884558ab34..ec743a2abce 100644 --- a/code/modules/antagonists/heretic/structures/carving_knife.dm +++ b/code/modules/antagonists/heretic/structures/carving_knife.dm @@ -244,5 +244,5 @@ carbon_victim.set_timed_status_effect(20 SECONDS, /datum/status_effect/jitter, only_if_higher = TRUE) carbon_victim.set_timed_status_effect(40 SECONDS, /datum/status_effect/dizziness, only_if_higher = TRUE) carbon_victim.blind_eyes(2) - SEND_SIGNAL(carbon_victim, COMSIG_ADD_MOOD_EVENT, "gates_of_mansus", /datum/mood_event/gates_of_mansus) + carbon_victim.add_mood_event("gates_of_mansus", /datum/mood_event/gates_of_mansus) playsound(src, 'sound/magic/blind.ogg', 75, TRUE) diff --git a/code/modules/antagonists/traitor/components/demoraliser.dm b/code/modules/antagonists/traitor/components/demoraliser.dm index b1a36e97a2a..6f505a2ab1f 100644 --- a/code/modules/antagonists/traitor/components/demoraliser.dm +++ b/code/modules/antagonists/traitor/components/demoraliser.dm @@ -49,13 +49,13 @@ if (is_special_character(viewer)) to_chat(viewer, span_notice("[moods.antag_notification]")) - SEND_SIGNAL(viewer, COMSIG_ADD_MOOD_EVENT, moods.mood_category, moods.antag_mood) + viewer.add_mood_event(moods.mood_category, moods.antag_mood) else if (viewer.mind.assigned_role.departments_bitflags & (DEPARTMENT_BITFLAG_SECURITY|DEPARTMENT_BITFLAG_COMMAND)) to_chat(viewer, span_notice("[moods.authority_notification]")) - SEND_SIGNAL(viewer, COMSIG_ADD_MOOD_EVENT, moods.mood_category, moods.authority_mood) + viewer.add_mood_event(moods.mood_category, moods.authority_mood) else to_chat(viewer, span_notice("[moods.crew_notification]")) - SEND_SIGNAL(viewer, COMSIG_ADD_MOOD_EVENT, moods.mood_category, moods.crew_mood) + viewer.add_mood_event(moods.mood_category, moods.crew_mood) SEND_SIGNAL(host, COMSIG_DEMORALISING_EVENT, viewer.mind) @@ -66,11 +66,10 @@ * * viewer - Whoever just saw the parent. */ /datum/proximity_monitor/advanced/demoraliser/proc/should_demoralise(mob/living/viewer) - var/datum/component/mood/mood = viewer.GetComponent(/datum/component/mood) - if (!mood) + if (!viewer.mob_mood) return FALSE - return !mood.has_mood_of_category(moods.mood_category) + return !viewer.mob_mood.has_mood_of_category(moods.mood_category) /// Mood application categories for this objective /// Used to reduce duplicate code for applying moods to players based on their state diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm index 80031ad31f0..cd0d1e81d29 100644 --- a/code/modules/antagonists/wizard/equipment/artefact.dm +++ b/code/modules/antagonists/wizard/equipment/artefact.dm @@ -139,11 +139,10 @@ return . = COMPONENT_CANCEL_ATTACK_CHAIN var/mob/living/carbon/jedi = user - var/datum/component/mood/insaneinthemembrane = jedi.GetComponent(/datum/component/mood) - if(insaneinthemembrane.sanity < 15) + if(jedi.mob_mood.sanity < 15) return //they've already seen it and are about to die, or are just too insane to care to_chat(jedi, span_userdanger("OH GOD! NONE OF IT IS REAL! NONE OF IT IS REEEEEEEEEEEEEEEEEEEEEEEEAL!")) - insaneinthemembrane.sanity = 0 + jedi.mob_mood.sanity = 0 for(var/lore in typesof(/datum/brain_trauma/severe)) jedi.gain_trauma(lore) addtimer(CALLBACK(src, .proc/deranged, jedi), 10 SECONDS) diff --git a/code/modules/cards/deck/deck.dm b/code/modules/cards/deck/deck.dm index f42c2f786ee..17c01a5cc47 100644 --- a/code/modules/cards/deck/deck.dm +++ b/code/modules/cards/deck/deck.dm @@ -131,7 +131,7 @@ var/other_players = english_list(card_players - player) var/obj/item/toy/held_card_item = card_players[player] - SEND_SIGNAL(player, COMSIG_ADD_MOOD_EVENT, "playing_cards", /datum/mood_event/playing_cards) + player.add_mood_event("playing_cards", /datum/mood_event/playing_cards) player.mind?.add_memory( MEMORY_PLAYING_CARDS, list( @@ -214,8 +214,8 @@ var/mob/living/thrower = throwingdatum.thrower target.visible_message(span_warning("[target] is forced to play 52 card pickup!"), span_warning("You are forced to play 52 card pickup.")) - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, "lost_52_card_pickup", /datum/mood_event/lost_52_card_pickup) - SEND_SIGNAL(thrower, COMSIG_ADD_MOOD_EVENT, "won_52_card_pickup", /datum/mood_event/won_52_card_pickup) + target.add_mood_event("lost_52_card_pickup", /datum/mood_event/lost_52_card_pickup) + thrower.add_mood_event("won_52_card_pickup", /datum/mood_event/won_52_card_pickup) add_memory_in_range( target, 7, diff --git a/code/modules/client/verbs/suicide.dm b/code/modules/client/verbs/suicide.dm index 9aa1aaa2339..8e5831bd7a5 100644 --- a/code/modules/client/verbs/suicide.dm +++ b/code/modules/client/verbs/suicide.dm @@ -43,7 +43,7 @@ if(damagetype & SHAME) adjustStaminaLoss(200) set_suicide(FALSE) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "shameful_suicide", /datum/mood_event/shameful_suicide) + add_mood_event("shameful_suicide", /datum/mood_event/shameful_suicide) return if(damagetype & MANUAL_SUICIDE_NONLETHAL) //Make sure to call the necessary procs if it does kill later diff --git a/code/modules/clothing/head/garlands.dm b/code/modules/clothing/head/garlands.dm index 84333fefea3..c4eb99aa050 100644 --- a/code/modules/clothing/head/garlands.dm +++ b/code/modules/clothing/head/garlands.dm @@ -4,11 +4,11 @@ icon_state = "garland" worn_icon_state = "garland" -/obj/item/clothing/head/garland/equipped(mob/user, slot) +/obj/item/clothing/head/garland/equipped(mob/living/user, slot) . = ..() if(slot_flags & slot) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "garland", /datum/mood_event/garland) + user.add_mood_event("garland", /datum/mood_event/garland) -/obj/item/clothing/head/garland/dropped(mob/user) +/obj/item/clothing/head/garland/dropped(mob/living/user) . = ..() - SEND_SIGNAL(user, COMSIG_CLEAR_MOOD_EVENT, "garland") + user.clear_mood_event("garland") diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm index e471bf1ee48..058857598db 100644 --- a/code/modules/clothing/shoes/_shoes.dm +++ b/code/modules/clothing/shoes/_shoes.dm @@ -213,7 +213,7 @@ our_guy.Paralyze(5) our_guy.Knockdown(10) our_guy.visible_message(span_danger("[our_guy] trips on [our_guy.p_their()] knotted shoelaces and falls! What a klutz!"), span_userdanger("You trip on your knotted shoelaces and fall over!")) - SEND_SIGNAL(our_guy, COMSIG_ADD_MOOD_EVENT, "trip", /datum/mood_event/tripped) // well we realized they're knotted now! + our_guy.add_mood_event("trip", /datum/mood_event/tripped) // well we realized they're knotted now! our_alert_ref = WEAKREF(our_guy.throw_alert(ALERT_SHOES_KNOT, /atom/movable/screen/alert/shoes/knotted)) else if(tied == SHOES_UNTIED) @@ -222,7 +222,7 @@ if(1) // .1% chance to trip and fall over (note these are per step while our laces are undone) our_guy.Paralyze(5) our_guy.Knockdown(10) - SEND_SIGNAL(our_guy, COMSIG_ADD_MOOD_EVENT, "trip", /datum/mood_event/tripped) // well we realized they're knotted now! + our_guy.add_mood_event("trip", /datum/mood_event/tripped) // well we realized they're knotted now! our_guy.visible_message(span_danger("[our_guy] trips on [our_guy.p_their()] untied shoelaces and falls! What a klutz!"), span_userdanger("You trip on your untied shoelaces and fall over!")) if(2 to 5) // .4% chance to stumble and lurch forward @@ -245,7 +245,7 @@ if(26 to 1000) wiser = FALSE if(wiser) - SEND_SIGNAL(our_guy, COMSIG_ADD_MOOD_EVENT, "untied", /datum/mood_event/untied) // well we realized they're untied now! + our_guy.add_mood_event("untied", /datum/mood_event/untied) // well we realized they're untied now! our_alert_ref = WEAKREF(our_guy.throw_alert(ALERT_SHOES_KNOT, /atom/movable/screen/alert/shoes/untied)) diff --git a/code/modules/clothing/shoes/clown.dm b/code/modules/clothing/shoes/clown.dm index 83324d934e9..d7942d860ce 100644 --- a/code/modules/clothing/shoes/clown.dm +++ b/code/modules/clothing/shoes/clown.dm @@ -15,19 +15,19 @@ LoadComponent(/datum/component/squeak, list('sound/effects/clownstep1.ogg'=1,'sound/effects/clownstep2.ogg'=1), 50, falloff_exponent = 20) //die off quick please AddElement(/datum/element/swabable, CELL_LINE_TABLE_CLOWN, CELL_VIRUS_TABLE_GENERIC, rand(2,3), 0) -/obj/item/clothing/shoes/clown_shoes/equipped(mob/user, slot) +/obj/item/clothing/shoes/clown_shoes/equipped(mob/living/user, slot) . = ..() if(slot == ITEM_SLOT_FEET) if(enabled_waddle) user.AddElement(/datum/element/waddling) if(is_clown_job(user.mind?.assigned_role)) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "clownshoes", /datum/mood_event/clownshoes) + user.add_mood_event("clownshoes", /datum/mood_event/clownshoes) -/obj/item/clothing/shoes/clown_shoes/dropped(mob/user) +/obj/item/clothing/shoes/clown_shoes/dropped(mob/living/user) . = ..() user.RemoveElement(/datum/element/waddling) if(is_clown_job(user.mind?.assigned_role)) - SEND_SIGNAL(user, COMSIG_CLEAR_MOOD_EVENT, "clownshoes") + user.clear_mood_event("clownshoes") /obj/item/clothing/shoes/clown_shoes/CtrlClick(mob/living/user) if(!isliving(user)) diff --git a/code/modules/clothing/suits/reactive_armour.dm b/code/modules/clothing/suits/reactive_armour.dm index d1731c8e855..82b8fd22a2d 100644 --- a/code/modules/clothing/suits/reactive_armour.dm +++ b/code/modules/clothing/suits/reactive_armour.dm @@ -310,7 +310,7 @@ owner.apply_damage(10, BRUTE) owner.apply_damage(40, STAMINA) playsound(owner, 'sound/effects/tableslam.ogg', 90, TRUE) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "table", /datum/mood_event/table) + owner.add_mood_event("table", /datum/mood_event/table) do_teleport(owner, get_turf(owner), tele_range, no_effects = TRUE, channel = TELEPORT_CHANNEL_BLUESPACE) new /obj/structure/table(get_turf(owner)) reactivearmor_cooldown = world.time + reactivearmor_cooldown_duration diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index a1c5e776aae..3efaf692c3f 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -109,11 +109,11 @@ if(attached_accessory.above_suit) H.update_inv_wear_suit() -/obj/item/clothing/under/equipped(mob/user, slot) +/obj/item/clothing/under/equipped(mob/living/user, slot) ..() if(slot == ITEM_SLOT_ICLOTHING && freshly_laundered) freshly_laundered = FALSE - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "fresh_laundry", /datum/mood_event/fresh_laundry) + user.add_mood_event("fresh_laundry", /datum/mood_event/fresh_laundry) /obj/item/clothing/under/dropped(mob/user) if(attached_accessory) diff --git a/code/modules/clothing/under/accessories.dm b/code/modules/clothing/under/accessories.dm index bc71c832079..4315ab92f01 100755 --- a/code/modules/clothing/under/accessories.dm +++ b/code/modules/clothing/under/accessories.dm @@ -378,12 +378,12 @@ /obj/item/clothing/accessory/clown_enjoyer_pin/on_uniform_equip(obj/item/clothing/under/U, user) var/mob/living/L = user if(HAS_TRAIT(L, TRAIT_CLOWN_ENJOYER)) - SEND_SIGNAL(L, COMSIG_ADD_MOOD_EVENT, "clown_enjoyer_pin", /datum/mood_event/clown_enjoyer_pin) + L.add_mood_event("clown_enjoyer_pin", /datum/mood_event/clown_enjoyer_pin) /obj/item/clothing/accessory/clown_enjoyer_pin/on_uniform_dropped(obj/item/clothing/under/U, user) var/mob/living/L = user if(HAS_TRAIT(L, TRAIT_CLOWN_ENJOYER)) - SEND_SIGNAL(L, COMSIG_CLEAR_MOOD_EVENT, "clown_enjoyer_pin") + L.clear_mood_event("clown_enjoyer_pin") /obj/item/clothing/accessory/mime_fan_pin name = "\improper Mime Pin" @@ -393,12 +393,12 @@ /obj/item/clothing/accessory/mime_fan_pin/on_uniform_equip(obj/item/clothing/under/U, user) var/mob/living/L = user if(HAS_TRAIT(L, TRAIT_MIME_FAN)) - SEND_SIGNAL(L, COMSIG_ADD_MOOD_EVENT, "mime_fan_pin", /datum/mood_event/mime_fan_pin) + L.add_mood_event("mime_fan_pin", /datum/mood_event/mime_fan_pin) /obj/item/clothing/accessory/mime_fan_pin/on_uniform_dropped(obj/item/clothing/under/U, user) var/mob/living/L = user if(HAS_TRAIT(L, TRAIT_MIME_FAN)) - SEND_SIGNAL(L, COMSIG_CLEAR_MOOD_EVENT, "mime_fan_pin") + L.clear_mood_event("mime_fan_pin") //////////////// //OONGA BOONGA// diff --git a/code/modules/fishing/aquarium/aquarium.dm b/code/modules/fishing/aquarium/aquarium.dm index a6fa8ef3ec3..1442c0928e2 100644 --- a/code/modules/fishing/aquarium/aquarium.dm +++ b/code/modules/fishing/aquarium/aquarium.dm @@ -171,7 +171,7 @@ update_appearance() ///Apply mood bonus depending on aquarium status -/obj/structure/aquarium/proc/admire(mob/user) +/obj/structure/aquarium/proc/admire(mob/living/user) to_chat(user,span_notice("You take a moment to watch [src].")) if(do_after(user, 5 SECONDS, target = src)) var/alive_fish = 0 @@ -185,9 +185,9 @@ //All fish dead - bad mood. //No fish - nothing. if(alive_fish > 0) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "aquarium", /datum/mood_event/aquarium_positive) + user.add_mood_event("aquarium", /datum/mood_event/aquarium_positive) else if(dead_fish > 0) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "aquarium", /datum/mood_event/aquarium_negative) + user.add_mood_event("aquarium", /datum/mood_event/aquarium_negative) // Could maybe scale power of this mood with number/types of fish /obj/structure/aquarium/ui_data(mob/user) diff --git a/code/modules/fishing/fishing_minigame.dm b/code/modules/fishing/fishing_minigame.dm index ce91cbf0332..04b52bb4564 100644 --- a/code/modules/fishing/fishing_minigame.dm +++ b/code/modules/fishing/fishing_minigame.dm @@ -73,13 +73,13 @@ QDEL_NULL(lure) . = ..() -/datum/fishing_challenge/proc/start(mob/user) +/datum/fishing_challenge/proc/start(mob/living/user) /// Create fishing line visuals fishing_line = used_rod.create_fishing_line(lure, target_py = 5) // If fishing line breaks los / rod gets dropped / deleted RegisterSignal(fishing_line, COMSIG_FISHING_LINE_SNAPPED, .proc/interrupt) ADD_TRAIT(user, TRAIT_GONE_FISHING, REF(src)) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "fishing", /datum/mood_event/fishing) + user.add_mood_event("fishing", /datum/mood_event/fishing) RegisterSignal(user, COMSIG_MOB_CLICKON, .proc/handle_click) start_baiting_phase() to_chat(user, span_notice("You start fishing...")) diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index c352757cf31..117ffb914ba 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -372,8 +372,9 @@ if(!QDELETED(src) && cap_on && reagents.total_volume) if(prob(flip_chance)) // landed upright src.visible_message(span_notice("[src] lands upright!")) - if(throwingdatum.thrower) - SEND_SIGNAL(throwingdatum.thrower, COMSIG_ADD_MOOD_EVENT, "bottle_flip", /datum/mood_event/bottle_flip) + if(throwingdatum.thrower && isliving(throwingdatum.thrower)) + var/mob/living/living_thrower = throwingdatum.thrower + living_thrower.add_mood_event("bottle_flip", /datum/mood_event/bottle_flip) else // landed on it's side animate(src, transform = matrix(prob(50)? 90 : -90, MATRIX_ROTATE), time = 3, loop = 0) @@ -702,10 +703,11 @@ return if(ismob(target)) - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, "soda_spill", /datum/mood_event/soda_spill, src) + var/mob/living/target_mob = target + target_mob.add_mood_event("soda_spill", /datum/mood_event/soda_spill, src) for(var/mob/living/iter_mob in view(src, 7)) if(iter_mob != target) - SEND_SIGNAL(iter_mob, COMSIG_ADD_MOOD_EVENT, "observed_soda_spill", /datum/mood_event/observed_soda_spill, target, src) + iter_mob.add_mood_event("observed_soda_spill", /datum/mood_event/observed_soda_spill, target, src) playsound(src, 'sound/effects/can_pop.ogg', 80, TRUE) if(!hide_message) diff --git a/code/modules/food_and_drinks/food.dm b/code/modules/food_and_drinks/food.dm index a926cf78d8c..ff84e3df858 100644 --- a/code/modules/food_and_drinks/food.dm +++ b/code/modules/food_and_drinks/food.dm @@ -35,19 +35,19 @@ if(foodtype & H.dna.species.toxic_food) to_chat(H,span_warning("What the hell was that thing?!")) H.adjust_disgust(25 + 30 * fraction) - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "toxic_food", /datum/mood_event/disgusting_food) + H.add_mood_event("toxic_food", /datum/mood_event/disgusting_food) else if(foodtype & H.dna.species.disliked_food) to_chat(H,span_notice("That didn't taste very good...")) H.adjust_disgust(11 + 15 * fraction) - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "gross_food", /datum/mood_event/gross_food) + H.add_mood_event("gross_food", /datum/mood_event/gross_food) else if(foodtype & H.dna.species.liked_food) to_chat(H,span_notice("I love this taste!")) H.adjust_disgust(-5 + -2.5 * fraction) - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "fav_food", /datum/mood_event/favorite_food) + H.add_mood_event("fav_food", /datum/mood_event/favorite_food) else if(foodtype & H.dna.species.toxic_food) to_chat(H, span_warning("You don't feel so good...")) H.adjust_disgust(25 + 30 * fraction) if((foodtype & BREAKFAST) && world.time - SSticker.round_start_time < STOP_SERVING_BREAKFAST) - SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "breakfast", /datum/mood_event/breakfast) + H.add_mood_event("breakfast", /datum/mood_event/breakfast) last_check_time = world.time diff --git a/code/modules/hydroponics/grown/melon.dm b/code/modules/hydroponics/grown/melon.dm index 20b6d934fd7..3db63b8ea49 100644 --- a/code/modules/hydroponics/grown/melon.dm +++ b/code/modules/hydroponics/grown/melon.dm @@ -91,7 +91,7 @@ if(!holy_person.mind?.holy_role || HAS_TRAIT(holy_person, TRAIT_AGEUSIA)) return to_chat(holy_person, span_notice("Truly, a piece of heaven!")) - SEND_SIGNAL(holy_person, COMSIG_ADD_MOOD_EVENT, "Divine_chew", /datum/mood_event/holy_consumption) + holy_person.add_mood_event("Divine_chew", /datum/mood_event/holy_consumption) return FOOD_LIKED /// Barrel melon Seeds diff --git a/code/modules/library/book.dm b/code/modules/library/book.dm index 26febb11b49..a33f28b4238 100644 --- a/code/modules/library/book.dm +++ b/code/modules/library/book.dm @@ -110,7 +110,7 @@ . = ..() book_data = new(starting_title, starting_author, starting_content) -/obj/item/book/proc/on_read(mob/user) +/obj/item/book/proc/on_read(mob/living/user) if(book_data?.content) user << browse("Penned by [book_data.author].
" + "[book_data.content]", "window=book[window_size != null ? ";size=[window_size]" : ""]") @@ -118,7 +118,7 @@ var/has_not_read_book = isnull(user.mind?.book_titles_read[starting_title]) if(has_not_read_book) // any new books give bonus mood - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "book_nerd", /datum/mood_event/book_nerd) + user.add_mood_event("book_nerd", /datum/mood_event/book_nerd) user.mind?.book_titles_read[starting_title] = TRUE onclose(user, "book") else diff --git a/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm b/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm index 935d6da103a..b93ca064978 100644 --- a/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm +++ b/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm @@ -180,7 +180,7 @@ locked = TRUE dump_contents() update_appearance() - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "graverobbing", /datum/mood_event/graverobbing) + user.add_mood_event("graverobbing", /datum/mood_event/graverobbing) if(lead_tomb == TRUE && first_open == TRUE) user.gain_trauma(/datum/brain_trauma/magic/stalker) to_chat(user, span_boldwarning("Oh no, no no no, THEY'RE EVERYWHERE! EVERY ONE OF THEM IS EVERYWHERE!")) @@ -199,7 +199,7 @@ to_chat(user, span_notice("You start to remove \the [src] with \the [S].")) if (do_after(user,15, target = src)) to_chat(user, span_notice("You remove \the [src] completely.")) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "graverobbing", /datum/mood_event/graverobbing) + user.add_mood_event("graverobbing", /datum/mood_event/graverobbing) deconstruct(TRUE) return 1 return diff --git a/code/modules/mapfluff/ruins/objects_and_mobs/ash_walker_den.dm b/code/modules/mapfluff/ruins/objects_and_mobs/ash_walker_den.dm index 19ef76824df..1f5f207b418 100644 --- a/code/modules/mapfluff/ruins/objects_and_mobs/ash_walker_den.dm +++ b/code/modules/mapfluff/ruins/objects_and_mobs/ash_walker_den.dm @@ -86,9 +86,9 @@ atom_integrity = min(atom_integrity + max_integrity*0.05,max_integrity)//restores 5% hp of tendril for(var/mob/living/L in view(src, 5)) if(L.mind?.has_antag_datum(/datum/antagonist/ashwalker)) - SEND_SIGNAL(L, COMSIG_ADD_MOOD_EVENT, "oogabooga", /datum/mood_event/sacrifice_good) + L.add_mood_event("oogabooga", /datum/mood_event/sacrifice_good) else - SEND_SIGNAL(L, COMSIG_ADD_MOOD_EVENT, "oogabooga", /datum/mood_event/sacrifice_bad) + L.add_mood_event("oogabooga", /datum/mood_event/sacrifice_bad) /obj/structure/lavaland/ash_walker/proc/remake_walker(datum/mind/oldmind, oldname) var/mob/living/carbon/human/M = new /mob/living/carbon/human(get_step(loc, pick(GLOB.alldirs))) diff --git a/code/modules/mining/equipment/regenerative_core.dm b/code/modules/mining/equipment/regenerative_core.dm index 11688cb2de3..80c8124d2bf 100644 --- a/code/modules/mining/equipment/regenerative_core.dm +++ b/code/modules/mining/equipment/regenerative_core.dm @@ -88,7 +88,7 @@ to_chat(user, span_notice("You start to smear [src] on yourself. Disgusting tendrils hold you together and allow you to keep moving, but for how long?")) SSblackbox.record_feedback("nested tally", "hivelord_core", 1, list("[type]", "used", "self")) target_human.apply_status_effect(/datum/status_effect/regenerative_core) - SEND_SIGNAL(target_human, COMSIG_ADD_MOOD_EVENT, "core", /datum/mood_event/healsbadman) //Now THIS is a miner buff (fixed - nerf) + target_human.add_mood_event("core", /datum/mood_event/healsbadman) //Now THIS is a miner buff (fixed - nerf) qdel(src) /obj/item/organ/internal/regenerative_core/afterattack(atom/target, mob/user, proximity_flag) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index b0b1ae9d403..523c2ec3116 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -435,13 +435,13 @@ if(message) visible_message(span_danger("[src] throws up all over [p_them()]self!"), \ span_userdanger("You throw up all over yourself!")) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "vomit", /datum/mood_event/vomitself) + add_mood_event("vomit", /datum/mood_event/vomitself) distance = 0 else if(message) visible_message(span_danger("[src] throws up!"), span_userdanger("You throw up!")) if(!isflyperson(src)) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "vomit", /datum/mood_event/vomit) + add_mood_event("vomit", /datum/mood_event/vomit) if(stun) Paralyze(80) @@ -834,10 +834,10 @@ drop_all_held_items() stop_pulling() throw_alert(ALERT_HANDCUFFED, /atom/movable/screen/alert/restrained/handcuffed, new_master = src.handcuffed) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "handcuffed", /datum/mood_event/handcuffed) + add_mood_event("handcuffed", /datum/mood_event/handcuffed) else clear_alert(ALERT_HANDCUFFED) - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "handcuffed") + 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() @@ -1137,10 +1137,8 @@ return TRUE if(HAS_TRAIT(src, TRAIT_DUMB)) return TRUE - var/datum/component/mood/mood = src.GetComponent(/datum/component/mood) - if(mood) - if(mood.sanity < SANITY_UNSTABLE) - return TRUE + if(mob_mood.sanity < SANITY_UNSTABLE) + return TRUE /mob/living/carbon/wash(clean_types) . = ..() diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 48b527a4b8c..e6caffc8288 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -435,7 +435,7 @@ if(HAS_TRAIT(src, TRAIT_BADTOUCH)) //How dare they! to_chat(helper, span_warning("[src] makes a grumbling noise as you pull on [p_their()] tail.")) else - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "tailpulled", /datum/mood_event/tailpulled) + add_mood_event("tailpulled", /datum/mood_event/tailpulled) else helper.visible_message(span_notice("[helper] hugs [src] to make [p_them()] feel better!"), \ @@ -450,10 +450,10 @@ if(!HAS_TRAIT(src, TRAIT_BADTOUCH)) if(bodytemperature > helper.bodytemperature) if(!HAS_TRAIT(helper, TRAIT_BADTOUCH)) - SEND_SIGNAL(helper, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/warmhug, src) // Hugger got a warm hug (Unless they hate hugs) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/hug) // Reciver always gets a mood for being hugged + helper.add_mood_event("hug", /datum/mood_event/warmhug, src) // Hugger got a warm hug (Unless they hate hugs) + add_mood_event("hug", /datum/mood_event/hug) // Receiver always gets a mood for being hugged else - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/warmhug, helper) // You got a warm hug + add_mood_event("hug", /datum/mood_event/warmhug, helper) // You got a warm hug // Let people know if they hugged someone really warm or really cold if(helper.bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT) @@ -467,12 +467,11 @@ to_chat(helper, span_warning("It feels like [src] is freezing as you hug [p_them()].")) if(HAS_TRAIT(helper, TRAIT_FRIENDLY)) - var/datum/component/mood/hugger_mood = helper.GetComponent(/datum/component/mood) - if (hugger_mood.sanity >= SANITY_GREAT) + if (helper.mob_mood.sanity >= SANITY_GREAT) new /obj/effect/temp_visual/heart(loc) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "friendly_hug", /datum/mood_event/besthug, helper) - else if (hugger_mood.sanity >= SANITY_DISTURBED) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "friendly_hug", /datum/mood_event/betterhug, helper) + add_mood_event("friendly_hug", /datum/mood_event/besthug, helper) + else if (helper.mob_mood.sanity >= SANITY_DISTURBED) + add_mood_event("friendly_hug", /datum/mood_event/betterhug, helper) if(HAS_TRAIT(src, TRAIT_BADTOUCH)) to_chat(helper, span_warning("[src] looks visibly upset as you hug [p_them()].")) diff --git a/code/modules/mob/living/carbon/examine.dm b/code/modules/mob/living/carbon/examine.dm index 7875f8560dd..d30fa439ffb 100644 --- a/code/modules/mob/living/carbon/examine.dm +++ b/code/modules/mob/living/carbon/examine.dm @@ -135,20 +135,19 @@ if (!isnull(trait_exam)) . += trait_exam - var/datum/component/mood/mood = src.GetComponent(/datum/component/mood) - if(mood) - switch(mood.shown_mood) - if(-INFINITY to MOOD_LEVEL_SAD4) + if(mob_mood) + switch(mob_mood.shown_mood) + if(-INFINITY to MOOD_SAD4) . += "[t_He] look[p_s()] depressed." - if(MOOD_LEVEL_SAD4 to MOOD_LEVEL_SAD3) + if(MOOD_SAD4 to MOOD_SAD3) . += "[t_He] look[p_s()] very sad." - if(MOOD_LEVEL_SAD3 to MOOD_LEVEL_SAD2) + if(MOOD_SAD3 to MOOD_SAD2) . += "[t_He] look[p_s()] a bit down." - if(MOOD_LEVEL_HAPPY2 to MOOD_LEVEL_HAPPY3) + if(MOOD_HAPPY2 to MOOD_HAPPY3) . += "[t_He] look[p_s()] quite happy." - if(MOOD_LEVEL_HAPPY3 to MOOD_LEVEL_HAPPY4) + if(MOOD_HAPPY3 to MOOD_HAPPY4) . += "[t_He] look[p_s()] very happy." - if(MOOD_LEVEL_HAPPY4 to INFINITY) + if(MOOD_HAPPY4 to INFINITY) . += "[t_He] look[p_s()] ecstatic." . += "
" diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index ca9c81a2843..c2e770695bb 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -292,6 +292,7 @@ msg += "[t_He] [t_is]n't responding to anything around [t_him] and seem[p_s()] to be asleep.\n" if(!appears_dead) + var/mob/living/living_user = user if(src != user) if(HAS_TRAIT(user, TRAIT_EMPATH)) if (combat_mode) @@ -300,10 +301,9 @@ msg += "[t_He] seem[p_s()] winded.\n" if (getToxLoss() >= 10) msg += "[t_He] seem[p_s()] sickly.\n" - var/datum/component/mood/mood = src.GetComponent(/datum/component/mood) - if(mood.sanity <= SANITY_DISTURBED) + if(mob_mood.sanity <= SANITY_DISTURBED) msg += "[t_He] seem[p_s()] distressed.\n" - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "empath", /datum/mood_event/sad_empath, src) + living_user.add_mood_event("empath", /datum/mood_event/sad_empath, src) if (is_blind()) msg += "[t_He] appear[p_s()] to be staring off into space.\n" if (HAS_TRAIT(src, TRAIT_DEAF)) @@ -317,7 +317,7 @@ if(HAS_TRAIT(user, TRAIT_SPIRITUAL) && mind?.holy_role) msg += "[t_He] [t_has] a holy aura about [t_him].\n" - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "religious_comfort", /datum/mood_event/religiously_comforted) + living_user.add_mood_event("religious_comfort", /datum/mood_event/religiously_comforted) switch(stat) if(UNCONSCIOUS, HARD_CRIT) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 9417d35e4fe..b30c03a483c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -7,6 +7,8 @@ //initialize limbs first create_bodyparts() + setup_mood() + setup_human_dna() prepare_huds() //Prevents a nasty runtime on human init @@ -31,21 +33,27 @@ AddElement(/datum/element/connect_loc, loc_connections) GLOB.human_list += src +/mob/living/carbon/human/proc/setup_mood() + if (CONFIG_GET(flag/disable_human_mood)) + return + if (isdummy(src)) + return + mob_mood = new /datum/mood(src) + /mob/living/carbon/human/proc/setup_human_dna() //initialize dna. for spawned humans; overwritten by other code create_dna(src) randomize_human(src) dna.initialize_dna() -/mob/living/carbon/human/ComponentInitialize() - . = ..() - if(!CONFIG_GET(flag/disable_human_mood)) - AddComponent(/datum/component/mood) - /mob/living/carbon/human/Destroy() QDEL_NULL(physiology) QDEL_LIST(bioware) GLOB.human_list -= src + + if (mob_mood) + QDEL_NULL(mob_mood) + return ..() /mob/living/carbon/human/ZImpactDamage(turf/T, levels) @@ -532,7 +540,7 @@ return FALSE visible_message(span_notice("[src] performs CPR on [target.name]!"), span_notice("You perform CPR on [target.name].")) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "saved_life", /datum/mood_event/saved_life) + add_mood_event("saved_life", /datum/mood_event/saved_life) log_combat(src, target, "CPRed") if (HAS_TRAIT(target, TRAIT_NOBREATH)) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 0f7e6b261ed..2188c3f4ac2 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -73,9 +73,9 @@ /mob/living/carbon/human/handle_traits(delta_time, times_fired) if (getOrganLoss(ORGAN_SLOT_BRAIN) >= 60) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "brain_damage", /datum/mood_event/brain_damage) + add_mood_event("brain_damage", /datum/mood_event/brain_damage) else - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "brain_damage") + clear_mood_event("brain_damage") return ..() /mob/living/carbon/human/breathe() diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index a74f83ec8d4..3b5b881d07a 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1496,8 +1496,8 @@ GLOBAL_LIST_EMPTY(features_by_species) // Body temperature is too hot, and we do not have resist traits if(bodytemp > bodytemp_heat_damage_limit && !HAS_TRAIT(humi, TRAIT_RESISTHEAT)) // Clear cold mood and apply hot mood - SEND_SIGNAL(humi, COMSIG_CLEAR_MOOD_EVENT, "cold") - SEND_SIGNAL(humi, COMSIG_ADD_MOOD_EVENT, "hot", /datum/mood_event/hot) + humi.clear_mood_event("cold") + humi.add_mood_event("hot", /datum/mood_event/hot) //Remove any slowdown from the cold. humi.remove_movespeed_modifier(/datum/movespeed_modifier/cold) @@ -1513,8 +1513,8 @@ GLOBAL_LIST_EMPTY(features_by_species) // Body temperature is too cold, and we do not have resist traits else if(bodytemp < bodytemp_cold_damage_limit && !HAS_TRAIT(humi, TRAIT_RESISTCOLD)) // clear any hot moods and apply cold mood - SEND_SIGNAL(humi, COMSIG_CLEAR_MOOD_EVENT, "hot") - SEND_SIGNAL(humi, COMSIG_ADD_MOOD_EVENT, "cold", /datum/mood_event/cold) + humi.clear_mood_event("hot") + humi.add_mood_event("cold", /datum/mood_event/cold) // Apply cold slow down humi.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/cold, multiplicative_slowdown = ((bodytemp_cold_damage_limit - humi.bodytemperature) / COLD_SLOWDOWN_FACTOR)) // Display alerts based how cold it is @@ -1532,8 +1532,8 @@ GLOBAL_LIST_EMPTY(features_by_species) else if (old_bodytemp > bodytemp_heat_damage_limit || old_bodytemp < bodytemp_cold_damage_limit) humi.clear_alert(ALERT_TEMPERATURE) humi.remove_movespeed_modifier(/datum/movespeed_modifier/cold) - SEND_SIGNAL(humi, COMSIG_CLEAR_MOOD_EVENT, "cold") - SEND_SIGNAL(humi, COMSIG_CLEAR_MOOD_EVENT, "hot") + humi.clear_mood_event("cold") + humi.clear_mood_event("hot") // Store the old bodytemp for future checking humi.old_bodytemperature = bodytemp @@ -1709,9 +1709,9 @@ GLOBAL_LIST_EMPTY(features_by_species) * former_tail_owner - the mob that was once a species with a tail and now is a different species */ /datum/species/proc/clear_tail_moodlets(mob/living/carbon/human/former_tail_owner) - SEND_SIGNAL(former_tail_owner, COMSIG_CLEAR_MOOD_EVENT, "tail_lost") - SEND_SIGNAL(former_tail_owner, COMSIG_CLEAR_MOOD_EVENT, "tail_balance_lost") - SEND_SIGNAL(former_tail_owner, COMSIG_CLEAR_MOOD_EVENT, "wrong_tail_regained") + former_tail_owner.clear_mood_event("tail_lost") + former_tail_owner.clear_mood_event("tail_balance_lost") + former_tail_owner.clear_mood_event("wrong_tail_regained") /////////////// //FLIGHT SHIT// diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index a4bbd4d9eba..d568d1ef9d2 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -1040,13 +1040,13 @@ M.soundbang_act(1, 0, 30, 3) M.adjust_timed_status_effect(10 SECONDS, /datum/status_effect/confusion) M.adjust_timed_status_effect(8 SECONDS, /datum/status_effect/jitter) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "gonged", /datum/mood_event/loud_gong) + M.add_mood_event("gonged", /datum/mood_event/loud_gong) if(2 to 3) M.show_message(span_cult("GONG!"), MSG_AUDIBLE) M.playsound_local(H, 'sound/effects/gong.ogg', 75, TRUE) M.soundbang_act(1, 0, 15, 2) M.adjust_timed_status_effect(6 SECONDS, /datum/status_effect/jitter) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "gonged", /datum/mood_event/loud_gong) + M.add_mood_event("gonged", /datum/mood_event/loud_gong) else M.show_message(span_warning("GONG!"), MSG_AUDIBLE) M.playsound_local(H, 'sound/effects/gong.ogg', 50, TRUE) @@ -1298,7 +1298,7 @@ to_chat(L, span_cultlarge("A spine-chilling sound chills you to the bone!")) L.apply_status_effect(/datum/status_effect/bonechill) - SEND_SIGNAL(L, COMSIG_ADD_MOOD_EVENT, "spooked", /datum/mood_event/spooked) + L.add_mood_event("spooked", /datum/mood_event/spooked) /datum/species/golem/snow name = "Snow Golem" diff --git a/code/modules/mob/living/carbon/init_signals.dm b/code/modules/mob/living/carbon/init_signals.dm index 2ee2988df7e..e1b83bfe3c1 100644 --- a/code/modules/mob/living/carbon/init_signals.dm +++ b/code/modules/mob/living/carbon/init_signals.dm @@ -27,9 +27,9 @@ clear_alert(ALERT_TOO_MUCH_CO2) clear_alert(ALERT_NOT_ENOUGH_CO2) - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria") - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "smell") - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "suffocation") + clear_mood_event("chemical_euphoria") + clear_mood_event("smell") + clear_mood_event("suffocation") /** * On gain of TRAIT_NOMETABOLISM * diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 01ea68de9be..53f3b3d8070 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -60,9 +60,9 @@ if((times_fired % next_breath) == 0 || failed_last_breath) breathe(delta_time, times_fired) //Breathe per 4 ticks if healthy, down to 2 if our lungs or heart are damaged, unless suffocating if(failed_last_breath) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "suffocation", /datum/mood_event/suffocation) + add_mood_event("suffocation", /datum/mood_event/suffocation) else - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "suffocation") + clear_mood_event("suffocation") else if(istype(loc, /obj/)) var/obj/location_as_object = loc @@ -219,7 +219,7 @@ var/SA_partialpressure = (breath_gases[/datum/gas/nitrous_oxide][MOLES]/breath.total_moles())*breath_pressure if(SA_partialpressure > SA_para_min) throw_alert(ALERT_TOO_MUCH_N2O, /atom/movable/screen/alert/too_much_n2o) - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria") + clear_mood_event("chemical_euphoria") Unconscious(60) if(SA_partialpressure > SA_sleep_min) Sleeping(max(AmountSleeping() + 40, 200)) @@ -227,12 +227,12 @@ clear_alert(ALERT_TOO_MUCH_N2O) if(prob(20)) emote(pick("giggle","laugh")) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "chemical_euphoria", /datum/mood_event/chemical_euphoria) + add_mood_event("chemical_euphoria", /datum/mood_event/chemical_euphoria) else - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria") + clear_mood_event("chemical_euphoria") clear_alert(ALERT_TOO_MUCH_N2O) else - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria") + clear_mood_event("chemical_euphoria") clear_alert(ALERT_TOO_MUCH_N2O) //BZ (Facepunch port of their Agent B) @@ -269,32 +269,32 @@ switch(miasma_partialpressure) if(0.25 to 5) // At lower pp, give out a little warning - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "smell") + clear_mood_event("smell") if(prob(5)) to_chat(src, span_notice("There is an unpleasant smell in the air.")) if(5 to 20) //At somewhat higher pp, warning becomes more obvious if(prob(15)) to_chat(src, span_warning("You smell something horribly decayed inside this room.")) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "smell", /datum/mood_event/disgust/bad_smell) + add_mood_event("smell", /datum/mood_event/disgust/bad_smell) if(15 to 30) //Small chance to vomit. By now, people have internals on anyway if(prob(5)) to_chat(src, span_warning("The stench of rotting carcasses is unbearable!")) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "smell", /datum/mood_event/disgust/nauseating_stench) + add_mood_event("smell", /datum/mood_event/disgust/nauseating_stench) vomit() if(30 to INFINITY) //Higher chance to vomit. Let the horror start if(prob(25)) to_chat(src, span_warning("The stench of rotting carcasses is unbearable!")) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "smell", /datum/mood_event/disgust/nauseating_stench) + add_mood_event("smell", /datum/mood_event/disgust/nauseating_stench) vomit() else - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "smell") + clear_mood_event("smell") //Clear all moods if no miasma at all else - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "smell") + clear_mood_event("smell") breath.garbage_collect() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index e28f9aaf6d2..82596cd8fdc 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1722,6 +1722,8 @@ GLOBAL_LIST_EMPTY(fire_appearances) . = ..() VV_DROPDOWN_OPTION("", "---------") VV_DROPDOWN_OPTION(VV_HK_GIVE_SPEECH_IMPEDIMENT, "Impede Speech (Slurring, stuttering, etc)") + VV_DROPDOWN_OPTION(VV_HK_ADD_MOOD, "Add Mood Event") + VV_DROPDOWN_OPTION(VV_HK_REMOVE_MOOD, "Remove Mood Event") /mob/living/vv_do_topic(list/href_list) . = ..() @@ -1730,6 +1732,10 @@ GLOBAL_LIST_EMPTY(fire_appearances) if(!check_rights(NONE)) return admin_give_speech_impediment(usr) + if (href_list[VV_HK_ADD_MOOD]) + admin_add_mood_event(usr) + if (href_list[VV_HK_REMOVE_MOOD]) + admin_remove_mood_event(usr) /mob/living/proc/move_to_error_room() var/obj/effect/landmark/error/error_landmark = locate(/obj/effect/landmark/error) in GLOB.landmarks_list @@ -2272,3 +2278,47 @@ GLOBAL_LIST_EMPTY(fire_appearances) return adjust_timed_status_effect(duration SECONDS, impediments[chosen]) + +/mob/living/proc/admin_add_mood_event(mob/admin) + if (!admin || !check_rights(NONE)) + return + + var/list/mood_events = typesof(/datum/mood_event) + + var/chosen = tgui_input_list(admin, "What mood event?", "Add Mood Event", mood_events) + if (!chosen || QDELETED(src) || !check_rights(NONE)) + return + + mob_mood.add_mood_event("[rand(1, 50)]", chosen) + +/mob/living/proc/admin_remove_mood_event(mob/admin) + if (!admin || !check_rights(NONE)) + return + + var/list/mood_events = list() + for (var/category in mob_mood.mood_events) + var/datum/mood_event/event = mob_mood.mood_events[category] + mood_events[event] = category + + + var/datum/mood_event/chosen = tgui_input_list(admin, "What mood event?", "Remove Mood Event", mood_events) + if (!chosen || QDELETED(src) || !check_rights(NONE)) + return + + mob_mood.clear_mood_event(mood_events[chosen]) + +/// Adds a mood event to the mob +/mob/living/proc/add_mood_event(category, type, ...) + if (!mob_mood) + return + mob_mood.add_mood_event(arglist(args)) + +/// Clears a mood event from the mob +/mob/living/proc/clear_mood_event(category) + if (!mob_mood) + return + mob_mood.clear_mood_event(category) + +/mob/living/played_game() + . = ..() + add_mood_event("gaming", /datum/mood_event/gaming) diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 9700668207e..c4c696df39f 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -212,3 +212,6 @@ var/list/fov_traits ///what multiplicative slowdown we get from turfs currently. var/current_turf_slowdown = 0 + + /// Living mob's mood datum + var/datum/mood/mob_mood diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm index 587d3410cb3..530b2619221 100644 --- a/code/modules/mob/living/silicon/silicon_defense.dm +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -77,7 +77,7 @@ visible_message(span_notice("[user] pets [src]."), \ span_notice("[user] pets you."), null, null, user) to_chat(user, span_notice("You pet [src].")) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT_RND, "pet_borg", /datum/mood_event/pet_borg) + user.add_mood_event("pet_borg", /datum/mood_event/pet_borg) /mob/living/silicon/attack_drone(mob/living/simple_animal/drone/M) diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index e8994c97748..6a0c8650b1c 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -392,7 +392,7 @@ GLOBAL_LIST_INIT(strippable_corgi_items, create_strippable_list(list( //Many hats added, Some will probably be removed, just want to see which ones are popular. // > some will probably be removed -/mob/living/simple_animal/pet/dog/corgi/proc/place_on_head(obj/item/item_to_add, mob/user) +/mob/living/simple_animal/pet/dog/corgi/proc/place_on_head(obj/item/item_to_add, mob/living/user) if(inventory_head) if(user) to_chat(user, span_warning("You can't put more than one hat on [src]!")) @@ -401,7 +401,7 @@ GLOBAL_LIST_INIT(strippable_corgi_items, create_strippable_list(list( user.visible_message(span_notice("[user] pets [src]."), span_notice("You rest your hand on [src]'s head for a moment.")) if(flags_1 & HOLOGRAM_1) return - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, src, /datum/mood_event/pet_animal, src) + user.add_mood_event(REF(src), /datum/mood_event/pet_animal, src) return if(user && !user.temporarilyRemoveItemFromInventory(item_to_add)) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/pandora.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/pandora.dm index f28e918f38e..2d1b4486214 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/pandora.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/pandora.dm @@ -187,9 +187,9 @@ /obj/item/clothing/accessory/pandora_hope/on_uniform_equip(obj/item/clothing/under/U, user) var/mob/living/L = user if(L?.mind) - SEND_SIGNAL(L, COMSIG_ADD_MOOD_EVENT, "hope_lavaland", /datum/mood_event/hope_lavaland) + L.add_mood_event("hope_lavaland", /datum/mood_event/hope_lavaland) /obj/item/clothing/accessory/pandora_hope/on_uniform_dropped(obj/item/clothing/under/U, user) var/mob/living/L = user if(L?.mind) - SEND_SIGNAL(L, COMSIG_CLEAR_MOOD_EVENT, "hope_lavaland") + L.clear_mood_event("hope_lavaland") diff --git a/code/modules/mob/mob_arcade.dm b/code/modules/mob/mob_arcade.dm index 93092bd09a7..0026ecaae0c 100644 --- a/code/modules/mob/mob_arcade.dm +++ b/code/modules/mob/mob_arcade.dm @@ -1,6 +1,6 @@ /** * This proc sends the COMSIG_MOB_WON_VIDEOGAME signal - * + * * This should be called by games when the gamer reaches a winning state */ /mob/proc/won_game() @@ -8,7 +8,7 @@ /** * This proc sends the COMSIG_MOB_LOST_VIDEOGAME signal - * + * * This should be called by games when the gamer reaches a losing state */ /mob/proc/lost_game() @@ -16,9 +16,8 @@ /** * This proc sends the COMSIG_MOB_PLAYED_VIDEOGAME signal - * + * * This should be called by games whenever the gamer interacts with the device */ /mob/proc/played_game() - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "gaming", /datum/mood_event/gaming) SEND_SIGNAL(src, COMSIG_MOB_PLAYED_VIDEOGAME) diff --git a/code/modules/mod/modules/modules_service.dm b/code/modules/mod/modules/modules_service.dm index 210472cfb4a..8e3c81787ea 100644 --- a/code/modules/mod/modules/modules_service.dm +++ b/code/modules/mod/modules/modules_service.dm @@ -72,11 +72,11 @@ mod.boots.AddComponent(/datum/component/squeak, list('sound/effects/clownstep1.ogg'=1,'sound/effects/clownstep2.ogg'=1), 50, falloff_exponent = 20) //die off quick please mod.wearer.AddElement(/datum/element/waddling) if(is_clown_job(mod.wearer.mind?.assigned_role)) - SEND_SIGNAL(mod.wearer, COMSIG_ADD_MOOD_EVENT, "clownshoes", /datum/mood_event/clownshoes) + mod.wearer.add_mood_event("clownshoes", /datum/mood_event/clownshoes) /obj/item/mod/module/waddle/on_suit_deactivation(deleting = FALSE) if(!deleting) qdel(mod.boots.GetComponent(/datum/component/squeak)) mod.wearer.RemoveElement(/datum/element/waddling) if(is_clown_job(mod.wearer.mind?.assigned_role)) - SEND_SIGNAL(mod.wearer, COMSIG_CLEAR_MOOD_EVENT, "clownshoes") + mod.wearer.clear_mood_event("clownshoes") diff --git a/code/modules/power/supermatter/supermatter_delamination/delamination_effects.dm b/code/modules/power/supermatter/supermatter_delamination/delamination_effects.dm index c6e4413c2ab..396afc48218 100644 --- a/code/modules/power/supermatter/supermatter_delamination/delamination_effects.dm +++ b/code/modules/power/supermatter/supermatter_delamination/delamination_effects.dm @@ -33,7 +33,9 @@ to_chat(victim, span_boldannounce("You hold onto \the [victim.loc] as hard as you can, as reality distorts around you. You feel safe.")) continue to_chat(victim, span_boldannounce("You feel reality distort for a moment...")) - SEND_SIGNAL(victim, COMSIG_ADD_MOOD_EVENT, "delam", /datum/mood_event/delam) + if (isliving(victim)) + var/mob/living/living_victim = victim + living_victim.add_mood_event("delam", /datum/mood_event/delam) return TRUE /// Spawns anomalies all over the station. Half instantly, the other half over time. @@ -48,7 +50,7 @@ for(var/i in 1 to anomalies) var/anomaly_to_spawn = pick_weight(anomaly_types) var/anomaly_location = pick_n_take(anomaly_places) - + if(i < cutoff_point) supermatter_anomaly_gen(anomaly_location, anomaly_to_spawn, has_changed_lifespan = FALSE) continue @@ -143,8 +145,9 @@ /datum/sm_delam/proc/effect_cascade_demoralize() for(var/mob/player as anything in GLOB.player_list) if(!isdead(player)) + var/mob/living/living_player = player to_chat(player, span_boldannounce("Everything around you is resonating with a powerful energy. This can't be good.")) - SEND_SIGNAL(player, COMSIG_ADD_MOOD_EVENT, "cascade", /datum/mood_event/cascade) + living_player.add_mood_event("cascade", /datum/mood_event/cascade) SEND_SOUND(player, 'sound/magic/charge.ogg') /datum/sm_delam/proc/effect_emergency_state() @@ -178,7 +181,7 @@ Rapid expansion of crystal mass proportional to rising gravitational force. \ Matter collapse due to gravitational pull foreseeable.", "Nanotrasen Star Observation Association") - + sleep(25 SECONDS) priority_announce("[Gibberish("All attempts at evacuation have now ceased, and all assets have been retrieved from your sector.\n \ @@ -194,7 +197,7 @@ minor_announce(shuttle_msg, "Emergency Shuttle", TRUE) SSshuttle.emergency.setTimer(15 SECONDS) return - + sleep(10 SECONDS) SSticker.news_report = SUPERMATTER_CASCADE diff --git a/code/modules/projectiles/guns/ballistic/revolver.dm b/code/modules/projectiles/guns/ballistic/revolver.dm index e8ca9e8cc4a..eca3bf8dcda 100644 --- a/code/modules/projectiles/guns/ballistic/revolver.dm +++ b/code/modules/projectiles/guns/ballistic/revolver.dm @@ -232,11 +232,11 @@ else user.visible_message(span_danger("[user.name] cowardly fires [src] at [user.p_their()] [affecting.name]!"), span_userdanger("You cowardly fire [src] at your [affecting.name]!"), span_hear("You hear a gunshot!")) chambered = null - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "russian_roulette_lose", /datum/mood_event/russian_roulette_lose) + user.add_mood_event("russian_roulette_lose", /datum/mood_event/russian_roulette_lose) return if(loaded_rounds && is_target_face) - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "russian_roulette_win", /datum/mood_event/russian_roulette_win, loaded_rounds) + user.add_mood_event("russian_roulette_win", /datum/mood_event/russian_roulette_win, loaded_rounds) user.visible_message(span_danger("*click*")) playsound(src, dry_fire_sound, 30, TRUE) diff --git a/code/modules/projectiles/projectile/energy/stun.dm b/code/modules/projectiles/projectile/energy/stun.dm index 662c08d748c..ff4e1156251 100644 --- a/code/modules/projectiles/projectile/energy/stun.dm +++ b/code/modules/projectiles/projectile/energy/stun.dm @@ -18,7 +18,7 @@ do_sparks(1, TRUE, src) else if(iscarbon(target)) var/mob/living/carbon/C = target - SEND_SIGNAL(C, COMSIG_ADD_MOOD_EVENT, "tased", /datum/mood_event/tased) + C.add_mood_event("tased", /datum/mood_event/tased) SEND_SIGNAL(C, COMSIG_LIVING_MINOR_SHOCK) if(C.dna && C.dna.check_mutation(/datum/mutation/human/hulk)) C.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ), forced = "hulk") diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 848e0cd323c..59133cf091d 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -369,7 +369,7 @@ /obj/projectile/magic/sapping/on_hit(mob/living/target) . = ..() if(isliving(target)) - SEND_SIGNAL(target, COMSIG_ADD_MOOD_EVENT, REF(src), /datum/mood_event/sapped) + target.add_mood_event(REF(src), /datum/mood_event/sapped) /obj/projectile/magic/necropotence name = "bolt of necropotence" diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 13148f4eb82..6fac846bb1b 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -170,7 +170,7 @@ Primarily used in reagents/reaction_agents /// Called when this reagent is removed while inside a mob /datum/reagent/proc/on_mob_delete(mob/living/L) - SEND_SIGNAL(L, COMSIG_CLEAR_MOOD_EVENT, "[type]_overdose") + L.clear_mood_event("[type]_overdose") return /// Called when this reagent first starts being metabolized by a liver @@ -214,7 +214,7 @@ Primarily used in reagents/reaction_agents /// Called when an overdose starts /datum/reagent/proc/overdose_start(mob/living/M) to_chat(M, span_userdanger("You feel like you took too much of [name]!")) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "[type]_overdose", /datum/mood_event/overdose, name) + M.add_mood_event("[type]_overdose", /datum/mood_event/overdose, name) return /** diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index df8662b695e..f4b73379d73 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -2650,7 +2650,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/drunken_espatier/on_mob_life(mob/living/carbon/drinker, delta_time, times_fired) drinker.hal_screwyhud = SCREWYHUD_HEALTHY //almost makes you forget how much it hurts - SEND_SIGNAL(drinker, COMSIG_ADD_MOOD_EVENT, "numb", /datum/mood_event/narcotic_medium, name) //comfortably numb + drinker.add_mood_event("numb", /datum/mood_event/narcotic_medium, name) //comfortably numb ..() /datum/reagent/consumable/ethanol/protein_blend @@ -2700,7 +2700,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/triumphal_arch/on_mob_life(mob/living/carbon/drinker, delta_time, times_fired) if(islizard(drinker)) - SEND_SIGNAL(drinker, COMSIG_ADD_MOOD_EVENT, "triumph", /datum/mood_event/memories_of_home, name) + drinker.add_mood_event("triumph", /datum/mood_event/memories_of_home, name) ..() /datum/reagent/consumable/ethanol/the_juice diff --git a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm index c811a835e4d..42c63b82fd6 100644 --- a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm @@ -476,7 +476,7 @@ carbies.adjustToxLoss((harmies+burnies)*(0.5 + (0.25*(1-creation_purity)))) //0.5 - 0.75 if(show_message) to_chat(carbies, span_danger("You feel your burns and bruises healing! It stings like hell!")) - SEND_SIGNAL(carbies, COMSIG_ADD_MOOD_EVENT, "painful_medicine", /datum/mood_event/painful_medicine) + carbies.add_mood_event("painful_medicine", /datum/mood_event/painful_medicine) if(HAS_TRAIT_FROM(exposed_mob, TRAIT_HUSK, BURN) && carbies.getFireLoss() < UNHUSK_DAMAGE_THRESHOLD && (carbies.reagents.get_reagent_amount(/datum/reagent/medicine/c2/synthflesh) + reac_volume >= SYNTHFLESH_UNHUSK_AMOUNT)) carbies.cure_husk(BURN) carbies.visible_message("A rubbery liquid coats [carbies]'s burns. [carbies] looks a lot healthier!") //we're avoiding using the phrases "burnt flesh" and "burnt skin" here because carbies could be a skeleton or a golem or something diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index 3350f7e1db4..51e5d8bdf88 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -175,7 +175,7 @@ /datum/reagent/consumable/laughter/on_mob_life(mob/living/carbon/M, delta_time, times_fired) M.emote("laugh") - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "chemical_laughter", /datum/mood_event/chemical_laughter) + M.add_mood_event("chemical_laughter", /datum/mood_event/chemical_laughter) ..() /datum/reagent/consumable/superlaughter @@ -190,7 +190,7 @@ if(DT_PROB(16, delta_time)) M.visible_message(span_danger("[M] bursts out into a fit of uncontrollable laughter!"), span_userdanger("You burst out in a fit of uncontrollable laughter!")) M.Stun(5) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "chemical_laughter", /datum/mood_event/chemical_superlaughter) + M.add_mood_event("chemical_laughter", /datum/mood_event/chemical_superlaughter) ..() /datum/reagent/consumable/potato_juice diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index f75a7171347..27bd1c0a609 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -6,7 +6,7 @@ /datum/reagent/drug/on_mob_end_metabolize(mob/living/M) if(trippy) - SEND_SIGNAL(M, COMSIG_CLEAR_MOOD_EVENT, "[type]_high") + M.clear_mood_event("[type]_high") /datum/reagent/drug/space_drugs name = "Space Drugs" @@ -27,7 +27,7 @@ /datum/reagent/drug/space_drugs/overdose_start(mob/living/M) to_chat(M, span_userdanger("You start tripping hard!")) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "[type]_overdose", /datum/mood_event/overdose, name) + M.add_mood_event("[type]_overdose", /datum/mood_event/overdose, name) /datum/reagent/drug/space_drugs/overdose_process(mob/living/M, delta_time, times_fired) if(M.hallucination < volume && DT_PROB(10, delta_time)) @@ -83,7 +83,7 @@ if(DT_PROB(0.5, delta_time)) var/smoke_message = pick("You feel relaxed.", "You feel calmed.","You feel alert.","You feel rugged.") to_chat(M, span_notice("[smoke_message]")) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "smoked", /datum/mood_event/smoked, name) + M.add_mood_event("smoked", /datum/mood_event/smoked, name) M.remove_status_effect(/datum/status_effect/jitter) M.AdjustStun(-50 * REM * delta_time) M.AdjustKnockdown(-50 * REM * delta_time) @@ -114,7 +114,7 @@ var/high_message = pick("You feel calm.", "You feel collected.", "You feel like you need to relax.") if(DT_PROB(2.5, delta_time)) to_chat(M, span_notice("[high_message]")) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "smacked out", /datum/mood_event/narcotic_heavy, name) + M.add_mood_event("smacked out", /datum/mood_event/narcotic_heavy, name) if(current_cycle == 35 && creation_purity <= 0.6) if(!istype(M.dna.species, /datum/species/human/krokodil_addict)) to_chat(M, span_userdanger("Your skin falls off easily!")) @@ -157,7 +157,7 @@ var/high_message = pick("You feel hyper.", "You feel like you need to go faster.", "You feel like you can run the world.") if(DT_PROB(2.5, delta_time)) to_chat(M, span_notice("[high_message]")) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "tweaking", /datum/mood_event/stimulant_medium, name) + M.add_mood_event("tweaking", /datum/mood_event/stimulant_medium, name) M.AdjustStun(-40 * REM * delta_time) M.AdjustKnockdown(-40 * REM * delta_time) M.AdjustUnconscious(-40 * REM * delta_time) @@ -217,7 +217,7 @@ var/high_message = pick("You feel amped up.", "You feel ready.", "You feel like you can push it to the limit.") if(DT_PROB(2.5, delta_time)) to_chat(M, span_notice("[high_message]")) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "salted", /datum/mood_event/stimulant_heavy, name) + M.add_mood_event("salted", /datum/mood_event/stimulant_heavy, name) M.adjustStaminaLoss(-5 * REM * delta_time, 0) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 4 * REM * delta_time) M.hallucination += 5 * REM * delta_time @@ -271,11 +271,11 @@ /datum/reagent/drug/happiness/on_mob_metabolize(mob/living/L) ..() ADD_TRAIT(L, TRAIT_FEARLESS, type) - SEND_SIGNAL(L, COMSIG_ADD_MOOD_EVENT, "happiness_drug", /datum/mood_event/happiness_drug) + L.add_mood_event("happiness_drug", /datum/mood_event/happiness_drug) /datum/reagent/drug/happiness/on_mob_delete(mob/living/L) REMOVE_TRAIT(L, TRAIT_FEARLESS, type) - SEND_SIGNAL(L, COMSIG_CLEAR_MOOD_EVENT, "happiness_drug") + L.clear_mood_event("happiness_drug") ..() /datum/reagent/drug/happiness/on_mob_life(mob/living/carbon/M, delta_time, times_fired) @@ -292,13 +292,13 @@ switch(reaction) if(1) M.emote("laugh") - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "happiness_drug", /datum/mood_event/happiness_drug_good_od) + M.add_mood_event("happiness_drug", /datum/mood_event/happiness_drug_good_od) if(2) M.emote("sway") M.set_timed_status_effect(50 SECONDS, /datum/status_effect/dizziness, only_if_higher = TRUE) if(3) M.emote("frown") - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "happiness_drug", /datum/mood_event/happiness_drug_bad_od) + M.add_mood_event("happiness_drug", /datum/mood_event/happiness_drug_bad_od) M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.5 * REM * delta_time) ..() . = TRUE @@ -468,7 +468,7 @@ /datum/reagent/drug/mushroomhallucinogen/on_mob_metabolize(mob/living/psychonaut) . = ..() - SEND_SIGNAL(psychonaut, COMSIG_ADD_MOOD_EVENT, "tripping", /datum/mood_event/high, name) + psychonaut.add_mood_event("tripping", /datum/mood_event/high, name) if(!psychonaut.hud_used) return @@ -494,7 +494,7 @@ /datum/reagent/drug/mushroomhallucinogen/on_mob_end_metabolize(mob/living/psychonaut) . = ..() - SEND_SIGNAL(psychonaut, COMSIG_CLEAR_MOOD_EVENT, "tripping") + psychonaut.clear_mood_event("tripping") if(!psychonaut.hud_used) return var/atom/movable/plane_master_controller/game_plane_master_controller = psychonaut.hud_used.plane_master_controllers[PLANE_MASTERS_GAME] @@ -521,7 +521,7 @@ /datum/reagent/drug/blastoff/on_mob_metabolize(mob/living/dancer) . = ..() - SEND_SIGNAL(dancer, COMSIG_ADD_MOOD_EVENT, "vibing", /datum/mood_event/high, name) + dancer.add_mood_event("vibing", /datum/mood_event/high, name) RegisterSignal(dancer, COMSIG_MOB_EMOTED("flip"), .proc/on_flip) RegisterSignal(dancer, COMSIG_MOB_EMOTED("spin"), .proc/on_spin) @@ -552,7 +552,7 @@ /datum/reagent/drug/blastoff/on_mob_end_metabolize(mob/living/dancer) . = ..() - SEND_SIGNAL(dancer, COMSIG_CLEAR_MOOD_EVENT, "vibing") + dancer.clear_mood_event("vibing") UnregisterSignal(dancer, COMSIG_MOB_EMOTED("flip")) UnregisterSignal(dancer, COMSIG_MOB_EMOTED("spin")) @@ -758,7 +758,7 @@ /datum/reagent/drug/kronkaine/on_mob_life(mob/living/carbon/kronkaine_fiend, delta_time, times_fired) . = ..() - SEND_SIGNAL(kronkaine_fiend, COMSIG_ADD_MOOD_EVENT, "tweaking", /datum/mood_event/stimulant_medium, name) + kronkaine_fiend.add_mood_event("tweaking", /datum/mood_event/stimulant_medium, name) kronkaine_fiend.adjustOrganLoss(ORGAN_SLOT_HEART, 0.4 * REM * delta_time) kronkaine_fiend.set_timed_status_effect(20 SECONDS * REM * delta_time, /datum/status_effect/jitter, only_if_higher = TRUE) kronkaine_fiend.AdjustSleeping(-20 * REM * delta_time) diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index 9c5feedb81e..1f57892bfcb 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -33,16 +33,16 @@ return switch(quality) if (DRINK_NICE) - SEND_SIGNAL(exposed_mob, COMSIG_ADD_MOOD_EVENT, "quality_drink", /datum/mood_event/quality_nice) + exposed_mob.add_mood_event("quality_drink", /datum/mood_event/quality_nice) if (DRINK_GOOD) - SEND_SIGNAL(exposed_mob, COMSIG_ADD_MOOD_EVENT, "quality_drink", /datum/mood_event/quality_good) + exposed_mob.add_mood_event("quality_drink", /datum/mood_event/quality_good) if (DRINK_VERYGOOD) - SEND_SIGNAL(exposed_mob, COMSIG_ADD_MOOD_EVENT, "quality_drink", /datum/mood_event/quality_verygood) + exposed_mob.add_mood_event("quality_drink", /datum/mood_event/quality_verygood) if (DRINK_FANTASTIC) - SEND_SIGNAL(exposed_mob, COMSIG_ADD_MOOD_EVENT, "quality_drink", /datum/mood_event/quality_fantastic) + exposed_mob.add_mood_event("quality_drink", /datum/mood_event/quality_fantastic) exposed_mob.mind?.add_memory(MEMORY_DRINK, list(DETAIL_DRINK = src), story_value = STORY_VALUE_OKAY) if (FOOD_AMAZING) - SEND_SIGNAL(exposed_mob, COMSIG_ADD_MOOD_EVENT, "quality_food", /datum/mood_event/amazingtaste) + exposed_mob.add_mood_event("quality_food", /datum/mood_event/amazingtaste) /datum/reagent/consumable/nutriment name = "Nutriment" @@ -1014,7 +1014,7 @@ /datum/reagent/consumable/peanut_butter/on_mob_life(mob/living/carbon/M, delta_time, times_fired) //ET loves peanut butter if(isabductor(M)) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "ET_pieces", /datum/mood_event/et_pieces, name) + M.add_mood_event("ET_pieces", /datum/mood_event/et_pieces, name) M.set_timed_status_effect(30 SECONDS * REM * delta_time, /datum/status_effect/drugginess) ..() diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index a0b088d9c3a..8adcd309879 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -615,7 +615,7 @@ /datum/reagent/medicine/morphine/on_mob_life(mob/living/carbon/M, delta_time, times_fired) if(current_cycle >= 5) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "numb", /datum/mood_event/narcotic_medium, name) + M.add_mood_event("numb", /datum/mood_event/narcotic_medium, name) switch(current_cycle) if(11) to_chat(M, span_warning("You start to feel tired...") ) @@ -1387,9 +1387,8 @@ M.adjust_timed_status_effect(-12 SECONDS * REM * delta_time, /datum/status_effect/dizziness) M.adjust_timed_status_effect(-6 SECONDS * REM * delta_time, /datum/status_effect/confusion) M.disgust = max(M.disgust - (6 * REM * delta_time), 0) - var/datum/component/mood/mood = M.GetComponent(/datum/component/mood) - if(mood != null && mood.sanity <= SANITY_NEUTRAL) // only take effect if in negative sanity and then... - mood.setSanity(min(mood.sanity + (5 * REM * delta_time), SANITY_NEUTRAL)) // set minimum to prevent unwanted spiking over neutral + if(M.mob_mood != null && M.mob_mood.sanity <= SANITY_NEUTRAL) // only take effect if in negative sanity and then... + M.mob_mood.set_sanity(min(M.mob_mood.sanity + (5 * REM * delta_time), SANITY_NEUTRAL)) // set minimum to prevent unwanted spiking over neutral ..() . = TRUE diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index ead19d86b8b..61145f7f852 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -225,7 +225,7 @@ if(!isfelinid(exposed_mob)) return exposed_mob.incapacitate(1) // startles the felinid, canceling any do_after - SEND_SIGNAL(exposed_mob, COMSIG_ADD_MOOD_EVENT, "watersprayed", /datum/mood_event/watersprayed) + exposed_mob.add_mood_event("watersprayed", /datum/mood_event/watersprayed) /datum/reagent/water/on_mob_life(mob/living/carbon/M, delta_time, times_fired) diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 807e216954a..e45aebfb36a 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -660,7 +660,7 @@ if(M.toxloss <= 60) M.adjustToxLoss(1 * REM * normalise_creation_purity() * delta_time, 0) if(current_cycle >= 4) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "smacked out", /datum/mood_event/narcotic_heavy, name) + M.add_mood_event("smacked out", /datum/mood_event/narcotic_heavy, name) if(current_cycle >= 18) M.Sleeping(40 * REM * normalise_creation_purity() * delta_time) ..() diff --git a/code/modules/reagents/withdrawal/_addiction.dm b/code/modules/reagents/withdrawal/_addiction.dm index a6790904d10..eb79201a007 100644 --- a/code/modules/reagents/withdrawal/_addiction.dm +++ b/code/modules/reagents/withdrawal/_addiction.dm @@ -49,7 +49,7 @@ return TRUE /datum/addiction/proc/lose_addiction(datum/mind/victim_mind) - SEND_SIGNAL(victim_mind.current, COMSIG_CLEAR_MOOD_EVENT, "[type]_addiction") + victim_mind.current.clear_mood_event("[type]_addiction") SEND_SIGNAL(victim_mind.current, COMSIG_CARBON_LOSE_ADDICTION, victim_mind) to_chat(victim_mind.current, span_notice("You feel like you've gotten over your need for drugs.")) end_withdrawal(victim_mind.current) @@ -106,19 +106,19 @@ /// Called when addiction enters stage 1 /datum/addiction/proc/withdrawal_enters_stage_1(mob/living/carbon/affected_carbon) - SEND_SIGNAL(affected_carbon, COMSIG_ADD_MOOD_EVENT, "[type]_addiction", light_withdrawal_moodlet, name) + affected_carbon.add_mood_event("[type]_addiction", light_withdrawal_moodlet, name) /// Called when addiction enters stage 2 /datum/addiction/proc/withdrawal_enters_stage_2(mob/living/carbon/affected_carbon) - SEND_SIGNAL(affected_carbon, COMSIG_ADD_MOOD_EVENT, "[type]_addiction", medium_withdrawal_moodlet, name) + affected_carbon.add_mood_event("[type]_addiction", medium_withdrawal_moodlet, name) /// Called when addiction enters stage 3 /datum/addiction/proc/withdrawal_enters_stage_3(mob/living/carbon/affected_carbon) - SEND_SIGNAL(affected_carbon, COMSIG_ADD_MOOD_EVENT, "[type]_addiction", severe_withdrawal_moodlet, name) + affected_carbon.add_mood_event("[type]_addiction", severe_withdrawal_moodlet, name) /datum/addiction/proc/end_withdrawal(mob/living/carbon/affected_carbon) LAZYSET(affected_carbon.mind.active_addictions, type, 1) //Keeps withdrawal at first cycle. - SEND_SIGNAL(affected_carbon, COMSIG_CLEAR_MOOD_EVENT, "[type]_addiction") + affected_carbon.clear_mood_event("[type]_addiction") /// Called when addiction is in stage 1 every process /datum/addiction/proc/withdrawal_stage_1_process(mob/living/carbon/affected_carbon, delta_time) diff --git a/code/modules/reagents/withdrawal/generic_addictions.dm b/code/modules/reagents/withdrawal/generic_addictions.dm index 8280950034b..b34216ae10d 100644 --- a/code/modules/reagents/withdrawal/generic_addictions.dm +++ b/code/modules/reagents/withdrawal/generic_addictions.dm @@ -135,11 +135,11 @@ var/turf/T = get_turf(affected_human) var/lums = T.get_lumcount() if(lums > 0.5) - SEND_SIGNAL(affected_human, COMSIG_ADD_MOOD_EVENT, "too_bright", /datum/mood_event/bright_light) + affected_human.add_mood_event("too_bright", /datum/mood_event/bright_light) affected_human.adjust_timed_status_effect(6 SECONDS, /datum/status_effect/dizziness, max_duration = 80 SECONDS) affected_human.adjust_timed_status_effect(0.5 SECONDS * delta_time, /datum/status_effect/confusion, max_duration = 20 SECONDS) else - SEND_SIGNAL(affected_carbon, COMSIG_CLEAR_MOOD_EVENT, "too_bright") + affected_carbon.clear_mood_event("too_bright") /datum/addiction/maintenance_drugs/end_withdrawal(mob/living/carbon/affected_carbon) . = ..() diff --git a/code/modules/religion/festival/instrument_rites.dm b/code/modules/religion/festival/instrument_rites.dm index aef31ac009b..84b1328837d 100644 --- a/code/modules/religion/festival/instrument_rites.dm +++ b/code/modules/religion/festival/instrument_rites.dm @@ -58,7 +58,7 @@ GLOB.religious_sect.adjust_favor(0.2) /datum/religion_rites/song_tuner/evangelism/finish_effect(mob/living/carbon/human/listener, atom/song_source) - SEND_SIGNAL(listener, COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing) + listener.add_mood_event("blessing", /datum/mood_event/blessing) /datum/religion_rites/song_tuner/nullwave name = "Nullwave Vibrato" diff --git a/code/modules/religion/religion_sects.dm b/code/modules/religion/religion_sects.dm index aca029f1cf3..26eebbb251d 100644 --- a/code/modules/religion/religion_sects.dm +++ b/code/modules/religion/religion_sects.dm @@ -115,7 +115,7 @@ blessed.visible_message(span_notice("[chap] heals [blessed] with the power of [GLOB.deity]!")) to_chat(blessed, span_boldnotice("May the power of [GLOB.deity] compel you to be healed!")) playsound(chap, SFX_PUNCH, 25, TRUE, -1) - SEND_SIGNAL(blessed, COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing) + blessed.add_mood_event("blessing", /datum/mood_event/blessing) return TRUE /**** Nanotrasen Approved God ****/ @@ -149,7 +149,7 @@ R.cell?.charge += charge_amt R.visible_message(span_notice("[chap] charges [R] with the power of [GLOB.deity]!")) to_chat(R, span_boldnotice("You are charged by the power of [GLOB.deity]!")) - SEND_SIGNAL(R, COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing) + R.add_mood_event("blessing", /datum/mood_event/blessing) playsound(chap, 'sound/effects/bang.ogg', 25, TRUE, -1) return TRUE if(!ishuman(target)) @@ -171,7 +171,7 @@ else blessed.visible_message(span_notice("[chap] charges [blessed] with the power of [GLOB.deity]!")) to_chat(blessed, span_boldnotice("You feel charged by the power of [GLOB.deity]!")) - SEND_SIGNAL(blessed, COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing) + blessed.add_mood_event("blessing", /datum/mood_event/blessing) playsound(chap, 'sound/machines/synth_yes.ogg', 25, TRUE, -1) return TRUE @@ -182,7 +182,7 @@ blessed.visible_message(span_notice("[chap] [did_we_charge ? "repairs" : "repairs and charges"] [blessed] with the power of [GLOB.deity]!")) to_chat(blessed, span_boldnotice("The inner machinations of [GLOB.deity] [did_we_charge ? "repairs" : "repairs and charges"] you!")) playsound(chap, 'sound/effects/bang.ogg', 25, TRUE, -1) - SEND_SIGNAL(blessed, COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing) + blessed.add_mood_event("blessing", /datum/mood_event/blessing) return TRUE /datum/religion_sect/mechanical/on_sacrifice(obj/item/I, mob/living/chap) @@ -266,7 +266,7 @@ blessed.visible_message(span_notice("[chap] barters a heal for [blessed] from [GLOB.deity]!")) to_chat(blessed, span_boldnotice("May the power of [GLOB.deity] compel you to be healed! Thank you for choosing [GLOB.deity]!")) playsound(chap, 'sound/effects/cashregister.ogg', 60, TRUE) - SEND_SIGNAL(blessed, COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing) + blessed.add_mood_event("blessing", /datum/mood_event/blessing) return TRUE #undef GREEDY_HEAL_COST @@ -361,7 +361,7 @@ blessed.visible_message(span_notice("[chap] empowers [blessed] with the power of [GLOB.deity]!")) to_chat(blessed, span_boldnotice("The power of [GLOB.deity] has made you harder to wound for a while!")) playsound(chap, SFX_PUNCH, 25, TRUE, -1) - SEND_SIGNAL(blessed, COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing) + blessed.add_mood_event("blessing", /datum/mood_event/blessing) return TRUE //trust me, you'll be feeling the pain from the maint drugs all well enough /datum/religion_sect/maintenance/on_sacrifice(obj/item/reagent_containers/offering, mob/living/user) diff --git a/code/modules/religion/rites.dm b/code/modules/religion/rites.dm index eab3a4fca79..6ae08a45add 100644 --- a/code/modules/religion/rites.dm +++ b/code/modules/religion/rites.dm @@ -510,7 +510,7 @@ user.emote("laughs") ADD_TRAIT(user, TRAIT_HOPELESSLY_ADDICTED, "maint_adaptation") //addiction sends some nasty mood effects but we want the maint adaption to be enjoyed like a fine wine - SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "maint_adaptation", /datum/mood_event/maintenance_adaptation) + user.add_mood_event("maint_adaptation", /datum/mood_event/maintenance_adaptation) if(iscarbon(user)) var/mob/living/carbon/vomitorium = user vomitorium.vomit() diff --git a/code/modules/religion/sparring/sparring_datum.dm b/code/modules/religion/sparring/sparring_datum.dm index 05279cd4ffc..c5b01451af4 100644 --- a/code/modules/religion/sparring/sparring_datum.dm +++ b/code/modules/religion/sparring/sparring_datum.dm @@ -285,7 +285,7 @@ return to_chat(loser, span_userdanger("[GLOB.deity] is enraged by your lackluster sparring record!")) lightningbolt(loser) - SEND_SIGNAL(loser, COMSIG_ADD_MOOD_EVENT, "sparring", /datum/mood_event/banished) + loser.add_mood_event("sparring", /datum/mood_event/banished) loser.mind.holy_role = NONE to_chat(loser, span_userdanger("You have been excommunicated! You are no longer holy!")) if(STAKES_MONEY_MATCH) diff --git a/code/modules/spells/spell_types/self/mime_vow.dm b/code/modules/spells/spell_types/self/mime_vow.dm index 553c9394f57..9db6b92dd35 100644 --- a/code/modules/spells/spell_types/self/mime_vow.dm +++ b/code/modules/spells/spell_types/self/mime_vow.dm @@ -17,8 +17,8 @@ cast_on.mind.miming = !cast_on.mind.miming if(cast_on.mind.miming) to_chat(cast_on, span_notice("You make a vow of silence.")) - SEND_SIGNAL(cast_on, COMSIG_CLEAR_MOOD_EVENT, "vow") + cast_on.clear_mood_event("vow") else to_chat(cast_on, span_notice("You break your vow of silence.")) - SEND_SIGNAL(cast_on, COMSIG_ADD_MOOD_EVENT, "vow", /datum/mood_event/broken_vow) + cast_on.add_mood_event("vow", /datum/mood_event/broken_vow) cast_on.update_action_buttons_icon() diff --git a/code/modules/surgery/bodyparts/dismemberment.dm b/code/modules/surgery/bodyparts/dismemberment.dm index 973a4407003..e5190148654 100644 --- a/code/modules/surgery/bodyparts/dismemberment.dm +++ b/code/modules/surgery/bodyparts/dismemberment.dm @@ -19,7 +19,7 @@ limb_owner.visible_message(span_danger("[limb_owner]'s [name] is violently dismembered!")) INVOKE_ASYNC(limb_owner, /mob.proc/emote, "scream") playsound(get_turf(limb_owner), 'sound/effects/dismember.ogg', 80, TRUE) - SEND_SIGNAL(limb_owner, COMSIG_ADD_MOOD_EVENT, "dismembered", /datum/mood_event/dismembered) + limb_owner.add_mood_event("dismembered", /datum/mood_event/dismembered) limb_owner.mind?.add_memory(MEMORY_DISMEMBERED, list(DETAIL_LOST_LIMB = src, DETAIL_PROTAGONIST = limb_owner), story_value = STORY_VALUE_AMAZING) drop_limb() @@ -121,7 +121,7 @@ embedded.forceMove(src) // It'll self remove via signal reaction, just need to move it if(!phantom_owner.has_embedded_objects()) phantom_owner.clear_alert(ALERT_EMBEDDED_OBJECT) - SEND_SIGNAL(phantom_owner, COMSIG_CLEAR_MOOD_EVENT, "embedded") + phantom_owner.clear_mood_event("embedded") if(!special) if(phantom_owner.dna) diff --git a/code/modules/surgery/organs/external/tails.dm b/code/modules/surgery/organs/external/tails.dm index 0f2768d2255..13c064a0296 100644 --- a/code/modules/surgery/organs/external/tails.dm +++ b/code/modules/surgery/organs/external/tails.dm @@ -30,13 +30,13 @@ RegisterSignal(reciever, COMSIG_ORGAN_WAG_TAIL, .proc/wag) original_owner ||= reciever //One and done - SEND_SIGNAL(reciever, COMSIG_CLEAR_MOOD_EVENT, "tail_lost") - SEND_SIGNAL(reciever, COMSIG_CLEAR_MOOD_EVENT, "tail_balance_lost") + reciever.clear_mood_event("tail_lost") + reciever.clear_mood_event("tail_balance_lost") if(original_owner == reciever) - SEND_SIGNAL(reciever, COMSIG_CLEAR_MOOD_EVENT, "wrong_tail_regained") + reciever.clear_mood_event("wrong_tail_regained") else if(type in reciever.dna.species.external_organs) - SEND_SIGNAL(reciever, COMSIG_ADD_MOOD_EVENT, "wrong_tail_regained", /datum/mood_event/tail_regained_wrong) + reciever.add_mood_event("wrong_tail_regained", /datum/mood_event/tail_regained_wrong) /obj/item/organ/external/tail/Remove(mob/living/carbon/organ_owner, special, moving) if(wag_flags & WAG_WAGGING) @@ -45,8 +45,8 @@ UnregisterSignal(organ_owner, COMSIG_ORGAN_WAG_TAIL) if(type in organ_owner.dna.species.external_organs) - SEND_SIGNAL(organ_owner, COMSIG_ADD_MOOD_EVENT, "tail_lost", /datum/mood_event/tail_lost) - SEND_SIGNAL(organ_owner, COMSIG_ADD_MOOD_EVENT, "tail_balance_lost", /datum/mood_event/tail_balance_lost) + organ_owner.add_mood_event("tail_lost", /datum/mood_event/tail_lost) + organ_owner.add_mood_event("tail_balance_lost", /datum/mood_event/tail_balance_lost) /obj/item/organ/external/tail/generate_icon_cache() . = ..() diff --git a/code/modules/surgery/organs/external/wings.dm b/code/modules/surgery/organs/external/wings.dm index d3c60da2474..e91ce5a1169 100644 --- a/code/modules/surgery/organs/external/wings.dm +++ b/code/modules/surgery/organs/external/wings.dm @@ -221,7 +221,7 @@ if(!burnt && human.bodytemperature >= 800 && human.fire_stacks > 0) //do not go into the extremely hot light. you will not survive to_chat(human, span_danger("Your precious wings burn to a crisp!")) - SEND_SIGNAL(human, COMSIG_ADD_MOOD_EVENT, "burnt_wings", /datum/mood_event/burnt_wings) + human.add_mood_event("burnt_wings", /datum/mood_event/burnt_wings) burn_wings() human.update_body_parts() diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index e4457bd696b..b807c6831ec 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -421,28 +421,28 @@ switch(miasma_pp) if(0.25 to 5) // At lower pp, give out a little warning - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "smell") + owner.clear_mood_event("smell") if(prob(5)) to_chat(owner, span_notice("There is an unpleasant smell in the air.")) if(5 to 15) //At somewhat higher pp, warning becomes more obvious if(prob(15)) to_chat(owner, span_warning("You smell something horribly decayed inside this room.")) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "smell", /datum/mood_event/disgust/bad_smell) + owner.add_mood_event("smell", /datum/mood_event/disgust/bad_smell) if(15 to 30) //Small chance to vomit. By now, people have internals on anyway if(prob(5)) to_chat(owner, span_warning("The stench of rotting carcasses is unbearable!")) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "smell", /datum/mood_event/disgust/nauseating_stench) + owner.add_mood_event("smell", /datum/mood_event/disgust/nauseating_stench) owner.vomit() if(30 to INFINITY) //Higher chance to vomit. Let the horror start if(prob(15)) to_chat(owner, span_warning("The stench of rotting carcasses is unbearable!")) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "smell", /datum/mood_event/disgust/nauseating_stench) + owner.add_mood_event("smell", /datum/mood_event/disgust/nauseating_stench) owner.vomit() else - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "smell") + owner.clear_mood_event("smell") // In a full miasma atmosphere with 101.34 pKa, about 10 disgust per breath, is pretty low compared to threshholds // Then again, this is a purely hypothetical scenario and hardly reachable @@ -452,12 +452,12 @@ // Clear out moods when no miasma at all else - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "smell") + owner.clear_mood_event("smell") if (n2o_euphoria == EUPHORIA_ACTIVE || healium_euphoria == EUPHORIA_ACTIVE) - SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "chemical_euphoria", /datum/mood_event/chemical_euphoria) + owner.add_mood_event("chemical_euphoria", /datum/mood_event/chemical_euphoria) else if (n2o_euphoria == EUPHORIA_INACTIVE && healium_euphoria == EUPHORIA_INACTIVE) - SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria") + owner.clear_mood_event("chemical_euphoria") // Activate mood on first flag, remove on second, do nothing on third. handle_breath_temperature(breath, breather) diff --git a/code/modules/surgery/organs/stomach/_stomach.dm b/code/modules/surgery/organs/stomach/_stomach.dm index 6f85d6de52d..df5073dcc37 100644 --- a/code/modules/surgery/organs/stomach/_stomach.dm +++ b/code/modules/surgery/organs/stomach/_stomach.dm @@ -140,9 +140,8 @@ if (human.nutrition > 0 && human.stat != DEAD) // THEY HUNGER var/hunger_rate = HUNGER_FACTOR - var/datum/component/mood/mood = human.GetComponent(/datum/component/mood) - if(mood && mood.sanity > SANITY_DISTURBED) - hunger_rate *= max(1 - 0.002 * mood.sanity, 0.5) //0.85 to 0.75 + if(human.mob_mood && human.mob_mood.sanity > SANITY_DISTURBED) + hunger_rate *= max(1 - 0.002 * human.mob_mood.sanity, 0.5) //0.85 to 0.75 // Whether we cap off our satiety or move it towards 0 if(human.satiety > MAX_SATIETY) human.satiety = MAX_SATIETY @@ -244,22 +243,22 @@ switch(disgust) if(0 to DISGUST_LEVEL_GROSS) disgusted.clear_alert(ALERT_DISGUST) - SEND_SIGNAL(disgusted, COMSIG_CLEAR_MOOD_EVENT, "disgust") + disgusted.clear_mood_event("disgust") if(DISGUST_LEVEL_GROSS to DISGUST_LEVEL_VERYGROSS) disgusted.throw_alert(ALERT_DISGUST, /atom/movable/screen/alert/gross) - SEND_SIGNAL(disgusted, COMSIG_ADD_MOOD_EVENT, "disgust", /datum/mood_event/gross) + disgusted.add_mood_event("disgust", /datum/mood_event/gross) if(DISGUST_LEVEL_VERYGROSS to DISGUST_LEVEL_DISGUSTED) disgusted.throw_alert(ALERT_DISGUST, /atom/movable/screen/alert/verygross) - SEND_SIGNAL(disgusted, COMSIG_ADD_MOOD_EVENT, "disgust", /datum/mood_event/verygross) + disgusted.add_mood_event("disgust", /datum/mood_event/verygross) if(DISGUST_LEVEL_DISGUSTED to INFINITY) disgusted.throw_alert(ALERT_DISGUST, /atom/movable/screen/alert/disgusted) - SEND_SIGNAL(disgusted, COMSIG_ADD_MOOD_EVENT, "disgust", /datum/mood_event/disgusted) + disgusted.add_mood_event("disgust", /datum/mood_event/disgusted) /obj/item/organ/internal/stomach/Remove(mob/living/carbon/stomach_owner, special = 0) if(ishuman(stomach_owner)) var/mob/living/carbon/human/human_owner = owner human_owner.clear_alert(ALERT_DISGUST) - SEND_SIGNAL(human_owner, COMSIG_CLEAR_MOOD_EVENT, "disgust") + human_owner.clear_mood_event("disgust") human_owner.clear_alert(ALERT_NUTRITION) return ..() diff --git a/code/modules/surgery/organs/stomach/stomach_ethereal.dm b/code/modules/surgery/organs/stomach/stomach_ethereal.dm index c3249b0d7f4..ebb9164b500 100644 --- a/code/modules/surgery/organs/stomach/stomach_ethereal.dm +++ b/code/modules/surgery/organs/stomach/stomach_ethereal.dm @@ -23,7 +23,7 @@ UnregisterSignal(owner, COMSIG_LIVING_ELECTROCUTE_ACT) REMOVE_TRAIT(owner, TRAIT_NOHUNGER, REF(src)) - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "charge") + owner.clear_mood_event("charge") carbon.clear_alert(ALERT_ETHEREAL_CHARGE) carbon.clear_alert(ALERT_ETHEREAL_OVERCHARGE) @@ -49,32 +49,32 @@ /obj/item/organ/internal/stomach/ethereal/proc/handle_charge(mob/living/carbon/carbon, delta_time, times_fired) switch(crystal_charge) if(-INFINITY to ETHEREAL_CHARGE_NONE) - SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/decharged) + carbon.add_mood_event("charge", /datum/mood_event/decharged) carbon.throw_alert(ALERT_ETHEREAL_CHARGE, /atom/movable/screen/alert/emptycell/ethereal) if(carbon.health > 10.5) carbon.apply_damage(0.65, TOX, null, null, carbon) if(ETHEREAL_CHARGE_NONE to ETHEREAL_CHARGE_LOWPOWER) - SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/decharged) + carbon.add_mood_event("charge", /datum/mood_event/decharged) carbon.throw_alert(ALERT_ETHEREAL_CHARGE, /atom/movable/screen/alert/lowcell/ethereal, 3) if(carbon.health > 10.5) carbon.apply_damage(0.325 * delta_time, TOX, null, null, carbon) if(ETHEREAL_CHARGE_LOWPOWER to ETHEREAL_CHARGE_NORMAL) - SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/lowpower) + carbon.add_mood_event("charge", /datum/mood_event/lowpower) carbon.throw_alert(ALERT_ETHEREAL_CHARGE, /atom/movable/screen/alert/lowcell/ethereal, 2) if(ETHEREAL_CHARGE_ALMOSTFULL to ETHEREAL_CHARGE_FULL) - SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/charged) + carbon.add_mood_event("charge", /datum/mood_event/charged) if(ETHEREAL_CHARGE_FULL to ETHEREAL_CHARGE_OVERLOAD) - SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/overcharged) + carbon.add_mood_event("charge", /datum/mood_event/overcharged) carbon.throw_alert(ALERT_ETHEREAL_OVERCHARGE, /atom/movable/screen/alert/ethereal_overcharge, 1) carbon.apply_damage(0.2, TOX, null, null, carbon) if(ETHEREAL_CHARGE_OVERLOAD to ETHEREAL_CHARGE_DANGEROUS) - SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/supercharged) + carbon.add_mood_event("charge", /datum/mood_event/supercharged) carbon.throw_alert(ALERT_ETHEREAL_OVERCHARGE, /atom/movable/screen/alert/ethereal_overcharge, 2) carbon.apply_damage(0.325 * delta_time, TOX, null, null, carbon) if(DT_PROB(5, delta_time)) // 5% each seacond for ethereals to explosively release excess energy if it reaches dangerous levels discharge_process(carbon) else - SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "charge") + owner.clear_mood_event("charge") carbon.clear_alert(ALERT_ETHEREAL_CHARGE) carbon.clear_alert(ALERT_ETHEREAL_OVERCHARGE) diff --git a/tgstation.dme b/tgstation.dme index 25350452957..2083e84712e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -236,7 +236,6 @@ #include "code\__DEFINES\dcs\signals\signals_medical.dm" #include "code\__DEFINES\dcs\signals\signals_mind.dm" #include "code\__DEFINES\dcs\signals\signals_mod.dm" -#include "code\__DEFINES\dcs\signals\signals_mood.dm" #include "code\__DEFINES\dcs\signals\signals_moveloop.dm" #include "code\__DEFINES\dcs\signals\signals_movetype.dm" #include "code\__DEFINES\dcs\signals\signals_music.dm" @@ -602,6 +601,7 @@ #include "code\datums\map_config.dm" #include "code\datums\mind.dm" #include "code\datums\minigames_menu.dm" +#include "code\datums\mood.dm" #include "code\datums\movement_detector.dm" #include "code\datums\mutable_appearance.dm" #include "code\datums\numbered_display.dm" @@ -816,7 +816,6 @@ #include "code\datums\components\mind_linker.dm" #include "code\datums\components\mirage_border.dm" #include "code\datums\components\mirv.dm" -#include "code\datums\components\mood.dm" #include "code\datums\components\multiple_lives.dm" #include "code\datums\components\ntnet_interface.dm" #include "code\datums\components\omen.dm"