Files
Aurora.3/code/game/objects/structures/vr/_remote_chair.dm
Cody Brittain 9983fca311 Update SSOverlays (ported from Baystation) (#19051)
Our SSOverlays system is outdated, and is likely the cause of many of
the issues seen in #18895. It has also been linked to a massive server
performance decrease.

This brings an updated system from Baystation, hopefully with speed
increases.

Should be testmerged, ideally with #18895.

---------

Co-authored-by: Cody Brittain <cbrittain10@live.com>
2024-05-01 07:46:27 +00:00

70 lines
2.2 KiB
Plaintext

/obj/structure/bed/stool/chair/remote
name = "virtual reality centre"
desc = "A comfortable chair with full audio-visual transposition centres."
icon_state = "shuttlechair_preview"
base_icon = "shuttlechair"
var/portable_type
can_dismantle = FALSE
var/remote_network // Which network does this remote control belong to?
held_item = null
/obj/structure/bed/stool/chair/remote/Initialize()
. = ..()
if(portable_type)
name = "portable [name]"
/obj/structure/bed/stool/chair/remote/Destroy()
STOP_PROCESSING(SSprocessing, src)
return ..()
/obj/structure/bed/stool/chair/remote/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
. = ..()
if(portable_type)
. += FONT_SMALL(SPAN_NOTICE("Can be packed up by using a wrench on it."))
/obj/structure/bed/stool/chair/remote/update_icon()
return
/obj/structure/bed/stool/chair/remote/attackby(obj/item/attacking_item, mob/user)
if(portable_type && attacking_item.iswrench())
user.visible_message(SPAN_NOTICE("\The [user] starts dismantling \the [src]..."), SPAN_NOTICE("You start dismantling \the [src]..."))
if(do_after(user, 20 SECONDS, src, DO_REPAIR_CONSTRUCT))
user.visible_message(SPAN_NOTICE("\The [user] dismantles \the [src]."), SPAN_NOTICE("You dismantle \the [src]."))
var/obj/kit = new portable_type(get_turf(src))
user.put_in_hands(kit)
qdel(src)
return
..()
/obj/structure/bed/stool/chair/remote/user_buckle(mob/user)
..()
var/area/A = get_area(src)
if(!A.powered(EQUIP))
to_chat(user, SPAN_WARNING("\The [src] is not powered."))
return FALSE
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.old_mob)
to_chat(H, SPAN_WARNING("The chair rejects you! You cannot recursively control bodies."))
return
AddOverlays(image('icons/obj/furniture.dmi', src, "vr_helmet", FLY_LAYER))
START_PROCESSING(SSprocessing, src)
/obj/structure/bed/stool/chair/remote/process()
..()
if(buckled)
var/area/A = get_area(src)
if(!A.powered(EQUIP))
user_unbuckle(buckled)
// Return to our body in the unfortunate event that we get unbuckled while plugged in
/obj/structure/bed/stool/chair/remote/user_unbuckle(mob/user)
if(buckled)
var/mob/M = buckled
if(istype(M) && M.vr_mob)
M.vr_mob.body_return()
ClearOverlays()
STOP_PROCESSING(SSprocessing, src)
..()