From: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com> Date: Fri, 10 Feb 2023 23:45:38 +0000 (-0600) Subject: Improve explosion logs (#13351) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=95e35b94b5665f5e4f36763ff7af2a42d9ae5454;p=space-station-14.git Improve explosion logs (#13351) * 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 --- diff --git a/Content.Server/Chemistry/EntitySystems/SolutionSpikableSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionSpikableSystem.cs index 3ed4a80af8..b24a07b335 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionSpikableSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionSpikableSystem.cs @@ -75,7 +75,7 @@ public sealed class SolutionSpikableSystem : EntitySystem sourceSolution.RemoveAllSolution(); - _triggerSystem.Trigger(source); + _triggerSystem.Trigger(source, user); } } } diff --git a/Content.Server/Destructible/DestructibleSystem.cs b/Content.Server/Destructible/DestructibleSystem.cs index 212f2b1efa..8227926f35 100644 --- a/Content.Server/Destructible/DestructibleSystem.cs +++ b/Content.Server/Destructible/DestructibleSystem.cs @@ -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. diff --git a/Content.Server/Destructible/Thresholds/Behaviors/ChangeConstructionNodeBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/ChangeConstructionNodeBehavior.cs index c70d6aa976..c971ceebe9 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/ChangeConstructionNodeBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/ChangeConstructionNodeBehavior.cs @@ -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; diff --git a/Content.Server/Destructible/Thresholds/Behaviors/DoActsBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/DoActsBehavior.cs index cca0dfbb4a..064afbe26b 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/DoActsBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/DoActsBehavior.cs @@ -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)) { diff --git a/Content.Server/Destructible/Thresholds/Behaviors/DumpCanisterBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/DumpCanisterBehavior.cs index aa70d2528d..342edef271 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/DumpCanisterBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/DumpCanisterBehavior.cs @@ -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().PurgeContents(owner); } diff --git a/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs b/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs index 80553f2d33..eae6a04109 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/DumpRestockInventory.cs @@ -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(owner, out var packagecomp) || !system.EntityManager.TryGetComponent(owner, out var xform)) diff --git a/Content.Server/Destructible/Thresholds/Behaviors/EjectVendorItems.cs b/Content.Server/Destructible/Thresholds/Behaviors/EjectVendorItems.cs index b49c4c519a..5cd377f0b5 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/EjectVendorItems.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/EjectVendorItems.cs @@ -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(owner, out var vendingcomp) || !system.EntityManager.TryGetComponent(owner, out var xform)) diff --git a/Content.Server/Destructible/Thresholds/Behaviors/EmptyAllContainersBehaviour.cs b/Content.Server/Destructible/Thresholds/Behaviors/EmptyAllContainersBehaviour.cs index 1beefb126d..1082acb25d 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/EmptyAllContainersBehaviour.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/EmptyAllContainersBehaviour.cs @@ -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(owner, out var containerManager)) return; diff --git a/Content.Server/Destructible/Thresholds/Behaviors/ExplodeBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/ExplodeBehavior.cs index 93ee184f7c..261501f817 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/ExplodeBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/ExplodeBehavior.cs @@ -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); } } } diff --git a/Content.Server/Destructible/Thresholds/Behaviors/GibBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/GibBehavior.cs index 50ceba19b5..cca0515112 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/GibBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/GibBehavior.cs @@ -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)) { diff --git a/Content.Server/Destructible/Thresholds/Behaviors/IThresholdBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/IThresholdBehavior.cs index 7d4de81e97..b5e78fd80c 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/IThresholdBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/IThresholdBehavior.cs @@ -10,6 +10,7 @@ /// An instance of to pull dependencies /// and other systems from. /// - void Execute(EntityUid owner, DestructibleSystem system); + /// The entity that caused this behavior. + void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null); } } diff --git a/Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs index 42aae8250d..015b480b82 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs @@ -13,7 +13,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors /// [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(owner).Coordinates; SoundSystem.Play(Sound.GetSound(), Filter.Pvs(pos), pos, AudioHelpers.WithVariation(0.125f)); diff --git a/Content.Server/Destructible/Thresholds/Behaviors/SolutionExplosionBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/SolutionExplosionBehavior.cs index d7145cf031..490be2360f 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/SolutionExplosionBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/SolutionExplosionBehavior.cs @@ -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); } } } diff --git a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs index df8cd88751..a665fc6155 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs @@ -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(owner).MapPosition; diff --git a/Content.Server/Destructible/Thresholds/Behaviors/SpillBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/SpillBehavior.cs index 3825df9e0f..d751da911b 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/SpillBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/SpillBehavior.cs @@ -19,7 +19,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors /// /// Entity on which behavior is executed /// system calling the behavior - public void Execute(EntityUid owner, DestructibleSystem system) + /// + public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null) { var solutionContainerSystem = EntitySystem.Get(); var spillableSystem = EntitySystem.Get(); diff --git a/Content.Server/Destructible/Thresholds/Behaviors/TriggerBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/TriggerBehavior.cs index 3f6c976e0f..255b4f7ace 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/TriggerBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/TriggerBehavior.cs @@ -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); } } diff --git a/Content.Server/Destructible/Thresholds/DamageThreshold.cs b/Content.Server/Destructible/Thresholds/DamageThreshold.cs index 2d5b544b6d..b7f5bb61f4 100644 --- a/Content.Server/Destructible/Thresholds/DamageThreshold.cs +++ b/Content.Server/Destructible/Thresholds/DamageThreshold.cs @@ -77,7 +77,9 @@ namespace Content.Server.Destructible.Thresholds /// An instance of to get dependency and /// system references from, if relevant. /// - public void Execute(EntityUid owner, DestructibleSystem system, IEntityManager entityManager) + /// + /// + 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); } } } diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs index d312f6feb5..61195c2958 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs @@ -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(uid) || HasComp(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(uid) || HasComp(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}"); + } } } diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 5b9eef5686..f88989051f 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -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}"); } /// @@ -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)); diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.Signal.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.Signal.cs index 80f11b9fa3..0d719c4c5d 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.Signal.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.Signal.cs @@ -7,7 +7,7 @@ namespace Content.Server.Explosion.EntitySystems public sealed partial class TriggerSystem { [Dependency] private readonly SignalLinkerSystem _signalSystem = default!; - + private void InitializeSignal() { SubscribeLocalEvent(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) { diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.Voice.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.Voice.cs index 3da6c98cab..28c627e143 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.Voice.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.Voice.cs @@ -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); } } diff --git a/Content.Server/Kitchen/Components/MicrowaveComponent.cs b/Content.Server/Kitchen/Components/MicrowaveComponent.cs index 726da379bf..74182dd173 100644 --- a/Content.Server/Kitchen/Components/MicrowaveComponent.cs +++ b/Content.Server/Kitchen/Components/MicrowaveComponent.cs @@ -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; } } } diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index 5bca202a44..86935163bb 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -56,7 +56,7 @@ namespace Content.Server.Kitchen.EntitySystems SubscribeLocalEvent(OnRefreshParts); SubscribeLocalEvent(OnUpgradeExamine); - SubscribeLocalEvent((u,c,_) => Wzhzhzh(u,c)); + SubscribeLocalEvent((u,c,m) => Wzhzhzh(u,c,m.Session.AttachedEntity)); SubscribeLocalEvent(OnEjectMessage); SubscribeLocalEvent(OnEjectIndex); SubscribeLocalEvent(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 /// - public void Wzhzhzh(EntityUid uid, MicrowaveComponent component) + public void Wzhzhzh(EntityUid uid, MicrowaveComponent component, EntityUid? user) { if (!HasContents(component) || HasComp(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) diff --git a/Content.Server/MachineLinking/Events/SignalReceivedEvent.cs b/Content.Server/MachineLinking/Events/SignalReceivedEvent.cs index e19a5de874..d3d453d9c0 100644 --- a/Content.Server/MachineLinking/Events/SignalReceivedEvent.cs +++ b/Content.Server/MachineLinking/Events/SignalReceivedEvent.cs @@ -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; } } } diff --git a/Content.Server/MachineLinking/System/SignalLinkerSystem.cs b/Content.Server/MachineLinking/System/SignalLinkerSystem.cs index 9f88df52d0..6d08c5dc57 100644 --- a/Content.Server/MachineLinking/System/SignalLinkerSystem.cs +++ b/Content.Server/MachineLinking/System/SignalLinkerSystem.cs @@ -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) diff --git a/Content.Server/PowerCell/PowerCellSystem.cs b/Content.Server/PowerCell/PowerCellSystem.cs index 38f6e96146..7555e5ab91 100644 --- a/Content.Server/PowerCell/PowerCellSystem.cs +++ b/Content.Server/PowerCell/PowerCellSystem.cs @@ -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); } diff --git a/Resources/Prototypes/Entities/Objects/Power/powercells.yml b/Resources/Prototypes/Entities/Objects/Power/powercells.yml index e12bfeb20d..8a5e209303 100644 --- a/Resources/Prototypes/Entities/Objects/Power/powercells.yml +++ b/Resources/Prototypes/Entities/Objects/Power/powercells.yml @@ -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