Skip to content

Commit

Permalink
Megaphone fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AyIong committed Jan 18, 2024
1 parent 13a3d4f commit 0812ceb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions modular_ss220/text_to_speech/_tts.dme
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "code/tts_provider.dm"
#include "code/tts_seed.dm"
#include "code/tts_subsystem.dm"
#include "code/tts_megaphone.dm"

#include "code/base_seeds/mobs/_base.dm"
#include "code/base_seeds/mobs/alien.dm"
Expand Down
19 changes: 19 additions & 0 deletions modular_ss220/text_to_speech/code/tts_megaphone.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/obj/item/megaphone/say_msg(mob/living/user, message)
if(HAS_TRAIT(src, TRAIT_CMAGGED))
playsound(src, "sound/items/bikehorn.ogg", 50, TRUE)
else
playsound(src, "sound/items/megaphone.ogg", 100, FALSE, 5)

audible_message("<span class='game say'><span class='name'>[user.GetVoice()]</span> [user.GetAltName()] broadcasts, <span class='[span]'>\"[message]\"</span></span>", hearing_distance = 14)
log_say("(MEGAPHONE) [message]", user)
user.create_log(SAY_LOG, "(megaphone) '[message]'")
for(var/obj/O in view(14, get_turf(src)))
O.hear_talk(user, message_to_multilingual("<span class='[span]'>[message]</span>"))

for(var/mob/M in get_mobs_in_view(7, src))
if((M.client?.prefs.toggles2 & PREFTOGGLE_2_RUNECHAT) && M.can_hear())
M.create_chat_message(user, message, FALSE, "big")
var/effect = SOUND_EFFECT_MEGAPHONE
if(isrobot(user))
effect = SOUND_EFFECT_MEGAPHONE_ROBOT
INVOKE_ASYNC(GLOBAL_PROC, /proc/tts_cast, user, M, message, user.tts_seed, FALSE, effect)

0 comments on commit 0812ceb

Please sign in to comment.