Files
Bubberstation/code/modules/security_levels/keycard_authentication.dm
SkyratBot 2728bbe9a9 [MIRROR] Polishes some side sources of light and color [MDB IGNORE] (#19860)
* Polishes some side sources of light and color (#73936)

## About The Pull Request

[Circuit Floor
Polish](6b0ee98132)

Circuit floors glow! but it looks like crap cause it's dim and the
colors are washed out.
I'd like to make them look nicer. Let's make them more intense and
longer range, and change the colors over to more vivid replacements.

While I'm here, these should really use power and turn on and off based
off that.
Simple enough to do, just need to hook into a signal (and add a setter
for turf area, which cleans up other code too).

[Desklamp
Upgrade](8506b13b9c)

Desklamps look bad. They're fullwhite, have a way too large
range.Crummy.
Let's lower their lightrange from 5 to 3.5, and make the ornate ones
warmer, and the more utilitarian ones cooler. The clown one can be
yellow because it's funny

I'm renaming a color define here so I'm touching more files then you'd
expect

[Brightens
Niknacks](835bae28e9)

Increases the light range of request consoles, status displays,
newscasters, and air alarms (keycard machines too, when they're awaiting
input at least)
Increases the brightness of air alarms, I think they should be on par
with apcs, should be able to tell when they're good/bad.
Increases the brightness of vending machines (I want them to light up
the tiles around them very lightly, I think it's a vibe)

Fixes a bug with ai status displays where they'd display an emissive
even if they didn't have anything on their screen, looking stupid.
This was decently easy but required a define. Looked really bad tho

## Why It's Good For The Game

Pretty

<details>
<summary>
Circuit Floors
</summary>

Old

![image](https://user-images.githubusercontent.com/58055496/224534470-c6eac5f5-5de6-40e9-897d-3212b8796d81.png)

![image](https://user-images.githubusercontent.com/58055496/224534477-ad412ad9-f7c4-44ae-ad75-a1a2c9bd17be.png)

New

![image](https://user-images.githubusercontent.com/58055496/224534486-b7b408a3-546c-4f90-aa9f-0e58bf8128ad.png)

![image](https://user-images.githubusercontent.com/58055496/224534496-626458f7-ab63-429c-a5db-eae9c784d06a.png)
</details>

<details>
<summary>
Desk Lights
</summary>

Old

![image](https://user-images.githubusercontent.com/58055496/224534513-9868b0b8-bc73-4b45-b986-8445078a8653.png)

![image](https://user-images.githubusercontent.com/58055496/224534518-bbbc8c6d-b59e-4f28-a31c-6c6a7e2c2885.png)

New

![image](https://user-images.githubusercontent.com/58055496/224534529-7988f440-03be-42ef-894c-b9e77f577ae5.png)

![image](https://user-images.githubusercontent.com/58055496/224534532-c3f2c6bf-c925-4a59-a8f9-10bb955a9942.png)
</details>

The niknack changes are more minor so I'm not gonna grab photos for
them. I can if you'd like but I don't think it's necessary. Mostly a
vibes in dark spaces sorta thing

## Changelog

🆑
add: I made circuit floors brighter and more vivid.
add: Made air alarms, vending machines, newscasters, request consoles,
status displays and keycard machines slightly "brighter" (larger light
range, tho I did make air alarms a bit brighter too)
add: Tweaked desklamps. Lower range, and each type gets its own coloring
instead of just fullwhite.
fix: AI displays are no longer always emissive, they'll stop doing it if
they aren't displaying anything. Hopefully this'll look nicer
/🆑

* Polishes some side sources of light and color

* yellow

* Update dance_machine.dm

* Merge branch 'upstream-merge-73936' of https://github.com/Skyrat-SS13/Skyrat-tg into upstream-merge-73936

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
Co-authored-by: lessthnthree <three@lessthanthree.dk>
2023-03-26 01:39:17 -07:00

214 lines
7.3 KiB
Plaintext

GLOBAL_DATUM_INIT(keycard_events, /datum/events, new)
#define KEYCARD_RED_ALERT "Red Alert"
#define KEYCARD_EMERGENCY_MAINTENANCE_ACCESS "Emergency Maintenance Access"
#define KEYCARD_BSA_UNLOCK "Bluespace Artillery Unlock"
#define KEYCARD_PIN_UNRESTRICT "Unrestrict Permit Firing Pins" //SKYRAT EDIT
#define KEYCARD_ENG_OVERRIDE "Engineering Override Access" //SKYRAT EDIT
#define ACCESS_GRANTING_COOLDOWN (30 SECONDS)
/obj/machinery/keycard_auth
name = "Keycard Authentication Device"
desc = "This device is used to trigger station functions, which require more than one ID card to authenticate, or to give the Janitor access to a department."
icon = 'icons/obj/monitors.dmi'
icon_state = "auth_off"
power_channel = AREA_USAGE_ENVIRON
req_access = list(ACCESS_KEYCARD_AUTH)
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
var/datum/callback/ev
var/event = ""
var/obj/machinery/keycard_auth/event_source
var/mob/triggerer = null
var/waiting = FALSE
COOLDOWN_DECLARE(access_grant_cooldown)
MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/keycard_auth, 26)
/obj/machinery/keycard_auth/Initialize(mapload)
. = ..()
ev = GLOB.keycard_events.addEvent("triggerEvent", CALLBACK(src, PROC_REF(triggerEvent)))
/obj/machinery/keycard_auth/Destroy()
GLOB.keycard_events.clearEvent("triggerEvent", ev)
QDEL_NULL(ev)
return ..()
/obj/machinery/keycard_auth/ui_state(mob/user)
return GLOB.physical_state
/obj/machinery/keycard_auth/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "KeycardAuth", name)
ui.open()
/obj/machinery/keycard_auth/ui_data()
var/list/data = list()
data["waiting"] = waiting
data["auth_required"] = event_source ? event_source.event : 0
data["red_alert"] = (SSsecurity_level.get_current_level_as_number() >= SEC_LEVEL_RED) ? 1 : 0
data["emergency_maint"] = GLOB.emergency_access
data["bsa_unlock"] = GLOB.bsa_unlock
data["permit_pins"] = (CONFIG_GET(flag/permit_pins) ? TRUE : FALSE) //SKYRAT EDIT
data["eng_override"] = GLOB.force_eng_override //SKYRAT EDIT
return data
/obj/machinery/keycard_auth/ui_status(mob/user)
if(isdrone(user))
return UI_CLOSE
if(!isanimal(user))
return ..()
var/mob/living/simple_animal/A = user
if(!A.dextrous)
to_chat(user, span_warning("You are too primitive to use this device!"))
return UI_CLOSE
return ..()
/obj/machinery/keycard_auth/ui_act(action, params)
. = ..()
if(. || waiting || !allowed(usr))
return
switch(action)
if("red_alert")
if(!event_source)
sendEvent(KEYCARD_RED_ALERT)
. = TRUE
if("emergency_maint")
if(!event_source)
sendEvent(KEYCARD_EMERGENCY_MAINTENANCE_ACCESS)
. = TRUE
if("auth_swipe")
if(event_source)
event_source.trigger_event(usr)
event_source = null
update_appearance()
. = TRUE
if("bsa_unlock")
if(!event_source)
sendEvent(KEYCARD_BSA_UNLOCK)
. = TRUE
//SKYRAT EDIT START
if("pin_unrestrict")
if(!event_source)
sendEvent(KEYCARD_PIN_UNRESTRICT)
. = TRUE
if("eng_override")
if(!event_source)
sendEvent(KEYCARD_ENG_OVERRIDE)
. = TRUE
//SKYRAT EDIT END
if("give_janitor_access")
var/mob/living/living_user = usr
if(!living_user || !istype(living_user))
return TRUE
if(!COOLDOWN_FINISHED(src, access_grant_cooldown))
balloon_alert(usr, "on cooldown!")
return TRUE
var/obj/item/card/id/advanced/card = living_user.get_idcard(hand_first = TRUE)
if(!card)
return TRUE
for(var/access_as_text in SSid_access.sub_department_managers_tgui)
var/list/info = SSid_access.sub_department_managers_tgui[access_as_text]
if(card.trim.assignment != info["head"])
continue
COOLDOWN_START(src, access_grant_cooldown, ACCESS_GRANTING_COOLDOWN)
SEND_GLOBAL_SIGNAL(COMSIG_ON_DEPARTMENT_ACCESS, info["regions"])
balloon_alert(usr, "key access sent")
return
/obj/machinery/keycard_auth/update_appearance(updates)
. = ..()
if(event_source && !(machine_stat & (NOPOWER|BROKEN)))
set_light(2, 1, "#5668E1")
else
set_light(0)
/obj/machinery/keycard_auth/update_overlays()
. = ..()
if(event_source && !(machine_stat & (NOPOWER|BROKEN)))
. += mutable_appearance(icon, "auth_on")
. += emissive_appearance(icon, "auth_on", src, alpha = src.alpha)
/obj/machinery/keycard_auth/proc/sendEvent(event_type)
triggerer = usr
event = event_type
waiting = TRUE
GLOB.keycard_events.fireEvent("triggerEvent", src)
addtimer(CALLBACK(src, PROC_REF(eventSent)), 20)
/obj/machinery/keycard_auth/proc/eventSent()
triggerer = null
event = ""
waiting = FALSE
/obj/machinery/keycard_auth/proc/triggerEvent(source)
event_source = source
update_appearance()
addtimer(CALLBACK(src, PROC_REF(eventTriggered)), 20)
/obj/machinery/keycard_auth/proc/eventTriggered()
event_source = null
update_appearance()
/obj/machinery/keycard_auth/proc/trigger_event(confirmer)
triggerer.log_message("triggered and [key_name(confirmer)] confirmed event [event].", LOG_GAME)
message_admins("[ADMIN_LOOKUPFLW(triggerer)] triggered and [ADMIN_LOOKUPFLW(confirmer)] confirmed event [event]")
var/area/A1 = get_area(triggerer)
deadchat_broadcast(" triggered [event] at [span_name("[A1.name]")].", span_name("[triggerer]"), triggerer, message_type=DEADCHAT_ANNOUNCEMENT)
var/area/A2 = get_area(confirmer)
deadchat_broadcast(" confirmed [event] at [span_name("[A2.name]")].", span_name("[confirmer]"), confirmer, message_type=DEADCHAT_ANNOUNCEMENT)
switch(event)
if(KEYCARD_RED_ALERT)
SSsecurity_level.set_level(SEC_LEVEL_RED)
if(KEYCARD_EMERGENCY_MAINTENANCE_ACCESS)
make_maint_all_access()
if(KEYCARD_BSA_UNLOCK)
toggle_bluespace_artillery()
//SKYRAT EDIT START
if(KEYCARD_PIN_UNRESTRICT)
toggle_permit_pins()
if(KEYCARD_ENG_OVERRIDE)
toggle_eng_override()
//SKYRAT EDIT END
GLOBAL_VAR_INIT(emergency_access, FALSE)
/proc/make_maint_all_access()
for(var/area/station/maintenance/A in GLOB.areas)
for(var/turf/in_area as anything in A.get_contained_turfs())
for(var/obj/machinery/door/airlock/D in in_area)
D.emergency = TRUE
D.update_icon(ALL, 0)
minor_announce("Access restrictions on maintenance and external airlocks have been lifted.", "Attention! Station-wide emergency declared!",1)
GLOB.emergency_access = TRUE
SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "enabled"))
/proc/revoke_maint_all_access()
for(var/area/station/maintenance/A in GLOB.areas)
for(var/turf/in_area as anything in A.get_contained_turfs())
for(var/obj/machinery/door/airlock/D in in_area)
D.emergency = FALSE
D.update_icon(ALL, 0)
minor_announce("Access restrictions in maintenance areas have been restored.", "Attention! Station-wide emergency rescinded:")
GLOB.emergency_access = FALSE
SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "disabled"))
/proc/toggle_bluespace_artillery()
GLOB.bsa_unlock = !GLOB.bsa_unlock
minor_announce("Bluespace Artillery firing protocols have been [GLOB.bsa_unlock? "unlocked" : "locked"]", "Weapons Systems Update:")
SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("bluespace artillery", GLOB.bsa_unlock? "unlocked" : "locked"))
#undef ACCESS_GRANTING_COOLDOWN
#undef KEYCARD_RED_ALERT
#undef KEYCARD_EMERGENCY_MAINTENANCE_ACCESS
#undef KEYCARD_BSA_UNLOCK
#undef KEYCARD_PIN_UNRESTRICT //SKYRAT EDIT
#undef KEYCARD_ENG_OVERRIDE //SKYRAT EDIT