Electro-tethers (#10117)

Added a box of eight electro-tethers to the RD's secure locker.
This commit is contained in:
Geeves
2020-10-02 08:53:46 +03:00
committed by GitHub
parent 556f1aa86f
commit 8d3feebf3b
7 changed files with 162 additions and 22 deletions
@@ -316,6 +316,15 @@
desc = "A box of varied assortment of firing pins. Appears to have R&D stickers on all sides of the box. Also seems to have a smiley face sticker on the top of it."
starts_with = list(/obj/item/device/firing_pin = 2, /obj/item/device/firing_pin/access = 2, /obj/item/device/firing_pin/implant/loyalty = 2, /obj/item/device/firing_pin/clown = 1, /obj/item/device/firing_pin/dna = 1)
/obj/item/storage/box/tethers
name = "box of tethering devices"
desc = "A box containing eight electro-tethers, used primarily to keep track of partners during expeditions."
starts_with = list(/obj/item/tethering_device = 8)
/obj/item/storage/box/tethers/fill()
..()
make_exact_fit()
/obj/item/storage/box/teargas
name = "box of pepperspray grenades"
desc = "A box containing 7 tear gas grenades. A gas mask is printed on the label.<br> WARNING: Exposure carries risk of serious injury or death. Keep away from persons with lung conditions."
+86
View File
@@ -0,0 +1,86 @@
var/list/global/all_tethers = list()
/obj/item/tethering_device
name = "tethering device"
desc = "A device used by explorers to keep track of partners by way of electro-tether."
desc_info = "Use in-hand to activate, must be on the same level and within fifteen tiles of another device to latch. Tethers are colour coded by distance."
icon = 'icons/obj/device.dmi'
icon_state = "locator"
w_class = ITEMSIZE_SMALL
slot_flags = SLOT_BELT
force = 1
var/active = FALSE
var/list/linked_tethers = list()
var/tether_range = 15
var/list/active_beams = list()
/obj/item/tethering_device/Initialize(mapload, ...)
. = ..()
all_tethers += src
/obj/item/tethering_device/Destroy()
STOP_PROCESSING(SSprocessing, src)
deactivate()
all_tethers -= src
return ..()
/obj/item/tethering_device/attack_self(mob/user)
active = !active
var/msg = "You [active ? "activate" : "deactivate"] \the [src]."
to_chat(user, SPAN_NOTICE(msg))
if(active)
activate()
else
deactivate()
/obj/item/tethering_device/process()
var/turf/our_turf = get_turf(src)
for(var/tether in all_tethers)
var/obj/item/tethering_device/TD = tether
if(TD == src)
continue
if(!TD.active)
continue
var/turf/target_turf = get_turf(TD)
if(our_turf == target_turf)
continue
if(target_turf.z != our_turf.z)
continue
if(get_dist(target_turf, our_turf) > tether_range)
continue
if(TD in linked_tethers)
continue
if(src in TD.linked_tethers)
continue
tether(TD)
/obj/item/tethering_device/emp_act()
deactivate()
/obj/item/tethering_device/proc/activate()
START_PROCESSING(SSprocessing, src)
/obj/item/tethering_device/proc/deactivate()
STOP_PROCESSING(SSprocessing, src)
for(var/beam in active_beams)
var/datum/beam/exploration/B = active_beams[beam]
B.End()
for(var/tether in all_tethers)
var/obj/item/tethering_device/TD = tether
TD.untether(src)
/obj/item/tethering_device/proc/tether(var/obj/item/tethering_device/TD)
linked_tethers |= TD
var/datum/beam/exploration/B = new /datum/beam/exploration(src, TD, beam_icon_state = "explore_beam", time = -1, maxdistance = tether_range)
B.owner = src
B.Start()
active_beams[TD] = B
// untethering logic is primarily dictated by the beam itself, who will end if the max distance is reached, and call this proc
/obj/item/tethering_device/proc/untether(var/obj/item/tethering_device/TD, var/destroy_beam = TRUE)
linked_tethers -= TD
if(!destroy_beam)
return
var/datum/beam/exploration/B = active_beams[TD]
if(B)
B.End()
@@ -47,6 +47,7 @@
new /obj/item/storage/box/firingpinsRD(src)
new /obj/item/device/pin_extractor(src)
new /obj/item/storage/box/fancy/keypouch/sci(src)
new /obj/item/storage/box/tethers(src)
/obj/structure/closet/secure_closet/RD2
name = "research director's attire"