From 53ff425f04667cdc98088e52702b843e68dd1d67 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 5 Dec 2019 21:55:28 +0100 Subject: [PATCH 1/2] Banishes some magic numbers from this realm. --- code/__DEFINES/misc.dm | 4 ++++ code/datums/emotes.dm | 3 --- code/modules/food_and_drinks/food/snacks.dm | 4 ++-- .../mob/living/simple_animal/friendly/cat.dm | 16 ++++++++-------- .../mob/living/simple_animal/friendly/dog.dm | 12 ++++++------ .../mob/living/simple_animal/hostile/hostile.dm | 2 +- code/modules/mob/living/simple_animal/parrot.dm | 6 +++--- .../mob/living/simple_animal/simple_animal.dm | 8 ++++---- code/modules/surgery/organs/vocal_cords.dm | 12 ++++++------ 9 files changed, 34 insertions(+), 33 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 29ff0a8fae..5f7c2cb396 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -519,6 +519,10 @@ GLOBAL_LIST_INIT(pda_reskins, list(PDA_SKIN_CLASSIC = 'icons/obj/pda.dmi', PDA_S #define VOMIT_TOXIC 1 #define VOMIT_PURPLE 2 +//whether the emote is visible or audible. +#define EMOTE_VISIBLE 1 +#define EMOTE_AUDIBLE 2 + // possible bitflag return values of intercept_zImpact(atom/movable/AM, levels = 1) calls #define FALL_INTERCEPTED (1<<0) //Stops the movable from falling further and crashing on the ground #define FALL_NO_MESSAGE (1<<1) //Used to suppress the "[A] falls through [old_turf]" messages where it'd make little sense at all, like going downstairs. diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index 6c91cc3a7d..f0fca5db5a 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -1,6 +1,3 @@ -#define EMOTE_VISIBLE 1 -#define EMOTE_AUDIBLE 2 - /datum/emote var/key = "" //What calls the emote var/key_third_person = "" //This will also call the emote diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index d838b31aba..b8a63afb7f 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -319,13 +319,13 @@ All foods are distributed among various categories. Use common sense. if(iscorgi(M)) var/mob/living/L = M if(bitecount == 0 || prob(50)) - M.emote("me", 1, "nibbles away at \the [src]") + M.emote("me", EMOTE_VISIBLE, "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("me", EMOTE_VISIBLE, "[sattisfaction_text]") qdel(src) // //////////////////////////////////////////////Store//////////////////////////////////////// diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 58d8a3ccca..73fd2b5569 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -169,40 +169,40 @@ /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.")) + emote("me", EMOTE_VISIBLE, pick("stretches out for a belly rub.", "wags its tail.", "lies down.")) icon_state = "[icon_living]_rest" collar_type = "[initial(collar_type)]_rest" resting = 1 update_canmove() else if (prob(1)) - emote("me", 1, pick("sits down.", "crouches on its hind legs.", "looks alert.")) + emote("me", EMOTE_VISIBLE, pick("sits down.", "crouches on its hind legs.", "looks alert.")) icon_state = "[icon_living]_sit" collar_type = "[initial(collar_type)]_sit" resting = 1 update_canmove() else if (prob(1)) if (resting) - emote("me", 1, pick("gets up and meows.", "walks around.", "stops resting.")) + emote("me", EMOTE_VISIBLE, pick("gets up and meows.", "walks around.", "stops resting.")) icon_state = "[icon_living]" collar_type = "[initial(collar_type)]" resting = 0 update_canmove() else - emote("me", 1, pick("grooms its fur.", "twitches its whiskers.", "shakes out its coat.")) + emote("me", EMOTE_VISIBLE, pick("grooms its fur.", "twitches its whiskers.", "shakes out its coat.")) //MICE! if((src.loc) && isturf(src.loc)) if(!stat && !resting && !buckled) for(var/mob/living/simple_animal/mouse/M in view(1,src)) if(!M.stat && Adjacent(M)) - emote("me", 1, "splats \the [M]!") + emote("me", EMOTE_VISIBLE, "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!") + emote("me", EMOTE_VISIBLE, "bats \the [T] around with its paw!") T.cooldown = world.time ..() @@ -241,10 +241,10 @@ if(change > 0) if(M && stat != DEAD) new /obj/effect/temp_visual/heart(loc) - emote("me", 1, "purrs!") + emote("me", EMOTE_VISIBLE, "purrs!") else if(M && stat != DEAD) - emote("me", 1, "hisses!") + emote("me", EMOTE_VISIBLE, "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 c194233c42..eb7129181d 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -459,10 +459,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") + emote("me", EMOTE_VISIBLE, "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!")) + emote("me", EMOTE_VISIBLE, pick("dances around.","chases its tail!")) spawn(0) for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) setDir(i) @@ -618,7 +618,7 @@ if(!stat && !resting && !buckled) if(prob(1)) - emote("me", 1, pick("dances around.","chases her tail.")) + emote("me", EMOTE_VISIBLE, pick("dances around.","chases her tail.")) spawn(0) for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) setDir(i) @@ -629,7 +629,7 @@ if(!stat && !resting && !buckled) if(prob(1)) - emote("me", 1, pick("chases its tail.")) + emote("me", EMOTE_VISIBLE, pick("chases its tail.")) spawn(0) for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) setDir(i) @@ -648,8 +648,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!") + emote("me", EMOTE_VISIBLE, "yaps happily!") SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "pet_corgi", /datum/mood_event/pet_corgi) else if(M && stat != DEAD) // Same check here, even though emote checks it as well (poor form to check it only in the help case) - emote("me", 1, "growls!") + emote("me", EMOTE_VISIBLE, "growls!") diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 9cd0504315..0377efd16e 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -364,7 +364,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("me", EMOTE_VISIBLE, "[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 5f9c8700bd..12bc41d9c5 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -437,7 +437,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.") + emote("me", EMOTE_VISIBLE, "looks in [parrot_interest]'s direction and takes flight.") parrot_state = PARROT_SWOOP | PARROT_STEAL icon_state = icon_living return @@ -459,7 +459,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].") + emote("me", EMOTE_VISIBLE, "turns and flies towards [parrot_interest].") parrot_state = PARROT_SWOOP | PARROT_STEAL return else //Else it's a perch @@ -760,7 +760,7 @@ held_item = null if(health < maxHealth) adjustBruteLoss(-10) - emote("me", 1, "[src] eagerly downs the cracker.") + emote("me", EMOTE_VISIBLE, "[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 ea86ac8963..52e58aea4e 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -185,16 +185,16 @@ say(pick(speak), forced = "poly") else if(!(emote_hear && emote_hear.len) && (emote_see && emote_see.len)) - emote("me", 1, pick(emote_see)) + emote("me", EMOTE_VISIBLE, pick(emote_see)) if((emote_hear && emote_hear.len) && !(emote_see && emote_see.len)) - emote("me", 2, pick(emote_hear)) + emote("me", EMOTE_AUDIBLE, 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)) + emote("me", EMOTE_VISIBLE, pick(emote_see)) else - emote("me", 2, pick(emote_hear)) + emote("me", EMOTE_AUDIBLE, pick(emote_hear)) /mob/living/simple_animal/proc/environment_is_safe(datum/gas_mixture/environment, check_temp = FALSE) diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm index 83b0eb4d17..dedff3ae04 100644 --- a/code/modules/surgery/organs/vocal_cords.dm +++ b/code/modules/surgery/organs/vocal_cords.dm @@ -754,7 +754,7 @@ var/static/regex/punish_words = regex("bad boy|bad girl|bad pet|bad job|spot of bother|gone and done it now|blast it|buggered it up") //phase 0 var/static/regex/saymyname_words = regex("say my name|who am i|whoami") - var/static/regex/wakeup_words = regex("revert|awaken|snap|attention") + var/static/regex/wakeup_words = regex("revert|awaken|snap|attention") //phase1 var/static/regex/petstatus_words = regex("how are you|what is your status|are you okay") var/static/regex/silence_words = regex("shut up|silence|be silent|ssh|quiet|hush") @@ -1143,7 +1143,7 @@ switch(E.phase) if(2 to INFINITY) playsound(get_turf(H), pick('sound/effects/meow1.ogg', 'modular_citadel/sound/voice/nya.ogg'), 50, 1, -1) //I'm very tempted to write a Fermis clause that makes them merowr.ogg if it's me. But, I also don't think snowflakism is okay. I would've gotten away for it too, if it wern't for my morals. - H.emote("me", 1, "lets out a nya!") + H.emote("me", EMOTE_VISIBLE, "lets out a nya!") E.cooldown += 1 //SLEEP @@ -1230,7 +1230,7 @@ var/datum/status_effect/chem/enthrall/E = C.has_status_effect(/datum/status_effect/chem/enthrall) if (E.phase == 3) var/speaktrigger = "" - C.emote("me", 1, "whispers something quietly.") + C.emote("me", EMOTE_VISIBLE, "whispers something quietly.") if (get_dist(user, C) > 1)//Requires user to be next to their pet. to_chat(user, "You need to be next to your pet to hear them!") continue @@ -1253,7 +1253,7 @@ to_chat(user, "[H] seems incapable of being implanted with triggers.") continue else - user.emote("me", 1, "puts their hands upon [H.name]'s head and looks deep into their eyes, whispering something to them.") + user.emote("me", EMOTE_VISIBLE, "puts their hands upon [H.name]'s head and looks deep into their eyes, whispering something to them.") user.SetStun(1000)//Hands are handy, so you have to stay still H.SetStun(1000) if (E.mental_capacity >= 5) @@ -1294,7 +1294,7 @@ to_chat(user, "[H] seems incapable of being implanted with an echoing phrase.") continue else - user.emote("me", 1, "puts their hands upon [H.name]'s head and looks deep into their eyes, whispering something to them.") + user.emote("me", EMOTE_VISIBLE, "puts their hands upon [H.name]'s head and looks deep into their eyes, whispering something to them.") user.SetStun(1000)//Hands are handy, so you have to stay still H.SetStun(1000) var/trigger = stripped_input(user, "Enter the loop phrase", MAX_MESSAGE_LEN) @@ -1317,7 +1317,7 @@ to_chat(user, "You need to be next to your pet to give them a new objective!") continue else - user.emote("me", 1, "puts their hands upon [H.name]'s head and looks deep into their eyes, whispering something to them.'") + user.emote("me", EMOTE_VISIBLE, "puts their hands upon [H.name]'s head and looks deep into their eyes, whispering something to them.'") user.SetStun(1000)//So you can't run away! H.SetStun(1000) if (E.mental_capacity >= 200) From 7958cfa5485bee570c4efcba64fb2e01dc34fc22 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Fri, 6 Dec 2019 00:27:50 +0100 Subject: [PATCH 2/2] Right file --- code/__DEFINES/misc.dm | 4 ---- code/__DEFINES/say.dm | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 5f7c2cb396..29ff0a8fae 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -519,10 +519,6 @@ GLOBAL_LIST_INIT(pda_reskins, list(PDA_SKIN_CLASSIC = 'icons/obj/pda.dmi', PDA_S #define VOMIT_TOXIC 1 #define VOMIT_PURPLE 2 -//whether the emote is visible or audible. -#define EMOTE_VISIBLE 1 -#define EMOTE_AUDIBLE 2 - // possible bitflag return values of intercept_zImpact(atom/movable/AM, levels = 1) calls #define FALL_INTERCEPTED (1<<0) //Stops the movable from falling further and crashing on the ground #define FALL_NO_MESSAGE (1<<1) //Used to suppress the "[A] falls through [old_turf]" messages where it'd make little sense at all, like going downstairs. diff --git a/code/__DEFINES/say.dm b/code/__DEFINES/say.dm index af06a5a2d0..d582728acb 100644 --- a/code/__DEFINES/say.dm +++ b/code/__DEFINES/say.dm @@ -75,6 +75,10 @@ #define LINGHIVE_LING 2 #define LINGHIVE_LINK 3 +//whether the emote is visible or audible. +#define EMOTE_VISIBLE 1 +#define EMOTE_AUDIBLE 2 + //Don't set this very much higher then 1024 unless you like inviting people in to dos your server with message spam #define MAX_MESSAGE_LEN 2048 //Citadel edit: What's the WORST that could happen? #define MAX_NAME_LEN 42