Files
Bubberstation/code/modules/wiremod/shell/keyboard.dm
Joshua Kidder 3690bd3d8a Add distance output to direction circuit component, resizes several shells (#86577)
## About The Pull Request

The direction component outputs the direction of an entity if it's
within 7 tiles of the circuit. Since it already checks the distance, I
added distance as one of its outputs.

Besides that, I did a pass over the generics and shells and resized many
of them. Most I resized to be small or tiny, except for the airlock
shell, which I set to be bulky because it's a whole ass door. The shells
I didn't touch remain at 'normal' size.

1) All handheld shells set to small, compact remote set to tiny 
2) all components and the generic of the circuit set to tiny
3) drone shell set to small
4) airlock shell set to bulky
## Why It's Good For The Game

Returning the distance spares any would be circuiteers from having to do
a labyrinthine set of calculations to determine distance themselves.

Making most circuits more portable makes them more attractive for people
to tote around.
## Changelog
🆑 Bisar
qol: The 'direction' circuit component now also returns the distance of
its target.
balance: Most circuit shells and the generic component and generic
circuit have had their size reduced.
balance: The airlock circuit shell has had its size increased.
/🆑

---------

Co-authored-by: Metekillot <ubuntu@ip-172-26-7-23.us-east-2.compute.internal>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2024-09-14 22:54:07 +00:00

57 lines
2.0 KiB
Plaintext

/obj/item/keyboard_shell
name = "Keyboard Shell"
icon = 'icons/obj/science/circuits.dmi'
icon_state = "setup_small_keyboard"
inhand_icon_state = "electronic"
worn_icon_state = "electronic"
lefthand_file = 'icons/mob/inhands/items/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/items/devices_righthand.dmi'
light_system = OVERLAY_LIGHT_DIRECTIONAL
light_on = FALSE
w_class = WEIGHT_CLASS_SMALL
/obj/item/keyboard_shell/Initialize(mapload)
. = ..()
AddComponent(/datum/component/shell, list(
new /obj/item/circuit_component/keyboard_shell()
), SHELL_CAPACITY_SMALL)
/obj/item/circuit_component/keyboard_shell
display_name = "Keyboard Shell"
desc = "A handheld shell that allows the user to input a string. Use the shell in hand to open the input panel."
/// Called when the input window is closed
var/datum/port/output/signal
/// Entity who used the shell
var/datum/port/output/entity
/// The string, entity typed and submitted
var/datum/port/output/output
/obj/item/circuit_component/keyboard_shell/populate_ports()
entity = add_output_port("User", PORT_TYPE_USER)
output = add_output_port("Message", PORT_TYPE_STRING)
signal = add_output_port("Signal", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/keyboard_shell/register_shell(atom/movable/shell)
. = ..()
RegisterSignal(shell, COMSIG_ITEM_ATTACK_SELF, PROC_REF(send_trigger))
/obj/item/circuit_component/keyboard_shell/unregister_shell(atom/movable/shell)
UnregisterSignal(shell, COMSIG_ITEM_ATTACK_SELF)
return ..()
/obj/item/circuit_component/keyboard_shell/proc/send_trigger(atom/source, mob/user)
SIGNAL_HANDLER
INVOKE_ASYNC(src, PROC_REF(use_keyboard), user)
/obj/item/circuit_component/keyboard_shell/proc/use_keyboard(mob/user)
if(HAS_TRAIT(user, TRAIT_ILLITERATE))
to_chat(user, span_warning("You start mashing keys at random!"))
return
var/message = tgui_input_text(user, "Input your text", "Keyboard")
entity.set_output(user)
output.set_output(message)
signal.set_output(COMPONENT_SIGNAL)