From 59d79ed3c874a0d7f201e8d97b660d666da7bde5 Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Sun, 21 Jul 2024 05:43:28 +0200
Subject: [PATCH] [MIRROR] [NO GBP] Fixing beyblade flipping (also an already
borked comsig) (#28914)
* [NO GBP] Fixing beyblade flipping (also an already borked comsig)
* fix an old thing
* Update emote.dm
* Update emote.dm
* Update robot.dm
* Update robot.dm
---------
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
---
code/datums/emotes.dm | 14 +--
code/modules/mob/emote.dm | 26 +++--
code/modules/mob/living/basic/slime/emote.dm | 2 -
code/modules/mob/living/brain/emote.dm | 2 +-
code/modules/mob/living/carbon/emote.dm | 11 +-
code/modules/mob/living/carbon/human/emote.dm | 16 +--
code/modules/mob/living/emote.dm | 107 ++++++++----------
code/modules/mob/living/silicon/ai/emote.dm | 9 --
.../modules/mob/living/silicon/robot/robot.dm | 2 +-
9 files changed, 75 insertions(+), 114 deletions(-)
diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm
index d0de582a920..fa072ec6998 100644
--- a/code/datums/emotes.dm
+++ b/code/datums/emotes.dm
@@ -85,20 +85,15 @@
* * type_override - Override to the current emote_type.
* * intentional - Bool that says whether the emote was forced (FALSE) or not (TRUE).
*
- * Returns TRUE if it was able to run the emote, FALSE otherwise.
*/
/datum/emote/proc/run_emote(mob/user, params, type_override, intentional = FALSE)
- if(!can_run_emote(user, TRUE, intentional))
- return FALSE
- if(SEND_SIGNAL(user, COMSIG_MOB_PRE_EMOTED, key, params, type_override, intentional, src) & COMPONENT_CANT_EMOTE)
- return TRUE // We don't return FALSE because the error output would be incorrect, provide your own if necessary.
var/msg = select_message_type(user, message, intentional)
if(params && message_param)
msg = select_param(user, params)
msg = replace_pronoun(user, msg)
if(!msg)
- return TRUE
+ return
user.log_message(msg, LOG_EMOTE)
@@ -149,7 +144,7 @@
viewer.show_message("[user] [msg]", MSG_AUDIBLE)
else if(is_visual)
viewer.show_message("[user] [msg]", MSG_VISUAL)
- return TRUE // Early exit so no dchat message
+ return // Early exit so no dchat message
// The emote has some important information, and should always be shown to the user
else if(is_important)
@@ -246,7 +241,7 @@
ghost.show_message("[FOLLOW_LINK(ghost, user)] [dchatmsg]") // SKYRAT EDIT CHANGE - Indented
- return TRUE
+ return
@@ -359,10 +354,11 @@
* * user - Person that is trying to send the emote.
* * status_check - Bool that says whether we should check their stat or not.
* * intentional - Bool that says whether the emote was forced (FALSE) or not (TRUE).
+ * * params - Parameters added after the emote.
*
* Returns a bool about whether or not the user can run the emote.
*/
-/datum/emote/proc/can_run_emote(mob/user, status_check = TRUE, intentional = FALSE)
+/datum/emote/proc/can_run_emote(mob/user, status_check = TRUE, intentional = FALSE, params)
if(trait_required && !HAS_TRAIT(user, trait_required))
return FALSE
if(!is_type_in_typecache(user, mob_type_allowed_typecache))
diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm
index 7814bea871b..021960395d0 100644
--- a/code/modules/mob/emote.dm
+++ b/code/modules/mob/emote.dm
@@ -27,14 +27,19 @@
to_chat(src, span_notice("'[act]' emote does not exist. Say *help for a list."))
return FALSE
var/silenced = FALSE
- for(var/datum/emote/P in key_emotes)
- if(!P.check_cooldown(src, intentional))
+ for(var/datum/emote/emote in key_emotes)
+ if(!emote.check_cooldown(src, intentional))
silenced = TRUE
continue
- if(P.run_emote(src, param, m_type, intentional))
- SEND_SIGNAL(src, COMSIG_MOB_EMOTE, P, act, m_type, message, intentional)
- SEND_SIGNAL(src, COMSIG_MOB_EMOTED(P.key))
- return TRUE
+ if(!emote.can_run_emote(src, TRUE, intentional, param))
+ continue
+ if(SEND_SIGNAL(src, COMSIG_MOB_PRE_EMOTED, emote.key, param, m_type, intentional, emote) & COMPONENT_CANT_EMOTE)
+ silenced = TRUE
+ continue
+ emote.run_emote(src, param, m_type, intentional)
+ SEND_SIGNAL(src, COMSIG_MOB_EMOTE, emote, act, m_type, message, intentional)
+ SEND_SIGNAL(src, COMSIG_MOB_EMOTED(emote.key))
+ return TRUE
src.nextsoundemote = world.time // SKYRAT EDIT ADDITION
if(intentional && !silenced && !force_silence)
to_chat(src, span_notice("Unusable emote '[act]'. Say *help for a list."))
@@ -79,15 +84,15 @@
/datum/emote/flip/run_emote(mob/user, params , type_override, intentional)
. = ..()
- if(.)
- user.SpinAnimation(HAS_TRAIT(user, TRAIT_SLOW_FLIP) ? FLIP_EMOTE_DURATION * 2 : FLIP_EMOTE_DURATION, 1)
+ user.SpinAnimation(HAS_TRAIT(user, TRAIT_SLOW_FLIP) ? FLIP_EMOTE_DURATION * 2 : FLIP_EMOTE_DURATION, 1)
/datum/emote/flip/check_cooldown(mob/user, intentional)
var/slow_flipper = HAS_TRAIT(user, TRAIT_SLOW_FLIP)
if(slow_flipper)
cooldown *= 2
. = ..()
- cooldown *= 0.5
+ if(slow_flipper)
+ cooldown *= 0.5
if(.)
return
if(!can_run_emote(user, intentional=intentional))
@@ -117,8 +122,7 @@
/datum/emote/spin/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(.)
- user.spin(20, 1)
+ user.spin(20, 1)
/datum/emote/spin/check_cooldown(mob/living/carbon/user, intentional)
. = ..()
diff --git a/code/modules/mob/living/basic/slime/emote.dm b/code/modules/mob/living/basic/slime/emote.dm
index 93b889a07a4..617d33b9809 100644
--- a/code/modules/mob/living/basic/slime/emote.dm
+++ b/code/modules/mob/living/basic/slime/emote.dm
@@ -29,8 +29,6 @@
/datum/emote/slime/mood/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(!.)
- return
var/mob/living/basic/slime/slime_user = user
slime_user.current_mood = mood_key
slime_user.regenerate_icons()
diff --git a/code/modules/mob/living/brain/emote.dm b/code/modules/mob/living/brain/emote.dm
index 75599e892a2..c93e3acf4b2 100644
--- a/code/modules/mob/living/brain/emote.dm
+++ b/code/modules/mob/living/brain/emote.dm
@@ -3,7 +3,7 @@
mob_type_blacklist_typecache = list()
emote_type = EMOTE_AUDIBLE
-/datum/emote/brain/can_run_emote(mob/user, status_check = TRUE, intentional)
+/datum/emote/brain/can_run_emote(mob/user, status_check = TRUE, intentional, params)
. = ..()
var/mob/living/brain/B = user
if(!istype(B) || (!(B.container && istype(B.container, /obj/item/mmi))))
diff --git a/code/modules/mob/living/carbon/emote.dm b/code/modules/mob/living/carbon/emote.dm
index fd9807c32f1..3eb36e355b2 100644
--- a/code/modules/mob/living/carbon/emote.dm
+++ b/code/modules/mob/living/carbon/emote.dm
@@ -49,7 +49,7 @@
hands_use_check = TRUE
cooldown = 6 SECONDS
-/datum/emote/living/carbon/crack/can_run_emote(mob/living/carbon/user, status_check = TRUE , intentional)
+/datum/emote/living/carbon/crack/can_run_emote(mob/living/carbon/user, status_check = TRUE , intentional, params)
if(!iscarbon(user) || user.usable_hands < 2)
return FALSE
return ..()
@@ -104,8 +104,6 @@
/datum/emote/living/carbon/noogie/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(!.)
- return
var/obj/item/hand_item/noogie/noogie = new(user)
if(user.put_in_hands(noogie))
to_chat(user, span_notice("You ready your noogie'ing hand."))
@@ -154,8 +152,6 @@
/datum/emote/living/carbon/slap/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(!.)
- return
var/obj/item/hand_item/slapper/N = new(user)
if(user.put_in_hands(N))
to_chat(user, span_notice("You ready your slapping hand."))
@@ -172,9 +168,6 @@
/datum/emote/living/carbon/hand/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(!.)
- return
-
var/obj/item/hand_item/hand/hand = new(user)
if(user.put_in_hands(hand))
to_chat(user, span_notice("You ready your hand."))
@@ -204,8 +197,6 @@
/datum/emote/living/carbon/shoesteal/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if (!.)
- return
var/obj/item/hand_item/stealer/stealing_hand = new(user)
if (user.put_in_hands(stealing_hand))
user.balloon_alert(user, "preparing to steal shoes...")
diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm
index be35872ed1a..501f3c782f2 100644
--- a/code/modules/mob/living/carbon/human/emote.dm
+++ b/code/modules/mob/living/carbon/human/emote.dm
@@ -18,7 +18,7 @@
message = "pushes up their glasses."
emote_type = EMOTE_VISIBLE
-/datum/emote/living/carbon/human/glasses/can_run_emote(mob/user, status_check = TRUE, intentional)
+/datum/emote/living/carbon/human/glasses/can_run_emote(mob/user, status_check = TRUE, intentional, params)
var/obj/eyes_slot = user.get_item_by_slot(ITEM_SLOT_EYES)
if(istype(eyes_slot, /obj/item/clothing/glasses/regular) || istype(eyes_slot, /obj/item/clothing/glasses/sunglasses))
return ..()
@@ -66,9 +66,9 @@
only_forced_audio = TRUE
vary = TRUE
-/datum/emote/living/carbon/human/scream/run_emote(mob/user, params, type_override, intentional = FALSE)
+/datum/emote/living/carbon/human/scream/can_run_emote(mob/user, status_check = TRUE , intentional, params)
if(!intentional && HAS_TRAIT(user, TRAIT_ANALGESIA))
- return
+ return FALSE
return ..()
/datum/emote/living/carbon/human/scream/get_sound(mob/living/carbon/human/user)
@@ -119,8 +119,6 @@
/datum/emote/living/carbon/human/wag/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(!.)
- return
var/obj/item/organ/external/tail/oranges_accessory = user.get_organ_slot(ORGAN_SLOT_EXTERNAL_TAIL)
//I am so sorry my son
//We bypass helpers here cause we already have the tail
@@ -137,7 +135,7 @@
else
. = "wags " + message
-/datum/emote/living/carbon/human/wag/can_run_emote(mob/user, status_check, intentional)
+/datum/emote/living/carbon/human/wag/can_run_emote(mob/user, status_check, intentional, params)
var/obj/item/organ/external/tail/tail = user.get_organ_slot(ORGAN_SLOT_EXTERNAL_TAIL)
if(tail?.wag_flags & WAG_ABLE)
return ..()
@@ -150,8 +148,6 @@
/datum/emote/living/carbon/human/wing/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(!.)
- return
var/obj/item/organ/external/wings/functional/wings = user.get_organ_slot(ORGAN_SLOT_EXTERNAL_WINGS)
if(isnull(wings))
CRASH("[type] ran on a mob that has no wings!")
@@ -165,7 +161,7 @@
var/emote_verb = wings.wings_open ? "closes" : "opens"
return "[emote_verb] [message]"
-/datum/emote/living/carbon/human/wing/can_run_emote(mob/user, status_check = TRUE, intentional)
+/datum/emote/living/carbon/human/wing/can_run_emote(mob/user, status_check = TRUE, intentional, params)
if(!istype(user.get_organ_slot(ORGAN_SLOT_EXTERNAL_WINGS), /obj/item/organ/external/wings/functional))
return FALSE
return ..()
@@ -178,7 +174,7 @@
///Snowflake emotes only for le epic chimp
/datum/emote/living/carbon/human/monkey
-/datum/emote/living/carbon/human/monkey/can_run_emote(mob/user, status_check = TRUE, intentional)
+/datum/emote/living/carbon/human/monkey/can_run_emote(mob/user, status_check = TRUE, intentional, params)
if(ismonkey(user))
return ..()
return FALSE
diff --git a/code/modules/mob/living/emote.dm b/code/modules/mob/living/emote.dm
index 7a0a001fb4b..cb6ca3252df 100644
--- a/code/modules/mob/living/emote.dm
+++ b/code/modules/mob/living/emote.dm
@@ -63,9 +63,9 @@
/datum/emote/living/collapse/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(. && isliving(user))
- var/mob/living/L = user
- L.Unconscious(40)
+ if(isliving(user))
+ var/mob/living/living = user
+ living.Unconscious(4 SECONDS)
/datum/emote/living/dance
key = "dance"
@@ -95,7 +95,7 @@
message_animal_or_basic = custom_message
. = ..()
message_animal_or_basic = initial(message_animal_or_basic)
- if(!. && !user.can_speak() || user.getOxyLoss() >= 50)
+ if(!user.can_speak() || user.getOxyLoss() >= 50)
return //stop the sound if oxyloss too high/cant speak
var/mob/living/carbon/carbon_user = user
// For masks that give unique death sounds
@@ -117,9 +117,9 @@
/datum/emote/living/faint/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(. && isliving(user))
- var/mob/living/L = user
- L.SetSleeping(200)
+ if(isliving(user))
+ var/mob/living/living = user
+ living.SetSleeping(20 SECONDS)
/datum/emote/living/flap
key = "flap"
@@ -130,7 +130,7 @@
/datum/emote/living/flap/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(. && ishuman(user))
+ if(ishuman(user))
var/mob/living/carbon/human/human_user = user
var/open = FALSE
var/obj/item/organ/external/wings/functional/wings = human_user.get_organ_slot(ORGAN_SLOT_EXTERNAL_WINGS)
@@ -233,8 +233,6 @@
/datum/emote/living/jump/run_emote(mob/living/user, params, type_override, intentional)
. = ..()
- if(!.)
- return FALSE
animate(user, pixel_y = user.pixel_y + 4, time = 0.1 SECONDS)
animate(pixel_y = user.pixel_y - 4, time = 0.1 SECONDS)
@@ -248,8 +246,6 @@
/datum/emote/living/kiss/run_emote(mob/living/user, params, type_override, intentional)
. = ..()
- if(!.)
- return
var/kiss_type = /obj/item/hand_item/kisser
if(HAS_TRAIT(user, TRAIT_KISS_OF_DEATH))
@@ -271,7 +267,7 @@
audio_cooldown = 5 SECONDS
vary = TRUE
-/datum/emote/living/laugh/can_run_emote(mob/living/user, status_check = TRUE , intentional)
+/datum/emote/living/laugh/can_run_emote(mob/living/user, status_check = TRUE , intentional, params)
return ..() && user.can_speak(allow_mimes = TRUE)
/datum/emote/living/laugh/get_sound(mob/living/carbon/human/user)
@@ -334,7 +330,7 @@
audio_cooldown = 5 SECONDS
emote_type = EMOTE_VISIBLE | EMOTE_AUDIBLE | EMOTE_RUNECHAT
-/datum/emote/living/cough/can_run_emote(mob/user, status_check = TRUE , intentional)
+/datum/emote/living/cough/can_run_emote(mob/user, status_check = TRUE , intentional, params)
return !HAS_TRAIT(user, TRAIT_SOOTHED_THROAT) && ..()
/datum/emote/living/cough/get_sound(mob/living/carbon/human/user)
@@ -385,8 +381,6 @@
#define SHIVER_LOOP_DURATION (1 SECONDS)
/datum/emote/living/shiver/run_emote(mob/living/user, params, type_override, intentional)
. = ..()
- if(!.)
- return FALSE
animate(user, pixel_x = user.pixel_x + 1, time = 0.1 SECONDS)
for(var/i in 1 to SHIVER_LOOP_DURATION / (0.2 SECONDS)) //desired total duration divided by the iteration duration to give the necessary iteration count
animate(pixel_x = user.pixel_x - 1, time = 0.1 SECONDS)
@@ -463,10 +457,10 @@
/datum/emote/living/surrender/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(. && isliving(user))
- var/mob/living/L = user
- L.Paralyze(200)
- L.remove_status_effect(/datum/status_effect/grouped/surrender)
+ if(isliving(user))
+ var/mob/living/living = user
+ living.Paralyze(20 SECONDS)
+ living.remove_status_effect(/datum/status_effect/grouped/surrender)
/datum/emote/living/sway
key = "sway"
@@ -475,8 +469,6 @@
/datum/emote/living/sway/run_emote(mob/living/user, params, type_override, intentional)
. = ..()
- if(!.)
- return FALSE
animate(user, pixel_x = user.pixel_x + 2, time = 0.5 SECONDS)
for(var/i in 1 to 2)
animate(pixel_x = user.pixel_x - 4, time = 1.0 SECONDS)
@@ -496,8 +488,6 @@
#define TREMBLE_LOOP_DURATION (4.4 SECONDS)
/datum/emote/living/tremble/run_emote(mob/living/user, params, type_override, intentional)
. = ..()
- if(!.)
- return FALSE
animate(user, pixel_x = user.pixel_x + 2, time = 0.2 SECONDS)
for(var/i in 1 to TREMBLE_LOOP_DURATION / (0.4 SECONDS)) //desired total duration divided by the iteration duration to give the necessary iteration count
animate(pixel_x = user.pixel_x - 2, time = 0.2 SECONDS)
@@ -512,8 +502,6 @@
/datum/emote/living/twitch/run_emote(mob/living/user, params, type_override, intentional)
. = ..()
- if(!.)
- return FALSE
animate(user, pixel_x = user.pixel_x - 1, time = 0.1 SECONDS)
animate(pixel_x = user.pixel_x + 1, time = 0.1 SECONDS)
animate(time = 0.1 SECONDS)
@@ -527,8 +515,6 @@
/datum/emote/living/twitch_s/run_emote(mob/living/user, params, type_override, intentional)
. = ..()
- if(!.)
- return FALSE
animate(user, pixel_x = user.pixel_x - 1, time = 0.1 SECONDS)
animate(pixel_x = user.pixel_x + 1, time = 0.1 SECONDS)
@@ -618,8 +604,36 @@
key_third_person = "custom"
message = null
-/datum/emote/living/custom/can_run_emote(mob/user, status_check, intentional)
- . = ..() && intentional
+/datum/emote/living/custom/can_run_emote(mob/user, status_check, intentional, params)
+ . = ..()
+ if(!. || !intentional)
+ return FALSE
+
+ if(!isnull(user.ckey) && is_banned_from(user.ckey, "Emote"))
+ to_chat(user, span_boldwarning("You cannot send custom emotes (banned)."))
+ return FALSE
+
+ if(QDELETED(user))
+ return FALSE
+
+ if(user.client && user.client.prefs.muted & MUTE_IC)
+ to_chat(user, span_boldwarning("You cannot send IC messages (muted)."))
+ return FALSE
+
+ var/our_message = params ? params : get_custom_emote_from_user()
+
+ if(!emote_is_valid(user, our_message))
+ return FALSE
+
+ if(!params)
+ var/user_emote_type = get_custom_emote_type_from_user()
+
+ if(!user_emote_type)
+ return FALSE
+
+ emote_type = user_emote_type
+
+ message = our_message
/datum/emote/living/custom/proc/emote_is_valid(mob/user, input)
// We're assuming clientless mobs custom emoting is something codebase-driven and not player-driven.
@@ -678,40 +692,11 @@
return FALSE
/datum/emote/living/custom/run_emote(mob/user, params, type_override = null, intentional = FALSE)
- if(!can_run_emote(user, TRUE, intentional))
- return FALSE
-
- if(!isnull(user.ckey) && is_banned_from(user.ckey, "Emote"))
- to_chat(user, span_boldwarning("You cannot send custom emotes (banned)."))
- return FALSE
-
- if(QDELETED(user))
- return FALSE
-
- if(user.client && user.client.prefs.muted & MUTE_IC)
- to_chat(user, span_boldwarning("You cannot send IC messages (muted)."))
- return FALSE
-
- message = params ? params : get_custom_emote_from_user()
-
- if(!emote_is_valid(user, message))
- message = null
- return FALSE
-
- if(!params)
- var/user_emote_type = get_custom_emote_type_from_user()
-
- if(!user_emote_type)
- return FALSE
-
- emote_type = user_emote_type
- else if(type_override)
+ if(params && type_override)
emote_type = type_override
-
message = user.say_emphasis(message) //SKYRAT EDIT ADDITION - EMOTES
-
. = ..()
-
+ ///Reset the message and emote type after it's run.
message = null
emote_type = EMOTE_VISIBLE
diff --git a/code/modules/mob/living/silicon/ai/emote.dm b/code/modules/mob/living/silicon/ai/emote.dm
index 8050ff1d0a0..c4ec04e0899 100644
--- a/code/modules/mob/living/silicon/ai/emote.dm
+++ b/code/modules/mob/living/silicon/ai/emote.dm
@@ -9,12 +9,6 @@
/datum/emote/ai/emotion_display/run_emote(mob/living/silicon/ai/user, params, type_override, intentional)
. = ..()
- if(!.)
- return
-
- if(!istype(user))
- return
-
user.apply_emote_display(emotion)
/datum/emote/ai/emotion_display/very_happy
@@ -72,9 +66,6 @@
/datum/emote/ai/emotion_display/friend_computer/run_emote(mob/user, params, type_override, intentional)
. = ..()
- if(!.)
- return
-
var/datum/radio_frequency/frequency = SSradio.return_frequency(FREQ_STATUS_DISPLAYS)
if(!frequency)
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index 2f29a77f26f..2fcc3613a92 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -11,7 +11,7 @@
post_tipped_callback = CALLBACK(src, PROC_REF(after_tip_over)), \
post_untipped_callback = CALLBACK(src, PROC_REF(after_righted)), \
roleplay_friendly = TRUE, \
- roleplay_emotes = list(/datum/emote/silicon/buzz, /datum/emote/silicon/buzz2, /datum/emote/silicon/beep), \
+ roleplay_emotes = list(/datum/emote/silicon/buzz, /datum/emote/silicon/buzz2, /datum/emote/silicon/beep, /datum/emote/silicon/beep2), /* SKYRAT EDIT CHANGE - ORIGINAL: roleplay_emotes = list(/datum/emote/silicon/buzz, /datum/emote/silicon/buzz2, /datum/emote/silicon/beep)*/ \
roleplay_callback = CALLBACK(src, PROC_REF(untip_roleplay)))
set_wires(new /datum/wires/robot(src))