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
This commit is contained in:
Chief-Engineer
2023-02-10 17:45:38 -06:00
committed by GitHub
parent 57275d97d3
commit 95e35b94b5
27 changed files with 71 additions and 46 deletions

View File

@@ -75,7 +75,7 @@ public sealed class SolutionSpikableSystem : EntitySystem
sourceSolution.RemoveAllSolution(); sourceSolution.RemoveAllSolution();
_triggerSystem.Trigger(source); _triggerSystem.Trigger(source, user);
} }
} }
} }

View File

@@ -51,7 +51,7 @@ namespace Content.Server.Destructible
{ {
RaiseLocalEvent(uid, new DamageThresholdReached(component, threshold), true); 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. // if destruction behavior (or some other deletion effect) occurred, don't run other triggers.

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
[DataField("node")] [DataField("node")]
public string Node { get; private set; } = string.Empty; 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)) if (string.IsNullOrEmpty(Node) || !system.EntityManager.TryGetComponent(owner, out ConstructionComponent? construction))
return; return;

View File

@@ -15,7 +15,7 @@
return (Acts & act) != 0; 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)) if (HasAct(ThresholdActs.Breakage))
{ {

View File

@@ -6,7 +6,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
[DataDefinition] [DataDefinition]
public sealed class DumpCanisterBehavior : IThresholdBehavior 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); system.EntityManager.EntitySysManager.GetEntitySystem<GasCanisterSystem>().PurgeContents(owner);
} }

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
[DataField("offset")] [DataField("offset")]
public float Offset { get; set; } = 0.5f; 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) || if (!system.EntityManager.TryGetComponent<VendingMachineRestockComponent>(owner, out var packagecomp) ||
!system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform)) !system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform))

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
[DataField("max")] [DataField("max")]
public int Max = 3; 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) || if (!system.EntityManager.TryGetComponent<VendingMachineComponent>(owner, out var vendingcomp) ||
!system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform)) !system.EntityManager.TryGetComponent<TransformComponent>(owner, out var xform))

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
[DataDefinition] [DataDefinition]
public sealed class EmptyAllContainersBehaviour : IThresholdBehavior 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)) if (!system.EntityManager.TryGetComponent<ContainerManagerComponent>(owner, out var containerManager))
return; return;

View File

@@ -10,9 +10,9 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
[DataDefinition] [DataDefinition]
public sealed class ExplodeBehavior : IThresholdBehavior 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);
} }
} }
} }

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{ {
[DataField("recursive")] private bool _recursive = true; [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)) if (system.EntityManager.TryGetComponent(owner, out BodyComponent? body))
{ {

View File

@@ -10,6 +10,7 @@
/// An instance of <see cref="DestructibleSystem"/> to pull dependencies /// An instance of <see cref="DestructibleSystem"/> to pull dependencies
/// and other systems from. /// and other systems from.
/// </param> /// </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);
} }
} }

View File

@@ -13,7 +13,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// </summary> /// </summary>
[DataField("sound", required: true)] public SoundSpecifier Sound { get; set; } = default!; [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; var pos = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;
SoundSystem.Play(Sound.GetSound(), Filter.Pvs(pos), pos, AudioHelpers.WithVariation(0.125f)); SoundSystem.Play(Sound.GetSound(), Filter.Pvs(pos), pos, AudioHelpers.WithVariation(0.125f));

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
[DataField("solution", required: true)] [DataField("solution", required: true)]
public string Solution = default!; 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) if (system.SolutionContainerSystem.TryGetSolution(owner, Solution, out var explodingSolution)
&& system.EntityManager.TryGetComponent(owner, out ExplosiveComponent? explosiveComponent)) && 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 // Don't delete the object here - let other processes like physical damage from the
// explosion clean up the exploding object(s) // explosion clean up the exploding object(s)
var explosiveTotalIntensity = explosiveComponent.TotalIntensity * explosionScaleFactor; var explosiveTotalIntensity = explosiveComponent.TotalIntensity * explosionScaleFactor;
system.ExplosionSystem.TriggerExplosive(owner, explosiveComponent, false, explosiveTotalIntensity); system.ExplosionSystem.TriggerExplosive(owner, explosiveComponent, false, explosiveTotalIntensity, user:cause);
} }
} }
} }

View File

@@ -19,7 +19,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
[DataField("offset")] [DataField("offset")]
public float Offset { get; set; } = 0.5f; 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; var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;

View File

@@ -19,7 +19,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// </summary> /// </summary>
/// <param name="owner">Entity on which behavior is executed</param> /// <param name="owner">Entity on which behavior is executed</param>
/// <param name="system">system calling the behavior</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 solutionContainerSystem = EntitySystem.Get<SolutionContainerSystem>();
var spillableSystem = EntitySystem.Get<SpillableSystem>(); var spillableSystem = EntitySystem.Get<SpillableSystem>();

