]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Improve explosion logs (#13351)
authorChief-Engineer <119664036+Chief-Engineer@users.noreply.github.com>
Fri, 10 Feb 2023 23:45:38 +0000 (17:45 -0600)
committerGitHub <noreply@github.com>
Fri, 10 Feb 2023 23:45:38 +0000 (23:45 +0000)
* add types to explosion logs

* make explosions logged by default

* add cause parameter to IThresholdBehavior

* add cause to ExplodeBehaviors

* add cause to power cell explosions

* remove useless log

* add triggerer to triggers

* add logs for damage from explosions

* sneaky power cell update

27 files changed:
Content.Server/Chemistry/EntitySystems/SolutionSpikableSystem.cs
Content.Server/Destructible/DestructibleSystem.cs
Content.Server/Destructible/Thresholds/Behaviors/ChangeConstructionNodeBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/DoActsBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/DumpCanisterBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs
Content.Server/Destructible/Thresholds/Behaviors/EjectVendorItems.cs
Content.Server/Destructible/Thresholds/Behaviors/EmptyAllContainersBehaviour.cs
Content.Server/Destructible/Thresholds/Behaviors/ExplodeBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/GibBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/IThresholdBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/SolutionExplosionBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/SpillBehavior.cs
Content.Server/Destructible/Thresholds/Behaviors/TriggerBehavior.cs
Content.Server/Destructible/Thresholds/DamageThreshold.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.cs
Content.Server/Explosion/EntitySystems/TriggerSystem.Signal.cs
Content.Server/Explosion/EntitySystems/TriggerSystem.Voice.cs
Content.Server/Kitchen/Components/MicrowaveComponent.cs
Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs
Content.Server/MachineLinking/Events/SignalReceivedEvent.cs
Content.Server/MachineLinking/System/SignalLinkerSystem.cs
Content.Server/PowerCell/PowerCellSystem.cs
Resources/Prototypes/Entities/Objects/Power/powercells.yml

index 3ed4a80af81d598df4a84267e2d8a9949768a6c1..b24a07b3359cd9b88dee35cd5a5a6a687cb07ed7 100644 (file)
@@ -75,7 +75,7 @@ public sealed class SolutionSpikableSystem : EntitySystem
 
             sourceSolution.RemoveAllSolution();
 
-            _triggerSystem.Trigger(source);
+            _triggerSystem.Trigger(source, user);
         }
     }
 }
index 212f2b1efae7c77aeb9126cb8f0dd7a7a94ff718..8227926f35780c14af8b55c9aab0791f2e2a28c4 100644 (file)
@@ -51,7 +51,7 @@ namespace Content.Server.Destructible
                 {
                     RaiseLocalEvent(uid, new DamageThresholdReached(component, threshold), true);
 
-                    threshold.Execute(uid, this, EntityManager);
+                    threshold.Execute(uid, this, EntityManager, args.Origin);
                 }
 
                 // if destruction behavior (or some other deletion effect) occurred, don't run other triggers.
index c70d6aa9768ae8d9ba2eb9df193cfc7bb9e9d6dd..c971ceebe9f831085267b609ae88141c8e6dcbf8 100644 (file)
@@ -9,7 +9,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
         [DataField("node")]
         public string Node { get; private set; } = string.Empty;
 
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             if (string.IsNullOrEmpty(Node) || !system.EntityManager.TryGetComponent(owner, out ConstructionComponent? construction))
                 return;
index cca0dfbb4aabb1e36e9f75bb0a73604ae61ad099..064afbe26b7b670c5ae6aabecc24ea09d7ff2c23 100644 (file)
@@ -15,7 +15,7 @@
             return (Acts & act) != 0;
         }
 
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             if (HasAct(ThresholdActs.Breakage))
             {
index aa70d2528d375e9bd8a9bbe05867dafd4f4d6c88..342edef27122a9b1dfbc203ad568c88f8f83fbbb 100644 (file)
@@ -6,7 +6,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
     [DataDefinition]
     public sealed class DumpCanisterBehavior : IThresholdBehavior
     {
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             system.EntityManager.EntitySysManager.GetEntitySystem<GasCanisterSystem>().PurgeContents(owner);
         }
index 80553f2d3376a4604089d1483c983e765478f675..eae6a04109b83b15afe138eb43c88e9532fc16f9 100644 (file)
@@ -24,7 +24,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
         [DataField("offset")]
         public float Offset { get; set; } = 0.5f;
 
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             if (!system.EntityManager.TryGetComponent<VendingMachineRestockComponent>(owner, out var packagecomp) ||
                 !system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform))
