Files
Paradise/code/game/objects/items/devices/voice_changer.dm
T
warriorstar-orionandGitHub 525c68d617 Attack chain, initial setup. (pull *immediately* for *any* TM issues) (#26834)
* refactor: Attack chain, initial setup.

* migrate curtain to make dreamchecker happy

* update thurible

* don't call attacked_by separately for legacy attack chain

* remove duplicate proc

* condense similar code, put allowances for legacy code in new procs

* update docs, include diagram source

* add comment on how to update diagram

* fix admonition

* mindflayer updates

* remove commented out code

* clarify all steps

* after_attack should be overridable

* whoops

* retrofit recent changes

* duh, can't restrict this yet because of tool_acts

* i hate ore bags with the fire of a thousand suns

* return correct value for object attack logic

* Various cleanups.

We don't want to attempt to pull stuff out of `/obj/item/attackby`,
because those pieces are part of the related objects' migrations, not
`/obj/item` itself. Attempting to do this causes knockon effects where
things expected to call e.g. `/obj/item/storage/attackby` in the call
chain were not ferried over to the new item interaction code, because
the related objects hadn't actually been migrated over yet.

I've used refactoring /obj/vehicle as the example for migrating
`attackby` methods instead.

* simplify some argument names

* fuck it

* make it do the thing

* Rename CI module call

* Prove that CI works

* improve test output

* aaand fix it again

* fix curtain tool interactions

* fix compile error

* fix compile error

* Better docs, introduce migration plan tool.
2024-12-02 23:36:36 +00:00

51 lines
1.5 KiB
Plaintext

/obj/item/voice_changer
name = "voice changer"
desc = "A voice mimicking module."
icon = 'icons/obj/device.dmi'
icon_state = "voice_changer_off"
actions_types = list(/datum/action/item_action/voice_changer/toggle, /datum/action/item_action/voice_changer/voice)
var/obj/item/parent
var/voice
var/active
/obj/item/voice_changer/New()
. = ..()
if(isitem(loc))
parent = loc
parent.actions |= actions
/obj/item/voice_changer/Destroy()
if(isitem(parent))
parent.actions -= actions
return ..()
/obj/item/voice_changer/attack_self__legacy__attackchain(mob/user)
active = !active
icon_state = "voice_changer_[active ? "on" : "off"]"
to_chat(user, "<span class='notice'>You toggle [src] [active ? "on" : "off"].</span>")
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtons()
/obj/item/voice_changer/proc/set_voice(mob/user)
var/chosen_voice = tgui_input_text(user, "What voice would you like to mimic? Leave this empty to use the voice on your ID card.", "Set Voice Changer")
if(!chosen_voice)
voice = null
to_chat(user, "<span class='notice'>You are now mimicking the voice on your ID card.</span>")
return
voice = sanitize_for_ic(copytext_char(chosen_voice, 1, MAX_MESSAGE_LEN))
to_chat(user, "<span class='notice'>You are now mimicking <b>[voice]</b>.</span>")
/obj/item/voice_changer/voice_modulator
name = "voice modulator"
desc = "A voice scrambling module."
voice = "Unknown"
actions_types = list(/datum/action/item_action/voice_changer/toggle)