Files
Bubberstation/code/game/objects/items/devices/beacon.dm
SkyratBot c23bd1cb8c [MIRROR] every case of initialize that should have mapload, does (#8374)
* every case of initialize that should have mapload, does

* E

Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
2021-09-24 23:07:53 +01:00

45 lines
1.1 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 = stripped_input(user, "What would you like the name to be?")
if(!user.canUseTopic(src, BE_CLOSE))
return
if(new_name)
name = new_name
renamed = TRUE
return
else
return ..()