mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* update icon and update appearance * update name * fixes * Removes double parent calls from many things * More fixes * minor fixes * fuck * A! * general annoyances in this PR * going in specific fixes * remove remaining update icons and hud fixes * Mass replace update icon with update icon state/overlays * compile * push my work so far * goes back on things I broke * a * goes through like 80 more cases * going through more update icons * compile again * thank you tattax * Goes through the remaining update icon * fix CI cries * Fixes cigs, canisters and guncases * Fixes airlock unres sides * Fixes the flash * Fixes cryo cells * gun fix * Egun fixes * fixes mini eguns * Update energy.dm * Fixes MMIs * Fixes security level interface * Fixes cigar cases * Bow & Critter crate fixes * Fixes signalers * Fix canisters again * re-adds blinking red * Fixes solar panels * Fixes cryogenics (and forced standing) * Update cryo.dm * sechailer fix * Maybe fixes pitch black roundstart APCs * Update apc.dm * yet another egun fix * Fixes plasmamen helmets among other stuff * Fixes canisters for good * Fixes booze dispensers * Fixes new icon updates people added * Probably fixes ballistic guns * i give up lol
110 lines
3.4 KiB
Plaintext
110 lines
3.4 KiB
Plaintext
/obj/machinery/level_interface
|
|
name = "security level interface"
|
|
desc = "A wall-mounted computer used for interfacing with security levels remotely."
|
|
icon = 'icons/obj/modular_telescreen.dmi'
|
|
icon_state = "telescreen"
|
|
|
|
light_system = STATIC_LIGHT
|
|
light_range = 2
|
|
light_power = 1
|
|
light_color = LIGHT_COLOR_BLUE
|
|
|
|
var/list/default_access
|
|
var/list/emergency_access
|
|
|
|
var/obj/item/radio/radio
|
|
var/radio_key = /obj/item/encryptionkey/heads/hos
|
|
var/sec_freq = RADIO_CHANNEL_SECURITY
|
|
var/command_freq = RADIO_CHANNEL_COMMAND
|
|
|
|
/obj/machinery/level_interface/Initialize(mapload)
|
|
. = ..()
|
|
default_access = list(ACCESS_ARMORY)
|
|
emergency_access = list(ACCESS_SECURITY)
|
|
radio = new(src)
|
|
radio.keyslot = new radio_key
|
|
radio.subspace_transmission = TRUE
|
|
radio.listening = FALSE
|
|
radio.independent = TRUE
|
|
radio.recalculateChannels()
|
|
|
|
/obj/machinery/level_interface/update_icon(updates=ALL)
|
|
. = ..()
|
|
if(!is_operational())
|
|
set_light_on(FALSE)
|
|
else
|
|
set_light_on(TRUE)
|
|
|
|
/obj/machinery/level_interface/update_overlays()
|
|
. = ..()
|
|
switch(GLOB.security_level)
|
|
if(SEC_LEVEL_GREEN)
|
|
. += "alert-level-green"
|
|
if(SEC_LEVEL_BLUE)
|
|
. += "alert-level-blue"
|
|
if(SEC_LEVEL_RED)
|
|
. += "alert-level-red"
|
|
if(SEC_LEVEL_GAMMA)
|
|
. += "alert-level-gamma"
|
|
if(SEC_LEVEL_EPSILON)
|
|
. += "alert-level-epsilon"
|
|
if(SEC_LEVEL_DELTA)
|
|
. += "alert-level-delta"
|
|
|
|
/obj/machinery/level_interface/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!is_operational())
|
|
return
|
|
if(!ui)
|
|
ui = new(user, src, "LevelInterface", name)
|
|
ui.open()
|
|
|
|
/obj/machinery/level_interface/ui_data(mob/user)
|
|
var/list/data = ..()
|
|
data["alertLevel"] = GLOB.security_level
|
|
return data
|
|
|
|
/obj/machinery/level_interface/ui_act(action, list/params, mob/user)
|
|
. = ..()
|
|
if(..())
|
|
return TRUE
|
|
|
|
/// If there is a warden or HoS, we can delegate them to be able to swap alerts
|
|
/// If not, let the officers do it
|
|
req_one_access = emergency_access
|
|
for(var/datum/data/record/gen_record in GLOB.data_core.general)
|
|
if(gen_record.fields["real_rank"] == "Head of Security" || gen_record.fields["real_rank"] == "Warden")
|
|
req_one_access = default_access
|
|
break
|
|
|
|
switch(action)
|
|
if("set_level")
|
|
if(GLOB.security_level >= SEC_LEVEL_GAMMA)
|
|
balloon_alert(usr, "Nanotrasen override in progress!")
|
|
return TRUE
|
|
if(!check_access(usr.get_idcard()))
|
|
balloon_alert(usr, "no access!")
|
|
return TRUE
|
|
var/alert_level = params["level_number"]
|
|
if(!isnum(alert_level))
|
|
return TRUE
|
|
if(!num2seclevel(alert_level))
|
|
return TRUE
|
|
if(GLOB.security_level == alert_level)
|
|
return TRUE
|
|
for(var/obj/machinery/computer/communications/comms_console in GLOB.machines)
|
|
if(!COOLDOWN_FINISHED(comms_console, important_action_cooldown))
|
|
balloon_alert(usr, "on cooldown!")
|
|
to_chat(usr, span_warning("The system is not able to change the security alert level more than once per minute, please wait."))
|
|
return TRUE
|
|
COOLDOWN_START(comms_console, important_action_cooldown, IMPORTANT_ACTION_COOLDOWN)
|
|
break
|
|
set_security_level(num2seclevel(alert_level))
|
|
var/username = "ERR_UNK"
|
|
var/obj/item/card/id/id_card = usr.get_idcard()
|
|
if(istype(id_card) && id_card && id_card.registered_name)
|
|
username = id_card.registered_name
|
|
radio.talk_into(src, "Security level set to [uppertext(num2seclevel(alert_level))] by [username].", sec_freq)
|
|
radio.talk_into(src, "Security level set to [uppertext(num2seclevel(alert_level))] by [username].", command_freq)
|
|
return TRUE
|