index b49c4c519a936dbdda9f348c0636a59e1b3bf25a..5cd377f0b56afa1e959c6a5f8cff580bc3854caf 100644 (file)
@@ -23,7 +23,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
         [DataField("max")]
         public int Max = 3;
 
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             if (!system.EntityManager.TryGetComponent<VendingMachineComponent>(owner, out var vendingcomp) ||
                 !system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform))
index 1beefb126d164ed7336318c1858bdb08bed56b39..1082acb25d777bf2014ad2081bf238cc9cf2dc59 100644 (file)
@@ -8,7 +8,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
     [DataDefinition]
     public sealed class EmptyAllContainersBehaviour : IThresholdBehavior
     {
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             if (!system.EntityManager.TryGetComponent<ContainerManagerComponent>(owner, out var containerManager))
                 return;
index 93ee184f7c0d29700146669635fb61dfc28c4165..261501f81737f9436133299fb3a90eb556ec5640 100644 (file)
@@ -10,9 +10,9 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
     [DataDefinition]
     public sealed class ExplodeBehavior : IThresholdBehavior
     {
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
-            system.ExplosionSystem.TriggerExplosive(owner);
+            system.ExplosionSystem.TriggerExplosive(owner, user:cause);
         }
     }
 }
index 50ceba19b51abcc31783342322f1efd260d3a5de..cca0515112df859541d04f419fd01576b4db9ea8 100644 (file)
@@ -9,7 +9,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
     {
         [DataField("recursive")] private bool _recursive = true;
 
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             if (system.EntityManager.TryGetComponent(owner, out BodyComponent? body))
             {
index 7d4de81e974897b0166d994fdcf091df8024cddd..b5e78fd80c5ff59d100b40110f0dd50b28d81dfc 100644 (file)
@@ -10,6 +10,7 @@
         ///     An instance of <see cref="DestructibleSystem"/> to pull dependencies
         ///     and other systems from.
         /// </param>
-        void Execute(EntityUid owner, DestructibleSystem system);
+        /// <param name="cause">The entity that caused this behavior.</param>
+        void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null);
     }
 }
index 42aae8250df8cf7009ee4094562e25ca9e19ee98..015b480b82573983b017da619884eec1704a3b4c 100644 (file)
@@ -13,7 +13,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
         /// </summary>
         [DataField("sound", required: true)] public SoundSpecifier Sound { get; set; } = default!;
 
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             var pos = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;
             SoundSystem.Play(Sound.GetSound(), Filter.Pvs(pos), pos, AudioHelpers.WithVariation(0.125f));
index d7145cf031c0891859f4a7c69833cd94f904eead..490be2360f55da9c365fca8325eb9d1c2463cd7b 100644 (file)
@@ -16,7 +16,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
         [DataField("solution", required: true)]
         public string Solution = default!;
 
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             if (system.SolutionContainerSystem.TryGetSolution(owner, Solution, out var explodingSolution)
                 && system.EntityManager.TryGetComponent(owner, out ExplosiveComponent? explosiveComponent))
@@ -39,7 +39,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
                 // Don't delete the object here - let other processes like physical damage from the
                 // explosion clean up the exploding object(s)
                 var explosiveTotalIntensity = explosiveComponent.TotalIntensity * explosionScaleFactor;
-                system.ExplosionSystem.TriggerExplosive(owner, explosiveComponent, false, explosiveTotalIntensity);
+                system.ExplosionSystem.TriggerExplosive(owner, explosiveComponent, false, explosiveTotalIntensity, user:cause);
             }
         }
     }
index df8cd88751c4c94ff86d4dd1a3637cf4c5cadf01..a665fc615500e780ec646808709fe89ce7742007 100644 (file)
@@ -19,7 +19,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
         [DataField("offset")]
         public float Offset { get; set; } = 0.5f;
 
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
 
index 3825df9e0fd70a5805e589075add816d3f53f242..d751da911bc0a90ce0032e00603c6a480158827a 100644 (file)
@@ -19,7 +19,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
         /// </summary>
         /// <param name="owner">Entity on which behavior is executed</param>
         /// <param name="system">system calling the behavior</param>
