From 5dfd1cc353852b4622c68d4f648f864208f4a90c Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 3 Aug 2020 16:38:29 +0200 Subject: [PATCH] [MIRROR] Adds a coder override emote so manual custom emotes work properly (#186) * Adds a coder override emote so manual custom emotes work properly (#52602) * Adds a coder override emote to skip dumb shit with me * I know this sucks, I can't comprehend how to do this cleanly without a full rewrite * cleaner now * Adds a coder override emote so manual custom emotes work properly Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> --- code/datums/components/edible.dm | 4 +-- code/datums/emotes.dm | 33 +++++++++++++++++++ code/modules/food_and_drinks/food/snacks.dm | 4 +-- .../carbon/human/species_types/golems.dm | 2 +- .../carbon/human/species_types/plasmamen.dm | 2 +- .../carbon/human/species_types/skeletons.dm | 2 +- .../mob/living/simple_animal/friendly/cat.dm | 16 ++++----- .../mob/living/simple_animal/friendly/dog.dm | 8 ++--- .../mob/living/simple_animal/hostile/goose.dm | 2 +- .../living/simple_animal/hostile/hostile.dm | 2 +- .../mob/living/simple_animal/parrot.dm | 6 ++-- .../mob/living/simple_animal/simple_animal.dm | 12 +++---- .../chemistry/reagents/toxin_reagents.dm | 2 +- 13 files changed, 64 insertions(+), 31 deletions(-) diff --git a/code/datums/components/edible.dm b/code/datums/components/edible.dm index 2713136cf31..61c7dea3fd6 100644 --- a/code/datums/components/edible.dm +++ b/code/datums/components/edible.dm @@ -236,12 +236,12 @@ Behavior that's still missing from this component that original food items had t return var/mob/living/L = user if(bitecount == 0 || prob(50)) - L.emote("me", 1, "nibbles away at \the [parent]") + L.manual_emote("nibbles away at \the [parent]") bitecount++ . = COMPONENT_ITEM_NO_ATTACK L.taste(owner.reagents) // why should carbons get all the fun? if(bitecount >= 5) var/sattisfaction_text = pick("burps from enjoyment", "yaps for more", "woofs twice", "looks at the area where \the [parent] was") if(sattisfaction_text) - L.emote("me", 1, "[sattisfaction_text]") + L.manual_emote(sattisfaction_text) qdel(parent) diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index 5c8908bf390..1e00f454caa 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -157,3 +157,36 @@ var/mob/living/L = user if(HAS_TRAIT(L, TRAIT_EMOTEMUTE)) return FALSE +/** +* Allows the intrepid coder to send a basic emote +* Takes text as input, sends it out to those who need to know after some light parsing +* If you need something more complex, make it into a datum emote +* Arguments: +* * text - The text to send out +*/ +/mob/proc/manual_emote(text) //Just override the song and dance + . = TRUE + if(findtext(text, "their")) + text = replacetext(text, "their", p_their()) + if(findtext(text, "them")) + text = replacetext(text, "them", p_them()) + if(findtext(text, "%s")) + text = replacetext(text, "%s", p_s()) + + if(stat != CONSCIOUS) + return + + if(!text) + CRASH("Someone passed nothing to manual_emote(), fix it") + + log_message(text, LOG_EMOTE) + text = "[src] " + text + + for(var/mob/M in GLOB.dead_mob_list) + if(!M.client || isnewplayer(M)) + continue + var/T = get_turf(src) + if(M.stat == DEAD && M.client && (M.client.prefs.chat_toggles & CHAT_GHOSTSIGHT) && !(M in viewers(T, null))) + M.show_message(text) + + visible_message(text) diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index f5fc99fbc52..0fb4963fb02 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -317,13 +317,13 @@ All foods are distributed among various categories. Use common sense. if(isdog(M)) var/mob/living/L = M if(bitecount == 0 || prob(50)) - M.emote("me", 1, "nibbles away at \the [src]") + M.manual_emote("nibbles away at \the [src]") bitecount++ L.taste(reagents) // why should carbons get all the fun? if(bitecount >= 5) var/sattisfaction_text = pick("burps from enjoyment", "yaps for more", "woofs twice", "looks at the area where \the [src] was") if(sattisfaction_text) - M.emote("me", 1, "[sattisfaction_text]") + M.emote(sattisfaction_text) qdel(src) 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 8c59ab07567..bdc60ed9bf0 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -954,7 +954,7 @@ if(1) H.say(pick("oof.", "ouch.", "my bones.", "oof ouch.", "oof ouch my bones."), forced = /datum/reagent/toxin/bonehurtingjuice) if(2) - H.emote("me", 1, pick("oofs silently.", "looks like their bones hurt.", "grimaces, as though their bones hurt.")) + H.manual_emote(pick("oofs silently.", "looks like their bones hurt.", "grimaces, as though their bones hurt.")) if(3) to_chat(H, "Your bones hurt!") if(chem.overdosed) diff --git a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm index 7d21fb76916..073cb807016 100644 --- a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm +++ b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm @@ -175,7 +175,7 @@ if(1) H.say(pick("oof.", "ouch.", "my bones.", "oof ouch.", "oof ouch my bones."), forced = /datum/reagent/toxin/bonehurtingjuice) if(2) - H.emote("me", 1, pick("oofs silently.", "looks like their bones hurt.", "grimaces, as though their bones hurt.")) + H.manual_emote(pick("oofs silently.", "looks like their bones hurt.", "grimaces, as though their bones hurt.")) if(3) to_chat(H, "Your bones hurt!") if(chem.overdosed) diff --git a/code/modules/mob/living/carbon/human/species_types/skeletons.dm b/code/modules/mob/living/carbon/human/species_types/skeletons.dm index 7443224e7f6..8f23b246213 100644 --- a/code/modules/mob/living/carbon/human/species_types/skeletons.dm +++ b/code/modules/mob/living/carbon/human/species_types/skeletons.dm @@ -43,7 +43,7 @@ if(1) H.say(pick("oof.", "ouch.", "my bones.", "oof ouch.", "oof ouch my bones."), forced = /datum/reagent/toxin/bonehurtingjuice) if(2) - H.emote("me", 1, pick("oofs silently.", "looks like their bones hurt.", "grimaces, as though their bones hurt.")) + H.manual_emote(pick("oofs silently.", "looks like their bones hurt.", "grimaces, as though their bones hurt.")) if(3) to_chat(H, "Your bones hurt!") if(chem.overdosed) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index f80b574928a..362726c5500 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -178,23 +178,23 @@ /mob/living/simple_animal/pet/cat/Life() if(!stat && !buckled && !client) if(prob(1)) - emote("me", 1, pick("stretches out for a belly rub.", "wags its tail.", "lies down.")) + manual_emote(pick("stretches out for a belly rub.", "wags its tail.", "lies down.")) icon_state = "[icon_living]_rest" collar_type = "[initial(collar_type)]_rest" set_resting(TRUE) else if (prob(1)) - emote("me", 1, pick("sits down.", "crouches on its hind legs.", "looks alert.")) + manual_emote(pick("sits down.", "crouches on its hind legs.", "looks alert.")) icon_state = "[icon_living]_sit" collar_type = "[initial(collar_type)]_sit" set_resting(TRUE) else if (prob(1)) if (resting) - emote("me", 1, pick("gets up and meows.", "walks around.", "stops resting.")) + manual_emote(pick("gets up and meows.", "walks around.", "stops resting.")) icon_state = "[icon_living]" collar_type = "[initial(collar_type)]" set_resting(FALSE) else - emote("me", 1, pick("grooms its fur.", "twitches its whiskers.", "shakes out its coat.")) + manual_emote(pick("grooms its fur.", "twitches its whiskers.", "shakes out its coat.")) //MICE! if((src.loc) && isturf(src.loc)) @@ -207,14 +207,14 @@ emote_cooldown = world.time break if(!M.stat && Adjacent(M)) - emote("me", 1, "splats \the [M]!") + manual_emote("splats \the [M]!") M.splat() movement_target = null stop_automated_movement = 0 break for(var/obj/item/toy/cattoy/T in view(1,src)) if (T.cooldown < (world.time - 400)) - emote("me", 1, "bats \the [T] around with its paw!") + manual_emote("bats \the [T] around with its paw!") T.cooldown = world.time ..() @@ -253,13 +253,13 @@ if(change > 0) if(M && stat != DEAD) new /obj/effect/temp_visual/heart(loc) - emote("me", 1, "purrs!") + manual_emote("purrs!") if(flags_1 & HOLOGRAM_1) return SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, src, /datum/mood_event/pet_animal, src) else if(M && stat != DEAD) - emote("me", 1, "hisses!") + manual_emote("hisses!") /mob/living/simple_animal/pet/cat/cak //I told you I'd do it, Remie name = "Keeki" diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 111458af7be..4b1dfe54469 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -70,10 +70,10 @@ movement_target.attack_animal(src) else if(ishuman(movement_target.loc) ) if(prob(20)) - emote("me", 1, "stares at [movement_target.loc]'s [movement_target] with a sad puppy-face") + manual_emote("stares at [movement_target.loc]'s [movement_target] with a sad puppy-face") if(prob(1)) - emote("me", 1, pick("dances around.","chases its tail!")) + manual_emote(pick("dances around.","chases its tail!")) INVOKE_ASYNC(GLOBAL_PROC, .proc/dance_rotate, src) //Corgis and pugs are now under one dog subtype @@ -644,8 +644,8 @@ if(change > 0) if(M && stat != DEAD) // Added check to see if this mob (the dog) is dead to fix issue 2454 new /obj/effect/temp_visual/heart(loc) - emote("me", 1, "yaps happily!") + manual_emote("yaps happily!") SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, src, /datum/mood_event/pet_animal, src) else if(M && stat != DEAD) // Same check here, even though emote checks it as well (poor form to check it only in the help case) - emote("me", 1, "growls!") + manual_emote("growls!") diff --git a/code/modules/mob/living/simple_animal/hostile/goose.dm b/code/modules/mob/living/simple_animal/hostile/goose.dm index 2b76318ceff..c827d25ebfa 100644 --- a/code/modules/mob/living/simple_animal/hostile/goose.dm +++ b/code/modules/mob/living/simple_animal/hostile/goose.dm @@ -151,7 +151,7 @@ return if(prob(25)) visible_message("[src] is gagging on \the [plastic]!") - emote("me", 1, "gags!") + manual_emote("gags!") addtimer(CALLBACK(src, .proc/vomit), 300) else addtimer(CALLBACK(src, .proc/suffocate), 300) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index fa33a58b4a5..eb0aac2c3c9 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -335,7 +335,7 @@ /mob/living/simple_animal/hostile/proc/Aggro() vision_range = aggro_vision_range if(target && emote_taunt.len && prob(taunt_chance)) - emote("me", 1, "[pick(emote_taunt)] at [target].") + emote("[pick(emote_taunt)] at [target].") taunt_chance = max(taunt_chance-7,2) diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index b675d781756..696634c0cae 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -435,7 +435,7 @@ //Search for item to steal parrot_interest = search_for_item() if(parrot_interest) - emote("me", 1, "looks in [parrot_interest]'s direction and takes flight.") + manual_emote("looks in [parrot_interest]'s direction and takes flight.") parrot_state = PARROT_SWOOP | PARROT_STEAL icon_state = icon_living return @@ -457,7 +457,7 @@ if(AM) if(istype(AM, /obj/item) || isliving(AM)) //If stealable item parrot_interest = AM - emote("me", 1, "turns and flies towards [parrot_interest].") + manual_emote("turns and flies towards [parrot_interest].") parrot_state = PARROT_SWOOP | PARROT_STEAL return else //Else it's a perch @@ -759,7 +759,7 @@ held_item = null if(health < maxHealth) adjustBruteLoss(-10) - emote("me", 1, "[src] eagerly downs the cracker.") + manual_emote("[src] eagerly downs the cracker.") return 1 diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index d1d7f31d458..e43e985da9d 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -258,23 +258,23 @@ else randomValue -= speak.len if(emote_see && randomValue <= emote_see.len) - emote("me [pick(emote_see)]", 1) + manual_emote(pick(emote_see)) else - emote("me [pick(emote_hear)]", 2) + manual_emote(pick(emote_hear)) else say(pick(speak), forced = "poly") else if(!(emote_hear && emote_hear.len) && (emote_see && emote_see.len)) - emote("me", 1, pick(emote_see)) + manual_emote(pick(emote_see)) if((emote_hear && emote_hear.len) && !(emote_see && emote_see.len)) - emote("me", 2, pick(emote_hear)) + manual_emote(pick(emote_hear)) if((emote_hear && emote_hear.len) && (emote_see && emote_see.len)) var/length = emote_hear.len + emote_see.len var/pick = rand(1,length) if(pick <= emote_see.len) - emote("me", 1, pick(emote_see)) + manual_emote(pick(emote_see)) else - emote("me", 2, pick(emote_hear)) + manual_emote(pick(emote_hear)) /mob/living/simple_animal/proc/environment_air_is_safe() . = TRUE diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 963288c1e18..8144dd2bfa6 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -949,7 +949,7 @@ if(1) M.say(pick("oof.", "ouch.", "my bones.", "oof ouch.", "oof ouch my bones."), forced = /datum/reagent/toxin/bonehurtingjuice) if(2) - M.emote("me", 1, pick("oofs silently.", "looks like their bones hurt.", "grimaces, as though their bones hurt.")) + M.manual_emote(pick("oofs silently.", "looks like their bones hurt.", "grimaces, as though their bones hurt.")) if(3) to_chat(M, "Your bones hurt!") return ..()