View File

@@ -3,8 +3,8 @@
[DataDefinition] [DataDefinition]
public sealed class TriggerBehavior : IThresholdBehavior 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);
} }
} }

View File

@@ -77,7 +77,9 @@ namespace Content.Server.Destructible.Thresholds
/// An instance of <see cref="DestructibleSystem"/> to get dependency and /// An instance of <see cref="DestructibleSystem"/> to get dependency and
/// system references from, if relevant. /// system references from, if relevant.
/// </param> /// </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; Triggered = true;
@@ -87,7 +89,7 @@ namespace Content.Server.Destructible.Thresholds
if (!entityManager.EntityExists(owner)) if (!entityManager.EntityExists(owner))
return; return;
behavior.Execute(owner, system); behavior.Execute(owner, system, cause);
} }
} }
} }

View File

@@ -1,7 +1,11 @@
using System.Linq; using System.Linq;
using Content.Server.Explosion.Components;
using Content.Server.Mind.Components;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.Database;
using Content.Shared.Explosion; using Content.Shared.Explosion;
using Content.Shared.FixedPoint;
using Content.Shared.Maps; using Content.Shared.Maps;
using Content.Shared.Physics; using Content.Shared.Physics;
using Content.Shared.Spawners.Components; using Content.Shared.Spawners.Components;
@@ -388,10 +392,23 @@ public sealed partial class ExplosionSystem : EntitySystem
{ {
// no damage-dict multiplication required. // no damage-dict multiplication required.
_damageableSystem.TryChangeDamage(uid, damage, ignoreResistances: true, damageable: damageable); _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 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}");
}
} }
} }

View File

@@ -216,22 +216,22 @@ public sealed partial class ExplosionSystem : EntitySystem
int maxTileBreak = int.MaxValue, int maxTileBreak = int.MaxValue,
bool canCreateVacuum = true, bool canCreateVacuum = true,
EntityUid? user = null, 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) if (!addLog)
return; return;
if (user == null) if (user == null)
_adminLogger.Add(LogType.Explosion, LogImpact.High, _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 else
_adminLogger.Add(LogType.Explosion, LogImpact.High, _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> /// <summary>
@@ -245,7 +245,7 @@ public sealed partial class ExplosionSystem : EntitySystem
float tileBreakScale = 1f, float tileBreakScale = 1f,
int maxTileBreak = int.MaxValue, int maxTileBreak = int.MaxValue,
bool canCreateVacuum = true, bool canCreateVacuum = true,
bool addLog = false) bool addLog = true)
{ {
if (totalIntensity <= 0 || slope <= 0) if (totalIntensity <= 0 || slope <= 0)
return; return;
@@ -257,7 +257,7 @@ public sealed partial class ExplosionSystem : EntitySystem
} }
if (addLog) // dont log if already created a separate, more detailed, log. 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, _explosionQueue.Enqueue(() => SpawnExplosion(epicenter, type, totalIntensity,
slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum)); slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum));

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Explosion.EntitySystems
public sealed partial class TriggerSystem public sealed partial class TriggerSystem
{ {
[Dependency] private readonly SignalLinkerSystem _signalSystem = default!; [Dependency] private readonly SignalLinkerSystem _signalSystem = default!;
private void InitializeSignal() private void InitializeSignal()
{ {
SubscribeLocalEvent<TriggerOnSignalComponent,SignalReceivedEvent>(OnSignalReceived); SubscribeLocalEvent<TriggerOnSignalComponent,SignalReceivedEvent>(OnSignalReceived);
@@ -19,7 +19,7 @@ namespace Content.Server.Explosion.EntitySystems
if (args.Port != component.Port) if (args.Port != component.Port)
return; return;
Trigger(uid); Trigger(uid, args.Trigger);
} }
private void OnInit(EntityUid uid, TriggerOnSignalComponent component, ComponentInit args) private void OnInit(EntityUid uid, TriggerOnSignalComponent component, ComponentInit args)
{ {

View File

@@ -41,7 +41,7 @@ namespace Content.Server.Explosion.EntitySystems
{ {
_adminLogger.Add(LogType.Trigger, LogImpact.High, _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}."); $"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);
} }
} }

View File

@@ -59,10 +59,12 @@ namespace Content.Server.Kitchen.Components
public sealed class BeingMicrowavedEvent : HandledEntityEventArgs public sealed class BeingMicrowavedEvent : HandledEntityEventArgs
{ {
public EntityUid Microwave; public EntityUid Microwave;
public EntityUid? User;
public BeingMicrowavedEvent(EntityUid microwave) public BeingMicrowavedEvent(EntityUid microwave, EntityUid? user)
{ {
Microwave = microwave; Microwave = microwave;
User = user;
} }
} }
} }

