Files
Bubberstation/code/modules/wiremod/components/bci/vox.dm
Kapu1178 6d470992cb This tail refactor turned into an organ refactor. Funny how that works. (#67017)
* Fuck you (refactors ur tails)

* Errors

* Wow. Pain.

* Fixes up probably everything

* finish up here

* Fixes hard del maybe

* original owner hard del

* garbage collection runtime

* suck my peen byond

* Mapped tails

* motherfucker.

* motherrfucker. again.

* Whooopppppsie

* yeah bad idea

* Turns out external organs literally just sat in nullspace forever if their parent was deleted, and didnt Remove() themselves, causing harddels.

* So anyways I repathed all organs

* Fixes

* really.

* unit test... test

* unit test-test but it passes linters this time because im a moh-ron

* I've lost track of what im doing at this point

* Hopefully fixes hard del?

* meh

* Update code/datums/dna.dm

* things n stuff

* repath from master pull
2022-05-30 21:18:34 -07:00

60 lines
1.7 KiB
Plaintext

/**
* # VOX Announcement Component
*
* These play a VOX announcement with inputed words from either a string or a list.
* Requires a BCI shell.
*/
/obj/item/circuit_component/vox
display_name = "VOX Announcement"
desc = "A component that plays a local VOX Announcement for the user. Requires a BCI shell."
category = "BCI"
required_shells = list(/obj/item/organ/internal/cyberimp/bci)
var/datum/port/input/option/type_option
var/current_type
var/datum/port/input/word_list
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL
var/obj/item/organ/internal/cyberimp/bci/bci
/obj/item/circuit_component/vox/populate_options()
type_option = add_option_port("VOX Type", list(PORT_TYPE_LIST(PORT_TYPE_STRING), PORT_TYPE_STRING))
/obj/item/circuit_component/vox/populate_ports()
word_list = add_input_port("Word List", PORT_TYPE_LIST(PORT_TYPE_STRING))
/obj/item/circuit_component/vox/register_shell(atom/movable/shell)
if(istype(shell, /obj/item/organ/internal/cyberimp/bci))
bci = shell
/obj/item/circuit_component/vox/unregister_shell(atom/movable/shell)
bci = null
/obj/item/circuit_component/vox/pre_input_received(datum/port/input/port)
var/current_option = type_option.value
if(current_type != current_option)
current_type = current_option
word_list.set_datatype(current_type)
/obj/item/circuit_component/vox/input_received(datum/port/input/port)
if(!bci)
return
var/mob/living/owner = bci.owner
if(!owner || !istype(owner) || !owner.client || !word_list.value)
return
if(current_type == PORT_TYPE_STRING)
var/words_list = splittext(trim(word_list.value), " ")
for(var/word in words_list)
play_vox_word(word, only_listener = owner)
else
for(var/word in word_list.value)
play_vox_word(word, only_listener = owner)