diff --git a/code/modules/research/designs/wiremod_designs.dm b/code/modules/research/designs/wiremod_designs.dm index 9807f705eb2..7ef6ef884fd 100644 --- a/code/modules/research/designs/wiremod_designs.dm +++ b/code/modules/research/designs/wiremod_designs.dm @@ -443,6 +443,15 @@ materials = list(/datum/material/glass = 2000, /datum/material/iron = 7000) category = list(RND_CATEGORY_CIRCUITRY, RND_CATEGORY_SHELLS) +/datum/design/keyboard_shell + name = "Keyboard Shell" + desc = "A handheld shell that allows the user to input a string" + id = "keyboard_shell" + build_path = /obj/item/keyboard_shell + materials = list(/datum/material/glass = 2000, /datum/material/iron = 10000) + build_type = PROTOLATHE | COMPONENT_PRINTER + category = list("Circuitry", "Shells") + /datum/design/gun_shell name = "Gun Shell" desc = "A handheld shell that can fire projectiles to output entities." diff --git a/code/modules/research/techweb/all_nodes.dm b/code/modules/research/techweb/all_nodes.dm index e18cbea2272..5ce3b9392ef 100644 --- a/code/modules/research/techweb/all_nodes.dm +++ b/code/modules/research/techweb/all_nodes.dm @@ -739,6 +739,7 @@ "dispenser_shell", "door_shell", "gun_shell", + "keyboard_shell", "module_shell", "money_bot_shell", "scanner_gate_shell", diff --git a/code/modules/wiremod/shell/keyboard.dm b/code/modules/wiremod/shell/keyboard.dm new file mode 100644 index 00000000000..89616859daa --- /dev/null +++ b/code/modules/wiremod/shell/keyboard.dm @@ -0,0 +1,56 @@ +/obj/item/keyboard_shell + name = "Keyboard Shell" + icon = 'icons/obj/wiremod.dmi' + icon_state = "setup_small_keyboard" + inhand_icon_state = "electronic" + worn_icon_state = "electronic" + lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi' + righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi' + light_system = MOVABLE_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_ATOM) + 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/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/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) + + diff --git a/icons/obj/wiremod.dmi b/icons/obj/wiremod.dmi index 0feb8b9c9a3..1d50c67823b 100644 Binary files a/icons/obj/wiremod.dmi and b/icons/obj/wiremod.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 289b1a3e70e..433b2b4cb39 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4668,6 +4668,7 @@ #include "code\modules\wiremod\shell\dispenser.dm" #include "code\modules\wiremod\shell\drone.dm" #include "code\modules\wiremod\shell\gun.dm" +#include "code\modules\wiremod\shell\keyboard.dm" #include "code\modules\wiremod\shell\module.dm" #include "code\modules\wiremod\shell\moneybot.dm" #include "code\modules\wiremod\shell\scanner.dm"