-        public void Execute(EntityUid owner, DestructibleSystem system)
+        /// <param name="cause"></param>
+        public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
         {
             var solutionContainerSystem = EntitySystem.Get<SolutionContainerSystem>();
             var spillableSystem = EntitySystem.Get<SpillableSystem>();
index 3f6c976e0f187c71aa699c82daae3d1769c81a89..255b4f7ace8f14b5bf44d0eb39e40ebd2c971314 100644 (file)
@@ -3,8 +3,8 @@
 [DataDefinition]
 public sealed class TriggerBehavior : IThresholdBehavior
 {
-    public void Execute(EntityUid owner, DestructibleSystem system)
+    public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
     {
-        system.TriggerSystem.Trigger(owner);
+        system.TriggerSystem.Trigger(owner, cause);
     }
 }
index 2d5b544b6da442836e1fb25f4d09d7368736b420..b7f5bb61f4f66e4ee9ccc857b758a8b8061c4083 100644 (file)
@@ -77,7 +77,9 @@ namespace Content.Server.Destructible.Thresholds
         ///     An instance of <see cref="DestructibleSystem"/> to get dependency and
         ///     system references from, if relevant.
         /// </param>
-        public void Execute(EntityUid owner, DestructibleSystem system, IEntityManager entityManager)
+        /// <param name="entityManager"></param>
+        /// <param name="cause"></param>
+        public void Execute(EntityUid owner, DestructibleSystem system, IEntityManager entityManager, EntityUid? cause)
         {
             Triggered = true;
 
@@ -87,7 +89,7 @@ namespace Content.Server.Destructible.Thresholds
                 if (!entityManager.EntityExists(owner))
                     return;
 
-                behavior.Execute(owner, system);
+                behavior.Execute(owner, system, cause);
             }
         }
     }
index d312f6feb5b5ce75a1f183d70201b5826728f98b..61195c2958353e6f899571e7866a5af38389b9c8 100644 (file)
@@ -1,7 +1,11 @@
 using System.Linq;
+using Content.Server.Explosion.Components;
+using Content.Server.Mind.Components;
 using Content.Shared.CCVar;
 using Content.Shared.Damage;
+using Content.Shared.Database;
 using Content.Shared.Explosion;
+using Content.Shared.FixedPoint;
 using Content.Shared.Maps;
 using Content.Shared.Physics;
 using Content.Shared.Spawners.Components;
@@ -388,10 +392,23 @@ public sealed partial class ExplosionSystem : EntitySystem
             {
                 // no damage-dict multiplication required.
                 _damageableSystem.TryChangeDamage(uid, damage, ignoreResistances: true, damageable: damageable);
+                if (HasComp<MindComponent>(uid) || HasComp<ExplosiveComponent>(uid))
+                {
+                    var damageStr = string.Join(", ", damage.DamageDict.Select(entry => $"{entry.Key}: {entry.Value}"));
+                    _adminLogger.Add(LogType.Explosion, LogImpact.Medium,
+                        $"Explosion caused {{{damageStr}}} to {ToPrettyString(uid):target} at {Transform(uid).Coordinates}");
+                }
             }
             else
             {
-                _damageableSystem.TryChangeDamage(uid, damage * ev.DamageCoefficient, ignoreResistances: true, damageable: damageable);
+                var appliedDamage = damage * ev.DamageCoefficient;
+                _damageableSystem.TryChangeDamage(uid, appliedDamage, ignoreResistances: true, damageable: damageable);
+                if (HasComp<MindComponent>(uid) || HasComp<ExplosiveComponent>(uid))
+                {
+                    var damageStr = string.Join(", ", appliedDamage.DamageDict.Select(entry => $"{entry.Key}: {entry.Value}"));
+                    _adminLogger.Add(LogType.Explosion, LogImpact.Medium,
+                        $"Explosion caused {{{damageStr}}} to {ToPrettyString(uid):target} at {Transform(uid).Coordinates}");
+                }
             }
         }
 
index 5b9eef568638e28dc3fca716b8f3669b697af492..f88989051f72203c24e0e73604d68fb560889056 100644 (file)
@@ -216,22 +216,22 @@ public sealed partial class ExplosionSystem : EntitySystem
         int maxTileBreak = int.MaxValue,
         bool canCreateVacuum = true,
         EntityUid? user = null,
-        bool addLog = false)
+        bool addLog = true)
     {
-        var pos = Transform(uid).MapPosition;
+        var pos = Transform(uid);
 
 
-        QueueExplosion(pos, typeId, totalIntensity, slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum, addLog: false);
+        QueueExplosion(pos.MapPosition, typeId, totalIntensity, slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum, addLog: false);
 
         if (!addLog)
             return;
 
         if (user == null)
             _adminLogger.Add(LogType.Explosion, LogImpact.High,
-                $"{ToPrettyString(uid):entity} exploded at {pos:coordinates} with intensity {totalIntensity} slope {slope}");
+                $"{ToPrettyString(uid):entity} exploded ({typeId}) at {pos.Coordinates:coordinates} with intensity {totalIntensity} slope {slope}");
         else
             _adminLogger.Add(LogType.Explosion, LogImpact.High,
-                $"{ToPrettyString(user.Value):user} caused {ToPrettyString(uid):entity} to explode at {pos:coordinates} with intensity {totalIntensity} slope {slope}");
+                $"{ToPrettyString(user.Value):user} caused {ToPrettyString(uid):entity} to explode ({typeId}) at {pos.Coordinates:coordinates} with intensity {totalIntensity} slope {slope}");
     }
 
     /// <summary>
