]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Nuke Timer MinimumTime (#34734)
authorSouthbridge <7013162+southbridge-fur@users.noreply.github.com>
Wed, 29 Jan 2025 09:04:45 +0000 (04:04 -0500)
committerGitHub <noreply@github.com>
Wed, 29 Jan 2025 09:04:45 +0000 (10:04 +0100)
* Implemented the thing

* Made requested changes

Content.Server/Nuke/NukeComponent.cs
Content.Server/Nuke/NukeSystem.cs

index 141e99055cf38a0c649374fa20f2319f9a62510e..e1a117f4bdbe556ddcbd7de422cdd50b8d09679d 100644 (file)
@@ -25,6 +25,13 @@ namespace Content.Server.Nuke
         [ViewVariables(VVAccess.ReadWrite)]
         public int Timer = 300;
 
+        /// <summary>
+        ///     If the nuke is disarmed, this sets the minimum amount of time the timer can have.
+        ///     The remaining time will reset to this value if it is below it.
+        /// </summary>
+        [DataField]
+        public int MinimumTime = 180;
+
         /// <summary>
         ///     How long until the bomb can arm again after deactivation.
         ///     Used to prevent announcements spam.
index 0a6228750580e1174f5b479ffbf3c285ae4a8c68..84118931b109793fbaa8be38fedb6835db618d62 100644 (file)
@@ -522,6 +522,9 @@ public sealed class NukeSystem : EntitySystem
         _sound.PlayGlobalOnStation(uid, _audio.GetSound(component.DisarmSound));
         _sound.StopStationEventMusic(uid, StationEventMusicType.Nuke);
 
+        // reset nuke remaining time to either itself or the minimum time, whichever is higher
+        component.RemainingTime = Math.Max(component.RemainingTime, component.MinimumTime);
+
         // disable sound and reset it
         component.PlayedAlertSound = false;
         component.AlertAudioStream = _audio.Stop(component.AlertAudioStream);