Files
Bubberstation/code/game/objects/items/devices/megaphone.dm
vuonojenmustaturska 2d74a86353 [READY] Cleans up saycode by removing random hook stubs and using a signal where relevant (#44320)
About The Pull Request

This PR removes speech message and span hooks from dna, mutations, pierrot throat disease, species, tongues, masks, hats, held items, brain traumas and a carbon proc overload handling tonguelessness.

Tonguelessness is now handled by tongue removal registering for the speech signal and the hook being deregistered by having a tongue put in.

Also cleans up some /atom/movable/proc/get_spans() overloads that called the empty parent or overloaded the parent to do the exact same thing as the parent proc did.

Also cleans up calls to radio.talk_into() where the caller would often, as a result of copypasta, provide the proc with fresh copies of the proc's default values for proc args, and makes say_quote() better by giving it a default spans value so that none of the callers have to provide the same default one.
Why It's Good For The Game
Changelog

cl Naksu
code: Cleaned up saycode
/cl

* start with this

* oh man this looks so good

* hats are dead

* /obj/item/proc/speechModification is dead

* brain traumas and get_held_item_speechspans() are dead

* these should be static

* unfortunately we still need this

* /mob/living/carbon/treat_message(message) is kill

* clean up get_spans()

* dunk get_spans, modifies_speech for brain traumas, some superfluous static stuff

* move stuff around

* return values
2019-06-06 18:35:06 +12:00

64 lines
2.1 KiB
Plaintext

/obj/item/megaphone
name = "megaphone"
desc = "A device used to project your voice. Loudly."
icon = 'icons/obj/device.dmi'
icon_state = "megaphone"
item_state = "radio"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
w_class = WEIGHT_CLASS_SMALL
siemens_coefficient = 1
var/spamcheck = 0
var/list/voicespan = list(SPAN_COMMAND)
/obj/item/megaphone/suicide_act(mob/living/carbon/user)
user.visible_message("<span class='suicide'>[user] is uttering [user.p_their()] last words into \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
spamcheck = 0//so they dont have to worry about recharging
user.say("AAAAAAAAAAAARGHHHHH", forced="megaphone suicide")//he must have died while coding this
return OXYLOSS
/obj/item/megaphone/equipped(mob/M, slot)
. = ..()
if (slot == SLOT_HANDS)
RegisterSignal(M, COMSIG_MOB_SAY, .proc/handle_speech)
else
UnregisterSignal(M, COMSIG_MOB_SAY)
/obj/item/megaphone/dropped(mob/M)
. = ..()
UnregisterSignal(M, COMSIG_MOB_SAY)
/obj/item/megaphone/proc/handle_speech(mob/living/carbon/user, list/speech_args)
if (user.get_active_held_item() == src)
if(spamcheck > world.time)
to_chat(user, "<span class='warning'>\The [src] needs to recharge!</span>")
else
playsound(loc, 'sound/items/megaphone.ogg', 100, 0, 1)
spamcheck = world.time + 50
speech_args[SPEECH_SPANS] |= voicespan
/obj/item/megaphone/emag_act(mob/user)
if(obj_flags & EMAGGED)
return
to_chat(user, "<span class='warning'>You overload \the [src]'s voice synthesizer.</span>")
obj_flags |= EMAGGED
voicespan = list(SPAN_REALLYBIG, "userdanger")
/obj/item/megaphone/sec
name = "security megaphone"
icon_state = "megaphone-sec"
/obj/item/megaphone/command
name = "command megaphone"
icon_state = "megaphone-command"
/obj/item/megaphone/cargo
name = "supply megaphone"
icon_state = "megaphone-cargo"
/obj/item/megaphone/clown
name = "clown's megaphone"
desc = "Something that should not exist."
icon_state = "megaphone-clown"
voicespan = list(SPAN_CLOWN)