From 5d0f01650f3193678d588d2aee7d895df115769f Mon Sep 17 00:00:00 2001 From: Sierra Helper <125094432+SierraHelper@users.noreply.github.com> Date: Thu, 16 Nov 2023 01:06:57 +0300 Subject: [PATCH] [MIRROR] Self-destruct Can Trigger Evacuation (#1459) Co-authored-by: orelbon <12041669+orelbon@users.noreply.github.com> --- code/controllers/evacuation/evacuation.dm | 13 +- .../controllers/evacuation/evacuation_pods.dm | 4 +- code/datums/security_state.dm | 2 +- code/game/machinery/nuclear_bomb.dm | 77 ++++---- nano/templates/nuclear_bomb.tmpl | 173 ++++++++++-------- 5 files changed, 157 insertions(+), 112 deletions(-) diff --git a/code/controllers/evacuation/evacuation.dm b/code/controllers/evacuation/evacuation.dm index 550458023ecdd..8604b31048296 100644 --- a/code/controllers/evacuation/evacuation.dm +++ b/code/controllers/evacuation/evacuation.dm @@ -96,7 +96,7 @@ var/global/datum/evacuation_controller/evacuation_controller GLOB.using_map.emergency_shuttle_called_announcement() else if(!skip_announce) - priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.shuttle_called_message, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60)] minute\s")) + priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.shuttle_called_message, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60,0.5)] minute\s")) return 1 @@ -104,8 +104,9 @@ var/global/datum/evacuation_controller/evacuation_controller if(!can_cancel()) return 0 + if(!emergency_evacuation) + evac_cooldown_time = world.time + (world.time - evac_called_at) - evac_cooldown_time = world.time + (world.time - evac_called_at) state = EVAC_COOLDOWN evac_ready_time = null @@ -129,9 +130,9 @@ var/global/datum/evacuation_controller/evacuation_controller /datum/evacuation_controller/proc/finish_preparing_evac() state = EVAC_LAUNCHING - var/estimated_time = round(get_eta()/60,1) + var/estimated_time = round(get_eta()/60,0.5) if (emergency_evacuation) - evac_waiting.Announce(replacetext(GLOB.using_map.emergency_shuttle_docked_message, "%ETD%", "[estimated_time] minute\s"), new_sound = sound('sound/effects/Evacuation.ogg', volume = 35)) + evac_waiting.Announce(replacetext(GLOB.using_map.emergency_shuttle_docked_message, "%ETD%", "[estimated_time] minute\s"), new_sound = sound('sound/effects/Evacuation.ogg', volume = 30)) else priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.shuttle_docked_message, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETD%", "[estimated_time] minute\s")) if(config.announce_evac_to_irc) @@ -145,9 +146,9 @@ var/global/datum/evacuation_controller/evacuation_controller state = EVAC_IN_TRANSIT if (emergency_evacuation) - priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.emergency_shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60,1)] minute\s")) + priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.emergency_shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60,0.5)] minute\s")) else - priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60,1)] minute\s")) + priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60,0.5)] minute\s")) return 1 diff --git a/code/controllers/evacuation/evacuation_pods.dm b/code/controllers/evacuation/evacuation_pods.dm index bb93bbebda799..98f3fc60b0e61 100644 --- a/code/controllers/evacuation/evacuation_pods.dm +++ b/code/controllers/evacuation/evacuation_pods.dm @@ -42,10 +42,10 @@ pod.move_time = (evac_transit_delay/10) pod.launch(src) - priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.emergency_shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60,1)] minute\s")) + priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.emergency_shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60,0.5)] minute\s")) else // Bluespace Jump - priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60,1)] minute\s")) + priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[round(get_eta()/60,0.5)] minute\s")) SetUniversalState(/datum/universal_state/bluespace_jump, arguments=list(GLOB.using_map.station_levels)) /datum/evacuation_controller/starship/finish_evacuation() diff --git a/code/datums/security_state.dm b/code/datums/security_state.dm index 65e5bc8ddc909..3c8192d06d16d 100644 --- a/code/datums/security_state.dm +++ b/code/datums/security_state.dm @@ -267,7 +267,7 @@ psionic_control_level = PSI_IMPLANT_DISABLED - var/static/datum/announcement/priority/security/security_announcement_delta = new(do_log = 0, do_newscast = 1, new_sound = sound('sound/effects/siren.ogg')) + var/static/datum/announcement/priority/security/security_announcement_delta = new(do_log = 0, do_newscast = 1, new_sound = sound('sound/effects/siren.ogg', volume = 70)) /singleton/security_level/default/code_delta/switching_up_to() security_announcement_delta.Announce("The self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill.", "Attention! Delta security level reached!") diff --git a/code/game/machinery/nuclear_bomb.dm b/code/game/machinery/nuclear_bomb.dm index 4238fcc546482..e9bd6fe803a5f 100644 --- a/code/game/machinery/nuclear_bomb.dm +++ b/code/game/machinery/nuclear_bomb.dm @@ -11,12 +11,13 @@ var/global/bomb_set unacidable = TRUE interact_offline = TRUE + var/evacuate = FALSE var/deployable = 0 var/extended = 0 var/lighthack = 0 - var/timeleft = 120 - var/minTime = 120 - var/maxTime = 600 + var/timeleft = 120 SECONDS + var/minTime = 120 SECONDS + var/maxTime = 600 SECONDS var/timing = 0 var/r_code = "ADMIN" var/code = "" @@ -38,11 +39,10 @@ var/global/bomb_set auth = null return ..() -/obj/machinery/nuclearbomb/Process(wait) +/obj/machinery/nuclearbomb/Process() if(timing) - timeleft = max(timeleft - (wait / 10), 0) - playsound(loc, 'sound/items/timer.ogg', 50) - if(timeleft <= 0) + playsound(loc, 'sound/items/timer.ogg',50) + if(world.time > timeleft) addtimer(new Callback(src, .proc/explode), 0) SSnano.update_uis(src) @@ -165,9 +165,10 @@ var/global/bomb_set /obj/machinery/nuclearbomb/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1) var/data[0] + data["evacuate"] = evacuate data["hacking"] = 0 data["auth"] = is_auth(user) - data["moveable_anchor"] = !istype(src, /obj/machinery/nuclearbomb/station) + data["is_regular_nuke"] = !istype(src, /obj/machinery/nuclearbomb/station) if(is_auth(user)) if(yes_code) data["authstatus"] = timing ? "Functional/Set" : "Functional" @@ -179,7 +180,7 @@ var/global/bomb_set else data["authstatus"] = "Auth. S1" data["safe"] = safety ? "Safe" : "Engaged" - data["time"] = timeleft + data["time"] = timing ? round((timeleft - world.time)/10, 1) : round(timeleft/10, 1) data["timer"] = timing data["safety"] = safety data["anchored"] = anchored @@ -262,7 +263,7 @@ var/global/bomb_set to_chat(usr, SPAN_WARNING("Cannot alter the timing during countdown.")) return - var/time = text2num(href_list["time"]) + var/time = text2num(href_list["time"]) SECONDS timeleft += time timeleft = clamp(timeleft, minTime, maxTime) if(href_list["timer"]) @@ -280,7 +281,7 @@ var/global/bomb_set if(!timing && !safety) start_bomb() else - check_cutoff() + secure_device() if(href_list["safety"]) if (wires.IsIndexCut(NUCLEARBOMB_WIRE_SAFETY)) to_chat(usr, SPAN_WARNING("Nothing happens, something might be wrong with the wiring.")) @@ -289,6 +290,11 @@ var/global/bomb_set if(safety) secure_device() update_icon() + if(href_list["evacuate"]) + if(timing) + to_chat(usr, SPAN_WARNING("Cannot alter evacuation during countdown.")) + return + evacuate = !evacuate if(href_list["anchor"]) if(removal_stage == 5) anchored = FALSE @@ -307,6 +313,7 @@ var/global/bomb_set return 1 /obj/machinery/nuclearbomb/proc/start_bomb() + timeleft += world.time timing = 1 log_and_message_admins("activated the detonation countdown of \the [src]") bomb_set++ //There can still be issues with this resetting when there are multiple bombs. Not a big deal though for Nuke/N @@ -315,9 +322,6 @@ var/global/bomb_set security_state.set_security_level(security_state.severe_security_level, TRUE) update_icon() -/obj/machinery/nuclearbomb/proc/check_cutoff() - secure_device() - /obj/machinery/nuclearbomb/proc/secure_device() if(timing <= 0) return @@ -326,7 +330,7 @@ var/global/bomb_set bomb_set-- safety = TRUE timing = 0 - timeleft = clamp(timeleft, minTime, maxTime) + timeleft = clamp(timeleft - world.time, minTime, maxTime) update_icon() /obj/machinery/nuclearbomb/ex_act(severity) @@ -454,12 +458,12 @@ var/global/bomb_set var/list/inserters = list() var/last_turf_state - var/announced = 0 + var/announced = FALSE var/time_to_explosion = 0 - var/self_destruct_cutoff = 60 //Seconds - timeleft = 300 - minTime = 300 - maxTime = 900 + var/self_destruct_cutoff = 60 SECONDS + timeleft = 300 SECONDS + minTime = 300 SECONDS + maxTime = 900 SECONDS /obj/machinery/nuclearbomb/station/Initialize() ..() @@ -491,25 +495,40 @@ var/global/bomb_set if(!istype(sd) || !sd.armed) to_chat(usr, SPAN_WARNING("An inserter has not been armed or is damaged.")) return - visible_message(SPAN_WARNING("Warning. The self-destruct sequence override will be disabled [self_destruct_cutoff] seconds before detonation.")) ..() + visible_message(SPAN_WARNING("Warning. The self-destruct sequence override will be disabled [self_destruct_cutoff/10] seconds before detonation.")) + if(evacuate) + if(!evacuation_controller) + visible_message(SPAN_DANGER("Warning. Unable to initiate evacuation procedures.")) + return + for (var/datum/evacuation_option/EO in evacuation_controller.available_evac_options()) + if(EO.abandon_ship) + evacuation_controller.evac_prep_delay = timeleft - world.time - 2 MINUTES + evacuation_controller.evac_launch_delay = 1.75 MINUTES //Escape pods take time to arm and eject appart from this delay. Take into account. + evacuation_controller.handle_evac_option(EO.option_target, usr) -/obj/machinery/nuclearbomb/station/check_cutoff() - if(timeleft <= self_destruct_cutoff) +/obj/machinery/nuclearbomb/station/secure_device() + if(timing && timeleft - world.time <= self_destruct_cutoff) visible_message(SPAN_WARNING("Self-Destruct abort is no longer possible.")) return ..() + announced = FALSE + for (var/datum/evacuation_option/EO in evacuation_controller.available_evac_options()) + if(EO.option_target == "cancel_abandon_ship") + evacuation_controller.handle_evac_option(EO.option_target, usr) + evacuation_controller.evac_prep_delay = 5 MINUTES + evacuation_controller.evac_launch_delay = 3 MINUTES /obj/machinery/nuclearbomb/station/Process() ..() - if(timeleft > 0 && GAME_STATE < RUNLEVEL_POSTGAME) - if(timeleft <= self_destruct_cutoff) + if(timing && timeleft - world.time > 0 && GAME_STATE < RUNLEVEL_POSTGAME) + if(timeleft - world.time <= self_destruct_cutoff) if(!announced) priority_announcement.Announce("The self-destruct sequence has reached terminal countdown, abort systems have been disabled.", "Self-Destruct Control Computer") - announced = 1 + announced = TRUE if(world.time >= time_to_explosion) var/range - if(timeleft <= (self_destruct_cutoff/2)) + if(timeleft - world.time <= (self_destruct_cutoff/2)) range = rand(14, 21) time_to_explosion = world.time + 2 SECONDS else @@ -518,10 +537,6 @@ var/global/bomb_set var/turf/T = pick_area_and_turf(GLOB.is_station_but_not_space_or_shuttle_area) explosion(T, range) -/obj/machinery/nuclearbomb/station/secure_device() - ..() - announced = 0 - /obj/machinery/nuclearbomb/station/on_update_icon() var/target_icon_state var/turf_color = COLOR_BLACK diff --git a/nano/templates/nuclear_bomb.tmpl b/nano/templates/nuclear_bomb.tmpl index c229841600225..c0f064faaa50b 100644 --- a/nano/templates/nuclear_bomb.tmpl +++ b/nano/templates/nuclear_bomb.tmpl @@ -1,72 +1,101 @@ - -
- Authorization Disk: {{if data.auth}}{{:helper.link('++++++++++', 'eject', {'auth' : 1})}} {{else}} {{:helper.link('----------', 'disk', {'auth' : 1})}}{{/if}} -
-
-
-
Status: {{:data.authstatus}} - {{:data.safe}}
-
Timer: {{:data.time}}
-
-
-
- {{if data.auth && data.yescode}} -
- Timer: {{:helper.link('On', 'play', {'timer' : 1}, data.timer ? 'redButton' : '')}}{{:helper.link('Off', 'stop', {'timer' : 0}, !data.timer ? 'selected' : '')}} -
-
- Time: {{:helper.link('--', '', {'time' : -10}, data.time <= 120 ? 'disabled' : '')}}{{:helper.link('-', '', {'time' : -1}, data.time <= 120 ? 'disabled' : '')}} {{:data.time}} {{:helper.link('+', '', {'time' : 1})}}{{:helper.link('++', '', {'time' : 10})}} -
- {{else}} -
- Timer: {{:helper.link('On', 'play', null, 'disabled')}}{{:helper.link('Off', 'pause', null, 'disabled')}} -
-
- Time: {{:helper.link('-', '', null, 'disabled')}}{{:helper.link('-', '', null, 'disabled')}} {{:data.time}} {{:helper.link('+', '', null, 'disabled')}}{{:helper.link('++', '', null, 'disabled')}} -
- {{/if}} -
-
- {{if data.auth && data.yescode}} -
- Safety: {{:helper.link('Engaged', 'info', {'safety' : 1}, data.safety ? 'selected' : '')}}{{:helper.link('Disengaged', 'alert', {'safety' : 0}, data.safety ? '' : 'redButton')}} -
- {{if data.moveable_anchor}} -
- Anchor: {{:helper.link('Engaged', 'locked', {'anchor' : 1}, data.anchored ? 'selected' : '')}}{{:helper.link('Disengaged', 'unlocked', {'anchor' : 0}, data.anchored ? '' : 'selected')}} -
- {{/if}} - {{else}} -
- Safety: {{:helper.link('Engaged', 'info', null, 'disabled')}}{{:helper.link('Disengaged', 'alert', null, 'disabled')}} -
- {{if data.moveable_anchor}} -
- Anchor: {{:helper.link('Engaged', 'locked', null, 'disabled')}}{{:helper.link('Disengaged', 'unlocked', null, 'disabled')}} -
- {{/if}} - {{/if}} -
-
-
-
-
- >{{if data.message}} {{:data.message}}{{/if}} -
-
-
- {{:helper.link('1', '', {'type' : 1})}}{{:helper.link('2', '', {'type' : 2})}}{{:helper.link('3', '', {'type' : 3})}} -
-
- {{:helper.link('4', '', {'type' : 4})}}{{:helper.link('5', '', {'type' : 5})}}{{:helper.link('6', '', {'type' : 6})}} -
-
- {{:helper.link('7', '', {'type' : 7})}}{{:helper.link('8', '', {'type' : 8})}}{{:helper.link('9', '', {'type' : 9})}} -
-
- {{:helper.link('R', '', {'type' : 'R'})}}{{:helper.link('0', '', {'type' : 0})}}{{:helper.link('E', '', {'type' : 'E'})}} -
-
-
+ +
+ Authorization Disk: {{if data.auth}}{{:helper.link('++++++++++', 'eject', {'auth' : 1})}} {{else}} {{:helper.link('----------', 'disk', {'auth' : 1})}}{{/if}} +
+
+
+
Status: {{:data.authstatus}} - {{:data.safe}}
+
Timer: {{:data.time}}
+
+
+
+ {{if data.auth && data.yescode}} +
+ Timer: {{:helper.link('On', 'play', {'timer' : 1}, data.timer ? 'redButton' : '')}}{{:helper.link('Off', 'stop', {'timer' : 0}, !data.timer ? 'selected' : '')}} +
+
+ Time: {{:helper.link('--', '', {'time' : -10}, data.time <= 120 ? 'disabled' : '')}}{{:helper.link('-', '', {'time' : -1}, data.time <= 120 ? 'disabled' : '')}} {{:data.time}} {{:helper.link('+', '', {'time' : 1})}}{{:helper.link('++', '', {'time' : 10})}} +
+ {{else}} +
+ Timer: {{:helper.link('On', 'play', null, 'disabled')}}{{:helper.link('Off', 'pause', null, 'disabled')}} +
+
+ Time: {{:helper.link('--', '', null, 'disabled')}}{{:helper.link('-', '', null, 'disabled')}} {{:data.time}} {{:helper.link('+', '', null, 'disabled')}}{{:helper.link('++', '', null, 'disabled')}} +
+ {{/if}} +
+
+
+ {{if data.auth && data.yescode}} + {{if data.is_regular_nuke}} +<<<<<<< ours +
+ Anchor: {{:helper.link('Engaged', 'locked', {'anchor' : 1}, data.anchored ? 'selected' : '')}}{{:helper.link('Disengaged', 'unlocked', {'anchor' : 0}, data.anchored ? '' : 'selected')}} +
+ {{else}} +
+ Evacuate: {{:helper.link('Yes', '', {'evacuate' : 1}, data.evacuate ? 'selected' : '')}}{{:helper.link('No', 'alert', 'evacuate' : 1, data.evacuate ? '' : 'redButton')}} +
+======= +
+ Anchor: {{:helper.link('Engaged', 'locked', {'anchor' : 1}, data.anchored ? 'selected' : '')}}{{:helper.link('Disengaged', 'unlocked', {'anchor' : 0}, data.anchored ? '' : 'selected')}} +
+ {{else}} +
+ Evacuate: {{:helper.link('Yes', '', {'evacuate' : 1}, data.evacuate ? 'selected' : '')}}{{:helper.link('No', 'alert', {'evacuate' : 1}, data.evacuate ? '' : 'redButton')}} +
+>>>>>>> theirs + {{/if}} +
+ Safety: {{:helper.link('Engaged', 'info', {'safety' : 1}, data.safety ? 'selected' : '')}}{{:helper.link('Disengaged', 'alert', {'safety' : 0}, data.safety ? '' : 'redButton')}} +
+ {{else}} + {{if data.is_regular_nuke}} +<<<<<<< ours +
+ Anchor: {{:helper.link('Engaged', 'locked', null, 'disabled')}}{{:helper.link('Disengaged', 'unlocked', null, 'disabled')}} +
+ {{else}} +
+ Evacuate: {{:helper.link('Yes', '', null, 'disabled')}}{{:helper.link('No', 'alert', null, 'disabled')}} +
+======= +
+ Anchor: {{:helper.link('Engaged', 'locked', null, 'disabled')}}{{:helper.link('Disengaged', 'unlocked', null, 'disabled')}} +
+ {{else}} +
+ Evacuate: {{:helper.link('Yes', '', null, 'disabled')}}{{:helper.link('No', 'alert', null, 'disabled')}} +
+>>>>>>> theirs + {{/if}} +
+ Safety: {{:helper.link('Engaged', 'info', null, 'disabled')}}{{:helper.link('Disengaged', 'alert', null, 'disabled')}} +
+ {{/if}} +
+
+
+
+
+ >{{if data.message}} {{:data.message}}{{/if}} +
+
+
+ {{:helper.link('1', '', {'type' : 1})}}{{:helper.link('2', '', {'type' : 2})}}{{:helper.link('3', '', {'type' : 3})}} +
+
+ {{:helper.link('4', '', {'type' : 4})}}{{:helper.link('5', '', {'type' : 5})}}{{:helper.link('6', '', {'type' : 6})}} +
+
+ {{:helper.link('7', '', {'type' : 7})}}{{:helper.link('8', '', {'type' : 8})}}{{:helper.link('9', '', {'type' : 9})}} +
+
+ {{:helper.link('R', '', {'type' : 'R'})}}{{:helper.link('0', '', {'type' : 0})}}{{:helper.link('E', '', {'type' : 'E'})}} +
+
+