mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 02:16:05 +00:00
Keycard Authenticator Devices have no delay and now provide actual feedback. (#26425)
* Makes keycard authenticators more usable * ridding spanners * feels like MySpace all over again * You can now use PDAs on keycard devices * Update keycard authentication.dm Co-authored-by: DamianX <DamianX@users.noreply.github.com> Co-authored-by: DamianX <DamianX@users.noreply.github.com>
This commit is contained in:
@@ -17,6 +17,7 @@ var/global/list/obj/machinery/keycard_auth/authenticators = list()
|
|||||||
var/ert_reason
|
var/ert_reason
|
||||||
//1 = select event
|
//1 = select event
|
||||||
//2 = authenticate
|
//2 = authenticate
|
||||||
|
req_one_access = list(access_keycard_auth)
|
||||||
anchored = 1.0
|
anchored = 1.0
|
||||||
use_power = 1
|
use_power = 1
|
||||||
idle_power_usage = 2
|
idle_power_usage = 2
|
||||||
@@ -28,26 +29,38 @@ var/global/list/obj/machinery/keycard_auth/authenticators = list()
|
|||||||
authenticators += src
|
authenticators += src
|
||||||
|
|
||||||
/obj/machinery/keycard_auth/attack_ai(mob/user as mob)
|
/obj/machinery/keycard_auth/attack_ai(mob/user as mob)
|
||||||
to_chat(user, "The station AI is not to interact with these devices.")
|
to_chat(user, "<span class='notice'>The station AI is not to interact with these devices.</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/machinery/keycard_auth/attack_paw(mob/user as mob)
|
/obj/machinery/keycard_auth/attack_paw(mob/user as mob)
|
||||||
to_chat(user, "You are too primitive to use this device.")
|
to_chat(user, "<span class='notice'>You are too primitive to use this device.</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/machinery/keycard_auth/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
/obj/machinery/keycard_auth/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||||
if(stat & (NOPOWER|BROKEN))
|
if(stat & (NOPOWER|BROKEN))
|
||||||
to_chat(user, "This device is not powered.")
|
to_chat(user, "<span class='notice'>This device is not powered.</span>")
|
||||||
return
|
return
|
||||||
if(istype(W,/obj/item/weapon/card/id))
|
if(isID(W) || isPDA(W))
|
||||||
var/obj/item/weapon/card/id/ID = W
|
if(check_access(W))
|
||||||
if(access_keycard_auth in ID.access)
|
|
||||||
if(active == 1)
|
if(active == 1)
|
||||||
//This is not the device that made the initial request. It is the device confirming the request.
|
//This is not the device that made the initial request. It is the device confirming the request.
|
||||||
if(event_source)
|
if(event_source)
|
||||||
event_source.confirmed = 1
|
confirmed = 1
|
||||||
event_source.event_confirmed_by = usr
|
|
||||||
|
// All the useful information is in the source device, so copy it over. There's probably a better way to do this.
|
||||||
|
event_triggered_by = event_source.event_triggered_by
|
||||||
|
event_confirmed_by = usr
|
||||||
|
event = event_source.event
|
||||||
|
ert_reason = event_source.ert_reason
|
||||||
|
|
||||||
|
playsound(src, get_sfx("card_swipe"), 60, 1, -5)
|
||||||
|
to_chat(user, "<span class='notice'>You swipe your ID card to confirm the [event].</span>")
|
||||||
|
|
||||||
|
trigger_event(event)
|
||||||
else if(screen == 2)
|
else if(screen == 2)
|
||||||
|
playsound(src, get_sfx("card_swipe"), 60, 1, -5)
|
||||||
|
to_chat(user, "<span class='notice'>You swipe your ID card to request the [event].</span>")
|
||||||
|
|
||||||
event_triggered_by = usr
|
event_triggered_by = usr
|
||||||
broadcast_request() //This is the device making the initial event request. It needs to broadcast to other devices
|
broadcast_request() //This is the device making the initial event request. It needs to broadcast to other devices
|
||||||
|
|
||||||
@@ -64,10 +77,10 @@ var/global/list/obj/machinery/keycard_auth/authenticators = list()
|
|||||||
|
|
||||||
/obj/machinery/keycard_auth/attack_hand(mob/user as mob)
|
/obj/machinery/keycard_auth/attack_hand(mob/user as mob)
|
||||||
if(user.stat || stat & (NOPOWER|BROKEN))
|
if(user.stat || stat & (NOPOWER|BROKEN))
|
||||||
to_chat(user, "This device is not powered.")
|
to_chat(user, "<span class='notice'>This device is not powered.</span>")
|
||||||
return
|
return
|
||||||
if(busy)
|
if(busy)
|
||||||
to_chat(user, "This device is busy.")
|
to_chat(user, "<span class='notice'>This device is busy.</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
user.set_machine(src)
|
user.set_machine(src)
|
||||||
@@ -105,10 +118,10 @@ var/global/list/obj/machinery/keycard_auth/authenticators = list()
|
|||||||
if(..())
|
if(..())
|
||||||
return 1
|
return 1
|
||||||
if(busy)
|
if(busy)
|
||||||
to_chat(usr, "This device is busy.")
|
to_chat(usr, "<span class='notice'>This device is busy.</span>")
|
||||||
return
|
return
|
||||||
if(usr.stat || stat & (BROKEN|NOPOWER))
|
if(usr.stat || stat & (BROKEN|NOPOWER))
|
||||||
to_chat(usr, "This device is without power.")
|
to_chat(usr, "<span class='notice'>This device is without power.</span>")
|
||||||
return
|
return
|
||||||
if(href_list["triggerevent"])
|
if(href_list["triggerevent"])
|
||||||
if(href_list["triggerevent"] == "Emergency Response Team")
|
if(href_list["triggerevent"] == "Emergency Response Team")
|
||||||
@@ -132,6 +145,7 @@ var/global/list/obj/machinery/keycard_auth/authenticators = list()
|
|||||||
event = ""
|
event = ""
|
||||||
screen = 1
|
screen = 1
|
||||||
confirmed = 0
|
confirmed = 0
|
||||||
|
busy = 0
|
||||||
event_source = null
|
event_source = null
|
||||||
icon_state = "auth_off"
|
icon_state = "auth_off"
|
||||||
event_triggered_by = null
|
event_triggered_by = null
|
||||||
@@ -142,18 +156,8 @@ var/global/list/obj/machinery/keycard_auth/authenticators = list()
|
|||||||
for(var/obj/machinery/keycard_auth/KA in authenticators)
|
for(var/obj/machinery/keycard_auth/KA in authenticators)
|
||||||
if(KA == src)
|
if(KA == src)
|
||||||
continue
|
continue
|
||||||
KA.reset()
|
|
||||||
spawn()
|
|
||||||
KA.receive_request(src)
|
KA.receive_request(src)
|
||||||
|
|
||||||
sleep(confirm_delay)
|
|
||||||
if(confirmed)
|
|
||||||
confirmed = 0
|
|
||||||
trigger_event(event)
|
|
||||||
log_game("[key_name(event_triggered_by)] triggered and [key_name(event_confirmed_by)] confirmed event [event][event=="Emergency Response Team"?". ERT reason given was '[ert_reason]'":""]")
|
|
||||||
message_admins("[key_name(event_triggered_by)] triggered and [key_name(event_confirmed_by)] confirmed event [event][event=="Emergency Response Team"?". ERT reason given was '[ert_reason]'":""]", 1)
|
|
||||||
reset()
|
|
||||||
|
|
||||||
/obj/machinery/keycard_auth/proc/receive_request(var/obj/machinery/keycard_auth/source)
|
/obj/machinery/keycard_auth/proc/receive_request(var/obj/machinery/keycard_auth/source)
|
||||||
if(stat & (BROKEN|NOPOWER))
|
if(stat & (BROKEN|NOPOWER))
|
||||||
return
|
return
|
||||||
@@ -162,12 +166,10 @@ var/global/list/obj/machinery/keycard_auth/authenticators = list()
|
|||||||
active = 1
|
active = 1
|
||||||
icon_state = "auth_on"
|
icon_state = "auth_on"
|
||||||
|
|
||||||
sleep(confirm_delay)
|
spawn(confirm_delay)
|
||||||
|
if(active)
|
||||||
event_source = null
|
for(var/obj/machinery/keycard_auth/KA in authenticators)
|
||||||
icon_state = "auth_off"
|
KA.reset()
|
||||||
active = 0
|
|
||||||
busy = 0
|
|
||||||
|
|
||||||
/obj/machinery/keycard_auth/proc/trigger_event()
|
/obj/machinery/keycard_auth/proc/trigger_event()
|
||||||
switch(event)
|
switch(event)
|
||||||
@@ -186,8 +188,15 @@ var/global/list/obj/machinery/keycard_auth/authenticators = list()
|
|||||||
if("Emergency Response Team")
|
if("Emergency Response Team")
|
||||||
var/datum/striketeam/ert/response_team = new()
|
var/datum/striketeam/ert/response_team = new()
|
||||||
response_team.mission = ert_reason
|
response_team.mission = ert_reason
|
||||||
response_team.trigger_strike()
|
response_team.trigger_strike() // This will show up as *null* in logs, adding requester gives them power to approve an ERT.
|
||||||
feedback_inc("alert_keycard_auth_ert",1)
|
feedback_inc("alert_keycard_auth_ert",1)
|
||||||
|
event_source.visible_message("<span class='notice'>An ERT has been requested, please await a response.</span>")
|
||||||
|
playsound(event_source, 'sound/machines/notify.ogg', 60, 0)
|
||||||
|
|
||||||
|
log_game("[key_name(event_triggered_by)] triggered and [key_name(event_confirmed_by)] confirmed event [event][event=="Emergency Response Team"?". ERT reason given was '[ert_reason]'":""]")
|
||||||
|
message_admins("[key_name(event_triggered_by)] triggered and [key_name(event_confirmed_by)] confirmed event [event][event=="Emergency Response Team"?". ERT reason given was '[ert_reason]'":""]")
|
||||||
|
for(var/obj/machinery/keycard_auth/KA in authenticators)
|
||||||
|
KA.reset()
|
||||||
|
|
||||||
var/global/maint_all_access = 0
|
var/global/maint_all_access = 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user