Files
Bubberstation/code/modules/wiremod/shell/keyboard.dm
SkyratBot 4f53ec2660 [MIRROR] Fixes complex lights not handling moving well, renames lighting defines (#26484)
* Fixes complex lights not handling moving well, renames lighting defines (#81423)

## About The Pull Request

[Fixes static lights not
moving](ffef43c05a)

Worked fine when the owner moved, but if the owner was inside something
else, it would try and trigger an update on the PARENT's lights, which
are obviously not us.

[Renames MOVABLE_LIGHT and STATIC_LIGHT to better describe what they
do](de73a63bd4)

People keep trying to change the lighting system of lamps and it makes
me mad.
I choose OVERLAY_LIGHT and COMPLEX_LIGHT here, I couldn't figure out a
better name for turf matrix lighting. Suggestions welcome

## Why It's Good For The Game

Closes #80005
Hopefully improves understanding of lighting at a glance
## Changelog
🆑
fix: Fixes fancy lights not updating their source location when picked
up and moved
/🆑

* Oh well

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
2024-02-12 22:25:22 +00:00

56 lines
1.9 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
/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)