Files
Bubberstation/code/game/objects/items/devices/beacon.dm
T
John Willard 91f02f2a6b canUseTopic now uses TRUE/FALSE instead of defines that just say TRUE (#69790)
* canUseTopic now uses TRUE/FALSE instead of defines that just say TRUE

The most idiotic thing I've seen is canUseTopic's defines, they literally just define TRUE, you can use it however you want, it doesn't matter, it just means TRUE. You can mix and match the args and it will set that arg to true, despite the name.

It's so idiotic I decided to remove it, so now I can reclaim a little bit of my sanity.
2022-10-01 09:47:52 -07: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 ..()