mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +00:00
Adds ability to request the spare ID safe codes on shifts with no captain or acting captain. (#57460)
This commit is contained in:
@@ -41,6 +41,12 @@ SUBSYSTEM_DEF(job)
|
||||
|
||||
/// If TRUE, some player has been assigned Captaincy or Acting Captaincy at some point during the shift and has been given the spare ID safe code.
|
||||
var/assigned_captain = FALSE
|
||||
/// Whether the emergency safe code has been requested via a comms console on shifts with no Captain or Acting Captain.
|
||||
var/safe_code_requested = FALSE
|
||||
/// Timer ID for the emergency safe code request.
|
||||
var/safe_code_timer_id
|
||||
/// The loc to which the emergency safe code has been requested for delivery.
|
||||
var/turf/safe_code_request_loc
|
||||
/// If TRUE, the "Captain" job will always be given the code to the spare ID safe and always have a "Captain on deck!" announcement.
|
||||
var/always_promote_captain_job = TRUE
|
||||
|
||||
@@ -775,6 +781,18 @@ SUBSYSTEM_DEF(job)
|
||||
var/safe_code = SSid_access.spare_id_safe_code
|
||||
|
||||
info = "Captain's Spare ID safe code combination: [safe_code ? safe_code : "\[REDACTED\]"]<br><br>The spare ID can be found in its dedicated safe on the bridge.<br><br>If your job would not ordinarily have Head of Staff access, your ID card has been specially modified to possess it."
|
||||
update_appearance()
|
||||
|
||||
/obj/item/paper/fluff/emergency_spare_id_safe_code
|
||||
name = "Emergency Spare ID Safe Code Requisition"
|
||||
desc = "Proof that nobody has been approved for Captaincy. A skeleton key for a skeleton shift."
|
||||
|
||||
/obj/item/paper/fluff/emergency_spare_id_safe_code/Initialize()
|
||||
. = ..()
|
||||
var/safe_code = SSid_access.spare_id_safe_code
|
||||
|
||||
info = "Captain's Spare ID safe code combination: [safe_code ? safe_code : "\[REDACTED\]"]<br><br>The spare ID can be found in its dedicated safe on the bridge."
|
||||
update_appearance()
|
||||
|
||||
/datum/controller/subsystem/job/proc/promote_to_captain(mob/living/carbon/human/new_captain, acting_captain = FALSE)
|
||||
var/id_safe_code = SSid_access.spare_id_safe_code
|
||||
@@ -804,3 +822,9 @@ SUBSYSTEM_DEF(job)
|
||||
id_card.add_wildcards(list(ACCESS_HEADS), mode=FORCE_ADD_ALL)
|
||||
|
||||
assigned_captain = TRUE
|
||||
|
||||
/// Send a drop pod containing a piece of paper with the spare ID safe code to loc
|
||||
/datum/controller/subsystem/job/proc/send_spare_id_safe_code(loc)
|
||||
new /obj/effect/pod_landingzone(loc, /obj/structure/closet/supplypod/centcompod, new /obj/item/paper/fluff/emergency_spare_id_safe_code())
|
||||
safe_code_timer_id = null
|
||||
safe_code_request_loc = null
|
||||
|
||||
@@ -330,16 +330,54 @@
|
||||
log_game("[key_name(usr)] enabled emergency maintenance access.")
|
||||
message_admins("[ADMIN_LOOKUPFLW(usr)] enabled emergency maintenance access.")
|
||||
deadchat_broadcast(" enabled emergency maintenance access at <span class='name'>[get_area_name(usr, TRUE)]</span>.", "<span class='name'>[usr.real_name]</span>", usr, message_type = DEADCHAT_ANNOUNCEMENT)
|
||||
// Request codes for the Captain's Spare ID safe.
|
||||
if("requestSafeCodes")
|
||||
if(SSjob.assigned_captain)
|
||||
to_chat(usr, "<span class='warning'>There is already an assigned Captain or Acting Captain on deck!</span>")
|
||||
return
|
||||
|
||||
if(SSjob.safe_code_timer_id)
|
||||
to_chat(usr, "<span class='warning'>The safe code has already been requested and is being delivered to your station!</span>")
|
||||
return
|
||||
|
||||
if(SSjob.safe_code_requested)
|
||||
to_chat(usr, "<span class='warning'>The safe code has already been requested and delivered to your station!</span>")
|
||||
return
|
||||
|
||||
if(!SSid_access.spare_id_safe_code)
|
||||
to_chat(usr, "<span class='warning'>There is no safe code to deliver to your station!</span>")
|
||||
return
|
||||
|
||||
var/turf/pod_location = get_turf(src)
|
||||
|
||||
SSjob.safe_code_request_loc = pod_location
|
||||
SSjob.safe_code_requested = TRUE
|
||||
SSjob.safe_code_timer_id = addtimer(CALLBACK(SSjob, /datum/controller/subsystem/job.proc/send_spare_id_safe_code, pod_location), 120 SECONDS, TIMER_UNIQUE | TIMER_STOPPABLE)
|
||||
minor_announce("Due to staff shortages, your station has been approved for delivery of access codes to secure the Captain's Spare ID. Delivery via drop pod at [get_area(pod_location)]. ETA 120 seconds.")
|
||||
|
||||
/obj/machinery/computer/communications/ui_data(mob/user)
|
||||
var/list/data = list(
|
||||
"authenticated" = FALSE,
|
||||
"emagged" = FALSE,
|
||||
"hasConnection" = has_communication(),
|
||||
)
|
||||
|
||||
var/ui_state = issilicon(user) ? cyborg_state : state
|
||||
|
||||
var/has_connection = has_communication()
|
||||
data["hasConnection"] = has_connection
|
||||
|
||||
if(!SSjob.assigned_captain && !SSjob.safe_code_requested && SSid_access.spare_id_safe_code && has_connection)
|
||||
data["canRequestSafeCode"] = TRUE
|
||||
data["safeCodeDeliveryWait"] = 0
|
||||
else
|
||||
data["canRequestSafeCode"] = FALSE
|
||||
if(SSjob.safe_code_timer_id && has_connection)
|
||||
data["safeCodeDeliveryWait"] = timeleft(SSjob.safe_code_timer_id)
|
||||
data["safeCodeDeliveryArea"] = get_area(SSjob.safe_code_request_loc)
|
||||
else
|
||||
data["safeCodeDeliveryWait"] = 0
|
||||
data["safeCodeDeliveryArea"] = null
|
||||
|
||||
if (authenticated || issilicon(user))
|
||||
data["authenticated"] = TRUE
|
||||
data["canLogOut"] = !issilicon(user)
|
||||
|
||||
@@ -683,6 +683,9 @@ export const CommunicationsConsole = (props, context) => {
|
||||
emagged,
|
||||
hasConnection,
|
||||
page,
|
||||
canRequestSafeCode,
|
||||
safeCodeDeliveryWait,
|
||||
safeCodeDeliveryArea,
|
||||
} = data;
|
||||
|
||||
return (
|
||||
@@ -693,18 +696,31 @@ export const CommunicationsConsole = (props, context) => {
|
||||
<Window.Content scrollable>
|
||||
{!hasConnection && <NoConnectionModal />}
|
||||
|
||||
{(canLogOut || !authenticated)
|
||||
? (
|
||||
<Section title="Authentication">
|
||||
<Button
|
||||
icon={authenticated ? "sign-out-alt" : "sign-in-alt"}
|
||||
content={authenticated ? `Log Out${authorizeName ? ` (${authorizeName})` : ""}` : "Log In"}
|
||||
color={authenticated ? "bad" : "good"}
|
||||
onClick={() => act("toggleAuthentication")}
|
||||
/>
|
||||
</Section>
|
||||
)
|
||||
: null}
|
||||
{(canLogOut || !authenticated) && (
|
||||
<Section title="Authentication">
|
||||
<Button
|
||||
icon={authenticated ? "sign-out-alt" : "sign-in-alt"}
|
||||
content={authenticated ? `Log Out${authorizeName ? ` (${authorizeName})` : ""}` : "Log In"}
|
||||
color={authenticated ? "bad" : "good"}
|
||||
onClick={() => act("toggleAuthentication")}
|
||||
/>
|
||||
</Section>
|
||||
)}
|
||||
|
||||
{(!!canRequestSafeCode && (
|
||||
<Section title="Emergency Safe Code">
|
||||
<Button
|
||||
icon="key"
|
||||
content="Request Safe Code"
|
||||
color="good"
|
||||
onClick={() => act("requestSafeCodes")} />
|
||||
</Section>
|
||||
)) || (!!safeCodeDeliveryWait && (
|
||||
<Section title="Emergency Safe Code Delivery">
|
||||
{`Drop pod to ${safeCodeDeliveryArea} in \
|
||||
${Math.round(safeCodeDeliveryWait/10)}s`}
|
||||
</Section>
|
||||
))}
|
||||
|
||||
{!!authenticated && (
|
||||
page === STATE_BUYING_SHUTTLE && <PageBuyingShuttle />
|
||||
|
||||
Reference in New Issue
Block a user