Files
VOREStation/code/modules/power/privacy_switch.dm
T
Kashargul 1fcbb216e7 Convert some more globals (#19231)
* move ref lists from world new to ref list creation

* tg styl

* .

* next globals

* ugh

* some more

* pain

* .

* horror

* .

* .

* .

* shoe me

* ye

* .

* eh

* .

* .

---------

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
2026-03-02 23:57:41 +01:00

42 lines
1.5 KiB
Plaintext

/obj/structure/privacyswitch
name = "privacy switch"
desc = "A special switch to increase the room's privavy. (Blocks ghosts from seeing the area, green indicates that ghosts are blocked.) Please disable this after use so that people can see the room is free more easily."
icon = 'icons/obj/power_vr.dmi'
icon_state = "privacy0"
var/nextUse = 0
/obj/structure/privacyswitch/Initialize(mapload)
var/area/A = get_area(src)
if(A?.flag_check(AREA_BLOCK_GHOST_SIGHT))
icon_state = "privacy1"
. = ..()
/obj/structure/privacyswitch/attack_ai(mob/user)
attack_hand()
return
/obj/structure/privacyswitch/attack_hand(mob/user)
if(nextUse - world.time > 0)
to_chat(user, span_warning("The area can not be altered so soon again!"))
return
var/area/A = get_area(src)
if(!A)
return
if(tgui_alert(user, "Do you want to toggle ghost vision for this area [A.flag_check(AREA_BLOCK_GHOST_SIGHT) ? "on" : "off"]?", "Toggle ghost vision?", list("Yes", "No")) != "Yes")
return
if(A.flag_check(AREA_BLOCK_GHOST_SIGHT))
A.flags ^= AREA_BLOCK_GHOST_SIGHT
icon_state = "privacy0"
GLOB.ghostnet.removeArea(A)
to_chat(user, span_notice("The area is no longer protected from ghost vison."))
log_and_message_admins("toggled ghost vision in [A] on.", user)
else
A.flags ^= AREA_BLOCK_GHOST_SIGHT
icon_state = "privacy1"
GLOB.ghostnet.addArea(A)
to_chat(user, span_notice("The area is now protected from ghost vison."))
log_and_message_admins("toggled ghost vision in [A] off.", user)
nextUse = world.time + 5 MINUTES