Ports "Cleans up saycode by removing random hook stubs and using a signal where relevant"

This commit is contained in:
Ghommie
2019-07-09 07:58:22 +02:00
parent d61732472c
commit 490ae9daf2
63 changed files with 523 additions and 452 deletions
+7 -3
View File
@@ -15,6 +15,7 @@
ADD_TRAIT(owner, TRAIT_PUSHIMMUNE, TRAIT_HULK)
owner.update_body_parts()
SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "hulk", /datum/mood_event/hulk)
RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
/datum/mutation/human/hulk/on_attack_hand(mob/living/carbon/human/owner, atom/target, proximity)
if(proximity) //no telekinetic hulk attack
@@ -32,8 +33,11 @@
REMOVE_TRAIT(owner, TRAIT_PUSHIMMUNE, TRAIT_HULK)
owner.update_body_parts()
SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "hulk")
UnregisterSignal(owner, COMSIG_MOB_SAY)
/datum/mutation/human/hulk/say_mod(message)
/datum/mutation/human/hulk/proc/handle_speech(original_message, wrapped_message)
var/message = wrapped_message[1]
if(message)
message = "[uppertext(replacetext(message, ".", "!"))]!!"
return message
message = "[replacetext(message, ".", "!")]!!"
wrapped_message[1] = message
return COMPONENT_UPPERCASE_SPEECH
+87 -35
View File
@@ -17,9 +17,20 @@
text_gain_indication = "<span class='sans'>You feel an off sensation in your voicebox.</span>"
text_lose_indication = "<span class='notice'>The off sensation passes.</span>"
/datum/mutation/human/wacky/get_spans()
return list(SPAN_SANS)
/datum/mutation/human/wacky/on_acquiring(mob/living/carbon/human/owner)
. = ..()
if(.)
return
RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
/datum/mutation/human/wacky/on_losing(mob/living/carbon/human/owner)
. = ..()
if(.)
return
UnregisterSignal(owner, COMSIG_MOB_SAY)
/datum/mutation/human/wacky/proc/handle_speech(datum/source, list/speech_args)
speech_args[SPEECH_SPANS] |= SPAN_SANS
/datum/mutation/human/mute
name = "Mute"
@@ -28,12 +39,14 @@
text_lose_indication = "<span class='danger'>You feel able to speak freely again.</span>"
/datum/mutation/human/mute/on_acquiring(mob/living/carbon/human/owner)
if(..())
. = ..()
if(.)
return
ADD_TRAIT(owner, TRAIT_MUTE, GENETIC_MUTATION)
/datum/mutation/human/mute/on_losing(mob/living/carbon/human/owner)
if(..())
. = ..()
if(.)
return
REMOVE_TRAIT(owner, TRAIT_MUTE, GENETIC_MUTATION)
@@ -45,7 +58,20 @@
text_gain_indication = "<span class='notice'>You feel so happy. Nothing can be wrong with anything. :)</span>"
text_lose_indication = "<span class='notice'>Everything is terrible again. :(</span>"
/datum/mutation/human/smile/say_mod(message)
/datum/mutation/human/smile/on_acquiring(mob/living/carbon/human/owner)
. = ..()
if(.)
return
RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
/datum/mutation/human/smile/on_losing(mob/living/carbon/human/owner)
. = ..()
if(.)
return
UnregisterSignal(owner, COMSIG_MOB_SAY)
/datum/mutation/human/smile/proc/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(message)
message = " [message] "
//Time for a friendly game of SS13
@@ -92,7 +118,7 @@
message = replacetext(message," cunt "," privates ")
message = replacetext(message," dick "," jerk ")
message = replacetext(message," vagina "," privates ")
return trim(message)
speech_args[SPEECH_MESSAGE] = trim(message)
/datum/mutation/human/unintelligible
@@ -102,30 +128,17 @@
text_gain_indication = "<span class='danger'>You can't seem to form any coherent thoughts!</span>"
text_lose_indication = "<span class='danger'>Your mind feels more clear.</span>"
/datum/mutation/human/unintelligible/say_mod(message)
if(message)
var/prefix=copytext(message,1,2)
if(prefix == ";")
message = copytext(message,2)
else if(prefix in list(":","#"))
prefix += copytext(message,2,3)
message = copytext(message,3)
else
prefix=""
/datum/mutation/human/unintelligible/on_acquiring(mob/living/carbon/human/owner)
. = ..()
if(.)
return
ADD_TRAIT(owner, TRAIT_UNINTELLIGIBLE_SPEECH, GENETIC_MUTATION)
var/list/words = splittext(message," ")
var/list/rearranged = list()
for(var/i=1;i<=words.len;i++)
var/cword = pick(words)
words.Remove(cword)
var/suffix = copytext(cword,length(cword)-1,length(cword))
while(length(cword)>0 && suffix in list(".",",",";","!",":","?"))
cword = copytext(cword,1 ,length(cword)-1)
suffix = copytext(cword,length(cword)-1,length(cword) )
if(length(cword))
rearranged += cword
message ="[prefix][jointext(rearranged," ")]"
return message
/datum/mutation/human/unintelligible/on_losing(mob/living/carbon/human/owner)
. = ..()
if(.)
return
REMOVE_TRAIT(owner, TRAIT_UNINTELLIGIBLE_SPEECH, GENETIC_MUTATION)
/datum/mutation/human/swedish
@@ -135,7 +148,20 @@
text_gain_indication = "<span class='notice'>You feel Swedish, however that works.</span>"
text_lose_indication = "<span class='notice'>The feeling of Swedishness passes.</span>"
/datum/mutation/human/swedish/say_mod(message)
/datum/mutation/human/swedish/on_acquiring(mob/living/carbon/human/owner)
. = ..()
if(.)
return
RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
/datum/mutation/human/swedish/on_losing(mob/living/carbon/human/owner)
. = ..()
if(.)
return
UnregisterSignal(owner, COMSIG_MOB_SAY)
/datum/mutation/human/swedish/proc/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(message)
message = replacetext(message,"w","v")
message = replacetext(message,"j","y")
@@ -144,7 +170,7 @@
message = replacetext(message,"o",pick("","","o"))
if(prob(30))
message += " Bork[pick("",", bork",", bork, bork")]!"
return message
speech_args[SPEECH_MESSAGE] = trim(message)
/datum/mutation/human/chav
@@ -154,7 +180,20 @@
text_gain_indication = "<span class='notice'>Ye feel like a reet prat like, innit?</span>"
text_lose_indication = "<span class='notice'>You no longer feel like being rude and sassy.</span>"
/datum/mutation/human/chav/say_mod(message)
/datum/mutation/human/chav/on_acquiring(mob/living/carbon/human/owner)
. = ..()
if(.)
return
RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
/datum/mutation/human/chav/on_losing(mob/living/carbon/human/owner)
. = ..()
if(.)
return
UnregisterSignal(owner, COMSIG_MOB_SAY)
/datum/mutation/human/chav/proc/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(message)
message = " [message] "
message = replacetext(message," looking at "," gawpin' at ")
@@ -178,7 +217,7 @@
message = replacetext(message," break "," do ")
message = replacetext(message," your "," yer ")
message = replacetext(message," security "," coppers ")
return trim(message)
speech_args[SPEECH_MESSAGE] = trim(message)
/datum/mutation/human/elvis
@@ -199,7 +238,20 @@
if(prob(15))
owner.visible_message("<b>[owner]</b> [pick("jiggles their hips", "rotates their hips", "gyrates their hips", "taps their foot", "dances to an imaginary song", "jiggles their legs", "snaps their fingers")]!")
/datum/mutation/human/elvis/say_mod(message)
/datum/mutation/human/elvis/on_acquiring(mob/living/carbon/human/owner)
. = ..()
if(.)
return
RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
/datum/mutation/human/elvis/on_losing(mob/living/carbon/human/owner)
. = ..()
if(.)
return
UnregisterSignal(owner, COMSIG_MOB_SAY)
/datum/mutation/human/elvis/proc/handle_speech(datum/source, list/speech_args)
var/message = speech_args[SPEECH_MESSAGE]
if(message)
message = " [message] "
message = replacetext(message," i'm not "," I aint ")
@@ -211,7 +263,7 @@
message = replacetext(message," yes ",pick(" sure", "yea "))
message = replacetext(message," faggot "," square ")
message = replacetext(message," muh valids "," getting my kicks ")
return trim(message)
speech_args[SPEECH_MESSAGE] = trim(message)
/datum/mutation/human/stoner