Skip to content

Commit

Permalink
Legalize Nuclear Bombs (Nuke fixes and QOL) (#3880)
Browse files Browse the repository at this point in the history
# About the pull request

Fixes regular nuke that can be spawned by admins and adds ability to
spawn a nuke via events panel. QOL for nuke UI

# Explain why it's good for the game

Allows admins to use default nuke (decrypted with 8 minute detonation
timer) and lets them spawn a nuke via event panel.

# Changelog
:cl:
fix: Non-techweb nuke now works properly.
ui: Nuke timers now use minutes instead of seconds
spellcheck: Nukes renamed to 'Encrypted' and 'Decrypted' nuke
respectively.
admin: Ability to spawn nuke added to event panel
/:cl:

---------

Co-authored-by: harryob <[email protected]>
  • Loading branch information
Ben10083 and harryob committed Jul 24, 2023
1 parent 16c8952 commit 766d591
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 7 deletions.
4 changes: 2 additions & 2 deletions code/datums/supply_packs/operations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@
group = "Operations"

/datum/supply_packs/nuclearbomb
name = "Operational Nuke"
name = "Decrypted Operational Nuke"
cost = 0
containertype = /obj/structure/machinery/nuclearbomb
buyable = 0
group = "Operations"
iteration_needed = null

/datum/supply_packs/technuclearbomb
name = "Intel Operational Nuke"
name = "Encrypted Operational Nuke"
cost = 0
containertype = /obj/structure/machinery/nuclearbomb/tech
buyable = 0
Expand Down
3 changes: 2 additions & 1 deletion code/game/machinery/nuclearbomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var/bomb_set = FALSE
var/timing = FALSE
var/deployable = FALSE
var/explosion_time = null
var/timeleft = 4800
var/timeleft = 8 MINUTES
var/safety = TRUE
var/being_used = FALSE
var/end_round = TRUE
Expand Down Expand Up @@ -152,6 +152,7 @@ var/bomb_set = FALSE
data["command_lockout"] = command_lockout
data["allowed"] = allowed
data["being_used"] = being_used
data["decryption_complete"] = TRUE //this is overriden by techweb nuke UI_data later, this just makes it default to true

return data

Expand Down
24 changes: 24 additions & 0 deletions code/modules/admin/tabs/event_tab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,29 @@

give_jelly_award(last_hive_checked, as_admin=TRUE)

/client/proc/give_nuke()
if(!check_rights(R_ADMIN))
return
var/nuketype = "Decrypted Operational Nuke"
var/encrypt = tgui_alert(src, "Do you want the nuke to be already decrypted?", "Nuke Type", list("Encrypted", "Decrypted"), 20 SECONDS)
if(encrypt == "Encrypted")
nuketype = "Encrypted Operational Nuke"
var/prompt = tgui_alert(src, "THIS CAN BE USED TO END THE ROUND. Are you sure you want to spawn a nuke? The nuke will be put onto the ASRS Lift.", "DEFCON 1", list("No", "Yes"), 30 SECONDS)
if(prompt != "Yes")
return

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 = MAIN_AI_SYSTEM
new_order.approvedby = MAIN_AI_SYSTEM
supply_controller.shoppinglist += new_order

marine_announcement("A nuclear device has been supplied and will be delivered to requisitions via ASRS.", "NUCLEAR ARSENAL ACQUIRED", 'sound/misc/notice2.ogg')
message_admins("[key_name_admin(usr)] admin-spawned a [encrypt] nuke.")
log_game("[key_name_admin(usr)] admin-spawned a [encrypt] nuke.")

/client/proc/turn_everyone_into_primitives()
var/random_names = FALSE
if (alert(src, "Do you want to give everyone random numbered names?", "Confirmation", "Yes", "No") == "Yes")
Expand Down Expand Up @@ -684,6 +707,7 @@
<B>Misc</B><BR>
<A href='?src=\ref[src];[HrefToken()];events=medal'>Award a medal</A><BR>
<A href='?src=\ref[src];[HrefToken()];events=jelly'>Award a royal jelly</A><BR>
<A href='?src=\ref[src];[HrefToken()];events=nuke'>Spawn a nuke</A><BR>
<A href='?src=\ref[src];[HrefToken()];events=pmcguns'>Toggle PMC gun restrictions</A><BR>
<A href='?src=\ref[src];[HrefToken()];events=monkify'>Turn everyone into monkies</A><BR>
<BR>
Expand Down
2 changes: 2 additions & 0 deletions code/modules/admin/topic/topic_events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
owner.award_medal()
if("jelly")
owner.award_jelly()
if("nuke")
owner.give_nuke()
if("pmcguns")
owner.toggle_gun_restrictions()
if("monkify")
Expand Down
7 changes: 4 additions & 3 deletions code/modules/cm_tech/techs/marine/tier4/nuke.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
tier = /datum/tier/four

announce_name = "NUCLEAR ARSENAL ACQUIRED"
announce_message = "A nuclear device has been purchased and will be delivered to requisitions via ASRS."
announce_message = "A nuclear device has been authorized and will be delivered to requisitions via ASRS."

flags = TREE_FLAG_MARINE

Expand All @@ -20,11 +20,12 @@
/datum/tech/nuke/on_unlock()
. = ..()

var/datum/supply_order/new_order = new /datum/supply_order()
var/datum/supply_order/new_order = new()
new_order.ordernum = supply_controller.ordernum
supply_controller.ordernum++
new_order.object = supply_controller.supply_packs["Intel Operational Nuke"]
new_order.object = supply_controller.supply_packs["Encrypted Operational Nuke"]
new_order.orderedby = MAIN_AI_SYSTEM
new_order.approvedby = MAIN_AI_SYSTEM

supply_controller.shoppinglist += new_order

Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/interfaces/NuclearBomb.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const NuclearBomb = (_props, context) => {
{data.decryption_complete
? 'Decryption complete.'
: `Decryption time left :
${data.decryption_time} seconds`}
${data.decryption_time} minutes`}
</NoticeBox>
</Stack.Item>
<Stack.Item>
Expand Down

0 comments on commit 766d591

Please sign in to comment.