Files
Bubberstation/code/game/objects/items/devices/beacon.dm
SkyratBot 1ce77983df [MIRROR] canUseTopic now uses TRUE/FALSE instead of defines that just say TRUE [MDB IGNORE] (#16586)
* canUseTopic now uses TRUE/FALSE instead of defines that just say TRUE

* etes

* eyes

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2022-10-02 15:54:46 +01:00

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/items/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/items/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 = TRUE))
return
if(new_name)
name = new_name
renamed = TRUE
return
else
return ..()