View File

@@ -56,7 +56,7 @@ namespace Content.Server.Kitchen.EntitySystems
SubscribeLocalEvent<MicrowaveComponent, RefreshPartsEvent>(OnRefreshParts); SubscribeLocalEvent<MicrowaveComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<MicrowaveComponent, UpgradeExamineEvent>(OnUpgradeExamine); 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, MicrowaveEjectMessage>(OnEjectMessage);
SubscribeLocalEvent<MicrowaveComponent, MicrowaveEjectSolidIndexedMessage>(OnEjectIndex); SubscribeLocalEvent<MicrowaveComponent, MicrowaveEjectSolidIndexedMessage>(OnEjectIndex);
SubscribeLocalEvent<MicrowaveComponent, MicrowaveSelectCookTimeMessage>(OnSelectTime); SubscribeLocalEvent<MicrowaveComponent, MicrowaveSelectCookTimeMessage>(OnSelectTime);
@@ -215,7 +215,7 @@ namespace Content.Server.Kitchen.EntitySystems
_audio.PlayPvs(component.ClickSound, uid, AudioParams.Default.WithVolume(-2)); _audio.PlayPvs(component.ClickSound, uid, AudioParams.Default.WithVolume(-2));
component.CurrentCookTimerTime = 10; component.CurrentCookTimerTime = 10;
Wzhzhzh(uid, component); Wzhzhzh(uid, component, args.Victim);
UpdateUserInterfaceState(uid, component); UpdateUserInterfaceState(uid, component);
} }
@@ -314,7 +314,7 @@ namespace Content.Server.Kitchen.EntitySystems
/// It does not make a "wzhzhzh" sound, it makes a "mmmmmmmm" sound! /// It does not make a "wzhzhzh" sound, it makes a "mmmmmmmm" sound!
/// -emo /// -emo
/// </remarks> /// </remarks>
public void Wzhzhzh(EntityUid uid, MicrowaveComponent component) public void Wzhzhzh(EntityUid uid, MicrowaveComponent component, EntityUid? user)
{ {
if (!HasContents(component) || HasComp<ActiveMicrowaveComponent>(uid)) if (!HasContents(component) || HasComp<ActiveMicrowaveComponent>(uid))
return; return;
@@ -324,7 +324,7 @@ namespace Content.Server.Kitchen.EntitySystems
foreach (var item in component.Storage.ContainedEntities) foreach (var item in component.Storage.ContainedEntities)
{ {
// special behavior when being microwaved ;) // special behavior when being microwaved ;)
var ev = new BeingMicrowavedEvent(uid); var ev = new BeingMicrowavedEvent(uid, user);
RaiseLocalEvent(item, ev); RaiseLocalEvent(item, ev);
if (ev.Handled) if (ev.Handled)

View File

@@ -3,10 +3,12 @@ namespace Content.Server.MachineLinking.Events
public sealed class SignalReceivedEvent : EntityEventArgs public sealed class SignalReceivedEvent : EntityEventArgs
{ {
public readonly string Port; public readonly string Port;
public readonly EntityUid? Trigger;
public SignalReceivedEvent(string port) public SignalReceivedEvent(string port, EntityUid? trigger)
{ {
Port = port; Port = port;
Trigger = trigger;
} }
} }
} }

View File

@@ -140,7 +140,7 @@ namespace Content.Server.MachineLinking.System
return; return;
foreach (var receiver in receivers) 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) private void OnTransmitterStartup(EntityUid uid, SignalTransmitterComponent transmitter, ComponentStartup args)

View File

@@ -56,14 +56,14 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
args.Handled = true; args.Handled = true;
// What the fuck are you doing??? // What the fuck are you doing???
Explode(uid, component); Explode(uid, component, args.User);
} }
private void OnChargeChanged(EntityUid uid, PowerCellComponent component, ChargeChangedEvent args) private void OnChargeChanged(EntityUid uid, PowerCellComponent component, ChargeChangedEvent args)
{ {
if (component.IsRigged) if (component.IsRigged)
{ {
Explode(uid); Explode(uid, cause: null);
return; 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)) if (!Resolve(uid, ref battery))
return; 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); QueueDel(uid);
} }

View File

@@ -8,6 +8,8 @@
- type: PowerCell - type: PowerCell
- type: Explosive - type: Explosive
explosionType: Default explosionType: Default
maxIntensity: 200
intensitySlope: 1.5
- type: Sprite - type: Sprite
sprite: Objects/Power/power_cells.rsi sprite: Objects/Power/power_cells.rsi
netsync: false netsync: false