mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
42 lines
1.5 KiB
Plaintext
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"
|
|
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"
|
|
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
|