@@ -245,7 +245,7 @@ public sealed partial class ExplosionSystem : EntitySystem
         float tileBreakScale = 1f,
         int maxTileBreak = int.MaxValue,
         bool canCreateVacuum = true,
-        bool addLog = false)
+        bool addLog = true)
     {
         if (totalIntensity <= 0 || slope <= 0)
             return;
@@ -257,7 +257,7 @@ public sealed partial class ExplosionSystem : EntitySystem
         }
 
         if (addLog) // dont log if already created a separate, more detailed, log.
-            _adminLogger.Add(LogType.Explosion, LogImpact.High, $"Explosion spawned at {epicenter:coordinates} with intensity {totalIntensity} slope {slope}");
+            _adminLogger.Add(LogType.Explosion, LogImpact.High, $"Explosion ({typeId}) spawned at {epicenter:coordinates} with intensity {totalIntensity} slope {slope}");
 
         _explosionQueue.Enqueue(() => SpawnExplosion(epicenter, type, totalIntensity,
             slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum));
index 80f11b9fa34cd0593261c3085a784c940a8e8ef1..0d719c4c5da1df82877ae1a6f0e6061c4e1c6abb 100644 (file)
@@ -7,7 +7,7 @@ namespace Content.Server.Explosion.EntitySystems
     public sealed partial class TriggerSystem
     {
         [Dependency] private readonly SignalLinkerSystem _signalSystem = default!;
-            
+
         private void InitializeSignal()
         {
             SubscribeLocalEvent<TriggerOnSignalComponent,SignalReceivedEvent>(OnSignalReceived);
@@ -19,7 +19,7 @@ namespace Content.Server.Explosion.EntitySystems
             if (args.Port != component.Port)
                 return;
 
-            Trigger(uid);
+            Trigger(uid, args.Trigger);
         }
         private void OnInit(EntityUid uid, TriggerOnSignalComponent component, ComponentInit args)
         {
index 3da6c98cab45fc984495560748ee8c374f6bd126..28c627e14347ebcb6e070157c2f503d362c705ba 100644 (file)
@@ -41,7 +41,7 @@ namespace Content.Server.Explosion.EntitySystems
             {
                 _adminLogger.Add(LogType.Trigger, LogImpact.High,
                         $"A voice-trigger on {ToPrettyString(uid):entity} was triggered by {ToPrettyString(args.Source):speaker} speaking the key-phrase {component.KeyPhrase}.");
-                Trigger(uid);
+                Trigger(uid, args.Source);
             }
         }
 
index 726da379bf7c021a0a712d2a8499b3f693796ab4..74182dd17336a3cb754a24f808b9aff89c7a9a5e 100644 (file)
@@ -59,10 +59,12 @@ namespace Content.Server.Kitchen.Components
     public sealed class BeingMicrowavedEvent : HandledEntityEventArgs
     {
         public EntityUid Microwave;
+        public EntityUid? User;
 
-        public BeingMicrowavedEvent(EntityUid microwave)
+        public BeingMicrowavedEvent(EntityUid microwave, EntityUid? user)
         {
             Microwave = microwave;
+            User = user;
         }
     }
 }
index 5bca202a441a7ddf5b5675c87ae474cb401adb68..86935163bb8c646447e12dfc1773007bc30d56e1 100644 (file)
@@ -56,7 +56,7 @@ namespace Content.Server.Kitchen.EntitySystems
             SubscribeLocalEvent<MicrowaveComponent, RefreshPartsEvent>(OnRefreshParts);
             SubscribeLocalEvent<MicrowaveComponent, UpgradeExamineEvent>(OnUpgradeExamine);
 
-            SubscribeLocalEvent<MicrowaveComponent, MicrowaveStartCookMessage>((u,c,_) => Wzhzhzh(u,c));
+            SubscribeLocalEvent<MicrowaveComponent, MicrowaveStartCookMessage>((u,c,m) => Wzhzhzh(u,c,m.Session.AttachedEntity));
             SubscribeLocalEvent<MicrowaveComponent, MicrowaveEjectMessage>(OnEjectMessage);
             SubscribeLocalEvent<MicrowaveComponent, MicrowaveEjectSolidIndexedMessage>(OnEjectIndex);
             SubscribeLocalEvent<MicrowaveComponent, MicrowaveSelectCookTimeMessage>(OnSelectTime);
