Skip to content

Commit

Permalink
add signal to mob/living/say
Browse files Browse the repository at this point in the history
  • Loading branch information
Legendaxe committed Oct 21, 2023
1 parent 6ec3713 commit 8e4b39c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
if(SEND_SIGNAL(src, COMSIG_LIVING_PROCESS_SPACEMOVE, movement_dir) & COMPONENT_BLOCK_SPACEMOVE)
return FALSE
. = ..()

/mob/living/say(message, verb, sanitize, ignore_speech_problems, ignore_atmospherics, ignore_languages)
SEND_SIGNAL(src, COMSIG_MOB_SAY, args)
. = ..()
24 changes: 20 additions & 4 deletions modular_ss220/clothing/code/mask.dm
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
/obj/item/clothing/mask
var/modifies_speech = FALSE

/obj/item/clothing/mask/proc/handle_speech(datum/source, list/speech_args)
SIGNAL_HANDLER

/obj/item/clothing/mask/equipped(mob/M, slot)
. = ..()

if ((slot & SLOT_HUD_WEAR_MASK) && modifies_speech)
RegisterSignal(M, COMSIG_MOB_SAY, PROC_REF(handle_speech))
else
UnregisterSignal(M, COMSIG_MOB_SAY)

/obj/item/clothing/mask/dropped(mob/M)
. = ..()
UnregisterSignal(M, COMSIG_MOB_SAY)

/obj/item/clothing/mask/fakemoustache/chef
name = "абсолютно настоящие усы шефа"
desc = "Осторожно: усы накладные."
modifies_speech = TRUE

/obj/item/clothing/mask/fakemoustache/chef/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(message[1] != "*")
var/static/regex/words = new(@"(?<![a-zA-Zа-яёА-ЯЁ])[a-zA-Zа-яёА-ЯЁ]+?(?![a-zA-Zа-яёА-ЯЁ])", "g")
message = replacetext(message, words, TYPE_PROC_REF(/obj/item/clothing/mask/fakemoustache/chef, words_replace))

if(prob(3))
if(prob(5))
message += pick(" Равиоли, равиоли, подскажи мне формуоли!"," Мамма-мия!"," Мамма-мия! Какая острая фрикаделька!", " Ла ла ла ла ла фуникули+ фуникуля+!")
speech_args[SPEECH_MESSAGE] = trim(message)

/obj/item/clothing/mask/fakemoustache/chef/proc/handle_speech()
SIGNAL_HANDLER

/obj/item/clothing/mask/fakemoustache/chef/proc/words_replace(word)
var/static/list/italian_words
if(!italian_words)
Expand Down
2 changes: 0 additions & 2 deletions strings/italian_replacement.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,4 @@
"почему так": "почему же так",
"почему": "почему же так"
}


}

0 comments on commit 8e4b39c

Please sign in to comment.