Skip to content

Commit

Permalink
Ares Nuke Request (cmss13-devs#3988)
Browse files Browse the repository at this point in the history
# About the pull request

Implements ARES Emergency Procedure 'Request Nuke', which allows someone
to petition High Command (Admins) for a nuke

# Explain why it's good for the game

This is already implemented in the framework for Project ARES, this just
adds the feature. Should be fine as admins will need to authorize it. If
people want a different rank for such nuke requests I can have it done.

# Changelog
:cl:
add: You can now petition High Command via ARES for a nuclear device,
bypassing techweb (If you can convince them, that is.)
admin: Implemented Admin side of ARES Nuke request to allow for granting
of different nuke types, or denying the request.
/:cl:

---------

Co-authored-by: forest2001 <[email protected]>
Co-authored-by: forest2001 <[email protected]>
  • Loading branch information
3 people authored Jul 25, 2023
1 parent b0e36c4 commit f9e7ecc
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 8 deletions.
4 changes: 2 additions & 2 deletions code/game/machinery/ARES/ARES.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
var/list/records_asrs = list()
/// Holds all (/datum/ares_record/security)s and (/datum/ares_record/antiair)s
var/list/records_security = list()
/// Is nuke request usable or not? (Nuke request is not currently coded to work.)
var/nuke_available = FALSE
/// Is nuke request usable or not?
var/nuke_available = TRUE


COOLDOWN_DECLARE(ares_distress_cooldown)
Expand Down
15 changes: 11 additions & 4 deletions code/game/machinery/ARES/ARES_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -576,15 +576,22 @@ GLOBAL_LIST_INIT(maintenance_categories, list(
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(security_level == SEC_LEVEL_DELTA || SSticker.mode.is_in_endgame)
to_chat(usr, SPAN_WARNING("The mission has failed catastrophically, what do you want a nuke for!"))
to_chat(usr, SPAN_WARNING("The mission has failed catastrophically, what do you want a nuke for?!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE

var/reason = tgui_input_text(usr, "Please enter reason nuclear ordnance is required.", "Reason for Nuclear Ordnance")
if(!reason)
return FALSE
for(var/client/admin in GLOB.admins)
if((R_ADMIN|R_MOD) & admin.admin_holder.rights)
playsound_client(admin,'sound/effects/sos-morse-code.ogg',10)
message_admins("[key_name(usr)] has requested use of Nuclear Ordnance (via ARES)! [CC_MARK(usr)] (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];nukeapprove=\ref[usr]'>APPROVE</A>) (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];nukedeny=\ref[usr]'>DENY</A>) [ADMIN_JMP_USER(usr)] [CC_REPLY(usr)]")
to_chat(usr, SPAN_NOTICE("A nuclear ordnance request has been sent to USCM High Command."))
message_admins("[key_name(usr)] has requested use of Nuclear Ordnance (via ARES)! Reason: <b>[reason]</b> [CC_MARK(usr)] (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];nukeapprove=\ref[usr]'>APPROVE</A>) (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];nukedeny=\ref[usr]'>DENY</A>) [ADMIN_JMP_USER(usr)] [CC_REPLY(usr)]")
to_chat(usr, SPAN_NOTICE("A nuclear ordnance request has been sent to USCM High Command for the following reason: [reason]"))
if(ares_can_log())
link.log_ares_security("Nuclear Ordnance Request", "[last_login] has sent a request for nuclear ordnance for the following reason: [reason]")
if(ares_can_interface())
ai_silent_announcement("[last_login] has sent a request for nuclear ordnance to USCM High Command.", ".V")
ai_silent_announcement("Reason given: [reason].", ".V")
COOLDOWN_START(src, ares_nuclear_cooldown, COOLDOWN_COMM_DESTRUCT)
return TRUE
// ------ End ARES Interface UI ------ //
Expand Down
38 changes: 37 additions & 1 deletion code/modules/admin/topic/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@
message_admins("[key_name_admin(usr)] has sent [key_name_admin(M)] to the thunderdome. (Observer.)", 1)

else if(href_list["revive"])
if(!check_rights(R_MOD))
if(!check_rights(R_MOD))
return

var/mob/living/L = locate(href_list["revive"])
Expand Down Expand Up @@ -1926,6 +1926,42 @@
log_game("[key_name_admin(usr)] has granted self-destruct, requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(usr)] has granted self-destruct, requested by [key_name_admin(ref_person)]", 1)

if(href_list["nukeapprove"])
var/mob/ref_person = locate(href_list["nukeapprove"])
if(!istype(ref_person))
return FALSE
var/nuketype = "Encrypted Operational Nuke"
var/prompt = tgui_alert(usr, "Do you want the nuke to be Encrypted?", "Nuke Type", list("Encrypted", "Decrypted"), 20 SECONDS)
if(prompt == "Decrypted")
nuketype = "Decrypted Operational Nuke"
prompt = tgui_alert(usr, "Are you sure you want to authorize a [nuketype] to the marines? This will greatly affect the round!", "DEFCON 1", list("No", "Yes"))
if(prompt != "Yes")
return

//make ASRS order for nuke
var/datum/supply_order/new_order = new()
new_order.ordernum = supply_controller.ordernum
supply_controller.ordernum++
new_order.object = supply_controller.supply_packs[nuketype]
new_order.orderedby = ref_person
new_order.approvedby = "USCM High Command"
supply_controller.shoppinglist += new_order

//Can no longer request a nuke
GLOB.ares_link.interface.nuke_available = FALSE

marine_announcement("A nuclear device has been authorized by High Command and will be delivered to requisitions via ASRS.", "NUCLEAR ORDNANCE AUTHORIZED", 'sound/misc/notice2.ogg', logging = ARES_LOG_MAIN)
log_game("[key_name_admin(usr)] has authorized a [nuketype], requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(usr)] has authorized a [nuketype], requested by [key_name_admin(ref_person)]")

if(href_list["nukedeny"])
var/mob/ref_person = locate(href_list["nukedeny"])
if(!istype(ref_person))
return FALSE
marine_announcement("Your request for nuclear ordnance deployment has been reviewed and denied by USCM High Command for operational security and colonial preservation reasons. Have a good day.", "NUCLEAR ORDNANCE DENIED", 'sound/misc/notice2.ogg', logging = ARES_LOG_MAIN)
log_game("[key_name_admin(usr)] has denied nuclear ordnance, requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(usr)] has dnied nuclear ordnance, requested by [key_name_admin(ref_person)]")

if(href_list["sddeny"]) // CentComm-deny. The self-destruct is denied, without any further conditions
var/mob/ref_person = locate(href_list["sddeny"])
marine_announcement("The self-destruct request has not received a response, ARES is now recalculating statistics.", "Self-Destruct System", logging = ARES_LOG_SECURITY)
Expand Down
3 changes: 2 additions & 1 deletion tgui/packages/tgui/interfaces/AresInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,8 @@ const Emergency = (props, context) => {
let nuke_reason =
'Request a nuclear device to be authorized by USCM High Command.';
if (!nuke_available) {
nuke_reason = 'No nuclear ordnance is available during this operation.';
nuke_reason =
'No nuclear ordnance is available during this operation, or one has already been provided.';
} else if (mission_failed) {
nuke_reason =
'You have already lost the objective, you cannot use a nuclear device aboard the ship!';
Expand Down

0 comments on commit f9e7ecc

Please sign in to comment.