@@ -215,7 +215,7 @@ namespace Content.Server.Kitchen.EntitySystems
 
             _audio.PlayPvs(component.ClickSound, uid, AudioParams.Default.WithVolume(-2));
             component.CurrentCookTimerTime = 10;
-            Wzhzhzh(uid, component);
+            Wzhzhzh(uid, component, args.Victim);
             UpdateUserInterfaceState(uid, component);
         }
 
@@ -314,7 +314,7 @@ namespace Content.Server.Kitchen.EntitySystems
         /// It does not make a "wzhzhzh" sound, it makes a "mmmmmmmm" sound!
         /// -emo
         /// </remarks>
-        public void Wzhzhzh(EntityUid uid, MicrowaveComponent component)
+        public void Wzhzhzh(EntityUid uid, MicrowaveComponent component, EntityUid? user)
         {
             if (!HasContents(component) || HasComp<ActiveMicrowaveComponent>(uid))
                 return;
@@ -324,7 +324,7 @@ namespace Content.Server.Kitchen.EntitySystems
             foreach (var item in component.Storage.ContainedEntities)
             {
                 // special behavior when being microwaved ;)
-                var ev = new BeingMicrowavedEvent(uid);
+                var ev = new BeingMicrowavedEvent(uid, user);
                 RaiseLocalEvent(item, ev);
 
                 if (ev.Handled)
index e19a5de874c41a8bb3d13819d601b292e8eff002..d3d453d9c0dd6b5c1d02bf5da915148f0d1551d7 100644 (file)
@@ -3,10 +3,12 @@ namespace Content.Server.MachineLinking.Events
     public sealed class SignalReceivedEvent : EntityEventArgs
     {
         public readonly string Port;
+        public readonly EntityUid? Trigger;
 
-        public SignalReceivedEvent(string port)
+        public SignalReceivedEvent(string port, EntityUid? trigger)
         {
             Port = port;
+            Trigger = trigger;
         }
     }
 }
index 9f88df52d0806b52e9dad64a368ef0ebf05ab224..6d08c5dc57f20e9492adf47f0d7f955a0fd493a9 100644 (file)
@@ -140,7 +140,7 @@ namespace Content.Server.MachineLinking.System
                 return;
 
             foreach (var receiver in receivers)
-                RaiseLocalEvent(receiver.Uid, new SignalReceivedEvent(receiver.Port), false);
+                RaiseLocalEvent(receiver.Uid, new SignalReceivedEvent(receiver.Port, uid), false);
         }
 
         private void OnTransmitterStartup(EntityUid uid, SignalTransmitterComponent transmitter, ComponentStartup args)
index 38f6e9614651d3db06fbd79f0ee1dd2df5c50ae9..7555e5ab915f282ca6be408f5abd97ec84dfab0f 100644 (file)
@@ -56,14 +56,14 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
         args.Handled = true;
 
         // What the fuck are you doing???
-        Explode(uid, component);
+        Explode(uid, component, args.User);
     }
 
     private void OnChargeChanged(EntityUid uid, PowerCellComponent component, ChargeChangedEvent args)
     {
         if (component.IsRigged)
         {
-            Explode(uid);
+            Explode(uid, cause: null);
             return;
         }
 
@@ -87,16 +87,14 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
         }
     }
 
-    private void Explode(EntityUid uid, BatteryComponent? battery = null)
+    private void Explode(EntityUid uid, BatteryComponent? battery = null, EntityUid? cause = null)
     {
-        _adminLogger.Add(LogType.Explosion, LogImpact.High, $"Sabotaged power cell {ToPrettyString(uid)} is exploding");
-
         if (!Resolve(uid, ref battery))
             return;
 
-        var radius = MathF.Min(5, MathF.Ceiling(MathF.Sqrt(battery.CurrentCharge) / 30));
+        var radius = MathF.Min(5, MathF.Sqrt(battery.CurrentCharge) / 9);
 
-        _explosionSystem.TriggerExplosive(uid, radius: radius);
+        _explosionSystem.TriggerExplosive(uid, radius: radius, user:cause);
         QueueDel(uid);
     }
 
index e12bfeb20d81472ae1eb93638adf9f2eccd99864..8a5e209303ff6429bcb9759cf9a4481814a9ef74 100644 (file)
@@ -8,6 +8,8 @@
   - type: PowerCell
   - type: Explosive
     explosionType: Default
+    maxIntensity: 200
+    intensitySlope: 1.5
   - type: Sprite
     sprite: Objects/Power/power_cells.rsi
     netsync: false