mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-05 22:43:46 +00:00
* TGUI input box conversions 2 (#63395) More text inputs converted to tgui, TGUI text and number input now more sanely handles ENTER key being pressed, you can now press anywhere in the window to enter the input. TGUI text input now considers placeholder text for the default valid state. IE, if there is default text you can press enter immediately without having to rewrite it just to recheck validity. Fixes: useSharedState => useLocalState. not only was sharedstate not needed but it opened up the ui to vulnerabilities * TGUI input box conversions 2 Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
/obj/item/beacon
|
|
name = "\improper tracking beacon"
|
|
desc = "A beacon used by a teleporter."
|
|
icon = 'icons/obj/device.dmi'
|
|
icon_state = "beacon"
|
|
inhand_icon_state = "beacon"
|
|
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
|
var/enabled = TRUE
|
|
var/renamed = FALSE
|
|
|
|
/obj/item/beacon/Initialize(mapload)
|
|
. = ..()
|
|
if (enabled)
|
|
GLOB.teleportbeacons += src
|
|
else
|
|
icon_state = "beacon-off"
|
|
|
|
/obj/item/beacon/Destroy()
|
|
GLOB.teleportbeacons -= src
|
|
return ..()
|
|
|
|
/obj/item/beacon/attack_self(mob/user)
|
|
enabled = !enabled
|
|
if (enabled)
|
|
icon_state = "beacon"
|
|
GLOB.teleportbeacons += src
|
|
else
|
|
icon_state = "beacon-off"
|
|
GLOB.teleportbeacons -= src
|
|
to_chat(user, span_notice("You [enabled ? "enable" : "disable"] the beacon."))
|
|
return
|
|
|
|
/obj/item/beacon/attackby(obj/item/W, mob/user)
|
|
if(istype(W, /obj/item/pen)) // needed for things that use custom names like the locator
|
|
var/new_name = tgui_input_text(user, "What would you like the name to be?", "Beacon", max_length = MAX_NAME_LEN)
|
|
if(!user.canUseTopic(src, BE_CLOSE))
|
|
return
|
|
if(new_name)
|
|
name = new_name
|
|
renamed = TRUE
|
|
return
|
|
else
|
|
return ..()
|