Skip to content

Commit

Permalink
Keycard auth sprite update + emissive when blinking. (#554)
Browse files Browse the repository at this point in the history
* Update damage_procs.dm

* keycard auth sprite and emissive

* Update keycard_authentication.dm

* Update keycard_authentication.dm
  • Loading branch information
Helg2 authored Oct 18, 2024
1 parent cdfd28c commit 5b14463
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 15 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/colors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ Important note: colors can end up significantly different from the basic html pi
#define LIGHT_COLOR_LIGHT_CYAN "#40CEFF"
/// Saturated blue. rgb(51, 117, 248)
#define LIGHT_COLOR_DARK_BLUE "#6496FA"
/// Blue used by keycard auth when blinking rgb(086, 104, 225)
#define LIGHT_COLOR_KEYCARD_BLUE "#5668E1"
/// Diluted, mid-warmth pink. rgb(225, 125, 225)
#define LIGHT_COLOR_PINK "#E17DE1"
/// Dimmed yellow, leaning kaki. rgb(225, 225, 125)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/damage_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
if(edge) //Pierce weapons give the most bonus
chancemod += 15
if(stat == DEAD) // pressure in dead body is lower than usual
chancemod * 0.5
chancemod *= 0.5
chance += chancemod + (damage * 0.33)
if(!prob(chance))
return FALSE
Expand Down
50 changes: 36 additions & 14 deletions code/modules/security_levels/keycard_authentication.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,39 @@
desc = "This device is used to trigger station functions, which require more than one ID card to authenticate."
icon = 'icons/obj/monitors.dmi'
icon_state = "auth_off"
var/active = 0 //This gets set to 1 on all devices except the one where the initial request was made.
anchored = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 2
active_power_usage = 6
power_channel = ENVIRON
light_power = 0.5
light_range = 0.7
///This gets set to TRUE on all devices except the one where the initial request was made.
var/active = FALSE
var/event = ""
var/screen = 1
var/confirmed = 0 //This variable is set by the device that confirms the request.
var/confirm_delay = 20 //(2 seconds)
var/busy = 0 //Busy when waiting for authentication or an event request has been sent from this device.
///This variable is set by the device that confirms the request.
var/confirmed = 0
///Delay before confirm deactivates
var/confirm_delay = 2 SECONDS
///Busy when waiting for authentication or an event request has been sent from this device.
var/busy = 0
var/obj/machinery/keycard_auth/event_source
var/mob/event_triggered_by
var/mob/event_confirmed_by
/// Has this event been authorized by a silicon. Most of the time, this means the AI.
var/synth_activation = 0
//1 = select event
//2 = authenticate
anchored = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 2
active_power_usage = 6
power_channel = ENVIRON


/obj/machinery/keycard_auth/attackby(obj/item/I, mob/user, params)
. = ..()

if(machine_stat & (NOPOWER|BROKEN))
to_chat(user, "This device is not powered.")
return

else if(istype(I, /obj/item/card/id))
if(istype(I, /obj/item/card/id))
var/obj/item/card/id/ID = I
if(!(ACCESS_MARINE_BRIDGE in ID.access))
return
Expand All @@ -44,9 +50,23 @@

/obj/machinery/keycard_auth/update_icon_state()
. = ..()
if(machine_stat &NOPOWER)
if(machine_stat & NOPOWER)
icon_state = "auth_off"
update_emissives()

/obj/machinery/keycard_auth/update_overlays()
. = ..()
if(machine_stat & (BROKEN|DISABLED|NOPOWER))
return
. += emissive_appearance(icon, "[icon_state]_emissive", alpha = src.alpha)

/obj/machinery/keycard_auth/proc/update_emissives()
if(icon_state == "auth_on") // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
set_light(initial(light_range), initial(light_power), LIGHT_COLOR_KEYCARD_BLUE)
update_icon(UPDATE_OVERLAYS)
else
set_light(0, 0)
update_icon(UPDATE_OVERLAYS)

/obj/machinery/keycard_auth/can_interact(mob/user)
. = ..()
Expand All @@ -56,7 +76,6 @@
return FALSE
return TRUE


/obj/machinery/keycard_auth/interact(mob/user)
. = ..()
if(.)
Expand Down Expand Up @@ -90,7 +109,6 @@
popup.set_content(dat)
popup.open(FALSE)


/obj/machinery/keycard_auth/Topic(href, href_list)
. = ..()
if(.)
Expand Down Expand Up @@ -122,11 +140,13 @@
synth_activation = 0
event_source = null
icon_state = "auth_off"
update_emissives()
event_triggered_by = null
event_confirmed_by = null

/obj/machinery/keycard_auth/proc/broadcast_request()
icon_state = "auth_on"
update_emissives()
for(var/obj/machinery/keycard_auth/KA in GLOB.machines)
if(KA == src)
continue
Expand All @@ -149,11 +169,13 @@
busy = FALSE
active = TRUE
icon_state = "auth_on"
update_emissives()
addtimer(CALLBACK(src, PROC_REF(confirm)), confirm_delay)

/obj/machinery/keycard_auth/proc/confirm()
event_source = null
icon_state = "auth_off"
update_emissives()
active = FALSE
busy = FALSE

Expand Down
Binary file modified icons/obj/machines/monitors.dmi
Binary file not shown.
Binary file modified icons/obj/monitors.dmi
Binary file not shown.

0 comments on commit 5b14463

Please sign in to comment.