From bfa39890110f205928e1251415a7e8a08726aad6 Mon Sep 17 00:00:00 2001 From: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com> Date: Fri, 4 Aug 2023 21:18:09 -0500 Subject: [PATCH] improve ignite logs (#18669) --- .../Systems/AdminVerbSystem.Smites.cs | 2 +- .../Effects/PyroclasticAnomalySystem.cs | 8 +++---- .../Atmos/EntitySystems/FlammableSystem.cs | 23 +++++++++++-------- .../Chemistry/ReagentEffects/Ignite.cs | 2 +- Content.Server/Tiles/LavaSystem.cs | 2 +- .../Effects/Systems/IgniteArtifactSystem.cs | 2 +- 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs index 31dd1d8434..42f6140040 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs @@ -150,7 +150,7 @@ public sealed partial class AdminVerbSystem { // Fuck you. Burn Forever. flammable.FireStacks = FlammableSystem.MaximumFireStacks; - _flammableSystem.Ignite(args.Target); + _flammableSystem.Ignite(args.Target, args.User); var xform = Transform(args.Target); _popupSystem.PopupEntity(Loc.GetString("admin-smite-set-alight-self"), args.Target, args.Target, PopupType.LargeCaution); diff --git a/Content.Server/Anomaly/Effects/PyroclasticAnomalySystem.cs b/Content.Server/Anomaly/Effects/PyroclasticAnomalySystem.cs index 3cb5ee3fae..7ee6f12d05 100644 --- a/Content.Server/Anomaly/Effects/PyroclasticAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/PyroclasticAnomalySystem.cs @@ -25,23 +25,23 @@ public sealed class PyroclasticAnomalySystem : EntitySystem { var xform = Transform(uid); var ignitionRadius = component.MaximumIgnitionRadius * args.Stability; - IgniteNearby(xform.Coordinates, args.Severity, ignitionRadius); + IgniteNearby(uid, xform.Coordinates, args.Severity, ignitionRadius); } private void OnSupercritical(EntityUid uid, PyroclasticAnomalyComponent component, ref AnomalySupercriticalEvent args) { var xform = Transform(uid); - IgniteNearby(xform.Coordinates, 1, component.MaximumIgnitionRadius * 2); + IgniteNearby(uid, xform.Coordinates, 1, component.MaximumIgnitionRadius * 2); } - public void IgniteNearby(EntityCoordinates coordinates, float severity, float radius) + public void IgniteNearby(EntityUid uid, EntityCoordinates coordinates, float severity, float radius) { foreach (var flammable in _lookup.GetComponentsInRange(coordinates, radius)) { var ent = flammable.Owner; var stackAmount = 1 + (int) (severity / 0.15f); _flammable.AdjustFireStacks(ent, stackAmount, flammable); - _flammable.Ignite(ent, flammable); + _flammable.Ignite(ent, uid, flammable); } } } diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index a57b66af80..47f283c075 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -74,7 +74,7 @@ namespace Content.Server.Atmos.EntitySystems continue; flammable.FireStacks += component.FireStacks; - Ignite(entity, flammable); + Ignite(entity, args.Weapon, flammable, args.User); } } @@ -94,7 +94,7 @@ namespace Content.Server.Atmos.EntitySystems return; flammable.FireStacks += component.FireStacks; - Ignite(otherEnt, flammable); + Ignite(otherEnt, uid, flammable); component.Count--; if (component.Count == 0) @@ -125,7 +125,7 @@ namespace Content.Server.Atmos.EntitySystems if (!isHotEvent.IsHot) return; - Ignite(uid, flammable); + Ignite(uid, args.Used, flammable, args.User); args.Handled = true; } @@ -156,14 +156,14 @@ namespace Content.Server.Atmos.EntitySystems { flammable.FireStacks /= 2; otherFlammable.FireStacks += flammable.FireStacks; - Ignite(otherUid, otherFlammable); + Ignite(otherUid, uid, otherFlammable); } } else if (otherFlammable.OnFire) { otherFlammable.FireStacks /= 2; flammable.FireStacks += otherFlammable.FireStacks; - Ignite(uid, flammable); + Ignite(uid, otherUid, flammable); } } @@ -227,14 +227,18 @@ namespace Content.Server.Atmos.EntitySystems UpdateAppearance(uid, flammable); } - public void Ignite(EntityUid uid, FlammableComponent? flammable = null) + public void Ignite(EntityUid uid, EntityUid ignitionSource, FlammableComponent? flammable = null, + EntityUid? ignitionSourceUser = null) { if (!Resolve(uid, ref flammable)) return; if (flammable.FireStacks > 0 && !flammable.OnFire) { - _adminLogger.Add(LogType.Flammable, $"{ToPrettyString(flammable.Owner):entity} is on fire"); + if (ignitionSourceUser != null) + _adminLogger.Add(LogType.Flammable, $"{ToPrettyString(uid):target} set on fire by {ToPrettyString(ignitionSourceUser.Value):actor} with {ToPrettyString(ignitionSource):tool}"); + else + _adminLogger.Add(LogType.Flammable, $"{ToPrettyString(uid):target} set on fire by {ToPrettyString(ignitionSource):actor}"); flammable.OnFire = true; } @@ -272,11 +276,12 @@ namespace Content.Server.Atmos.EntitySystems // 100 -> 1, 200 -> 2, 400 -> 3... var fireStackMod = Math.Max(MathF.Log2(deltaTemp / 100) + 1, 0); var fireStackDelta = fireStackMod - flammable.FireStacks; + var flammableEntity = flammable.Owner; if (fireStackDelta > 0) { - AdjustFireStacks(flammable.Owner, fireStackDelta, flammable); + AdjustFireStacks(flammableEntity, fireStackDelta, flammable); } - Ignite(flammable.Owner, flammable); + Ignite(flammableEntity, flammableEntity, flammable); } _fireEvents.Clear(); diff --git a/Content.Server/Chemistry/ReagentEffects/Ignite.cs b/Content.Server/Chemistry/ReagentEffects/Ignite.cs index c24183bbde..6f2a44ea2d 100644 --- a/Content.Server/Chemistry/ReagentEffects/Ignite.cs +++ b/Content.Server/Chemistry/ReagentEffects/Ignite.cs @@ -20,6 +20,6 @@ public sealed class Ignite : ReagentEffect public override void Effect(ReagentEffectArgs args) { var flamSys = EntitySystem.Get(); - flamSys.Ignite(args.SolutionEntity); + flamSys.Ignite(args.SolutionEntity, args.OrganEntity ?? args.SolutionEntity); } } diff --git a/Content.Server/Tiles/LavaSystem.cs b/Content.Server/Tiles/LavaSystem.cs index e484b62a39..bdba76784e 100644 --- a/Content.Server/Tiles/LavaSystem.cs +++ b/Content.Server/Tiles/LavaSystem.cs @@ -33,7 +33,7 @@ public sealed class LavaSystem : EntitySystem // Apply the fury of a thousand suns var multiplier = flammable.FireStacks == 0f ? 5f : 1f; _flammable.AdjustFireStacks(otherUid, component.FireStacks * multiplier, flammable); - _flammable.Ignite(otherUid, flammable); + _flammable.Ignite(otherUid, uid, flammable); } } } diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/IgniteArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/IgniteArtifactSystem.cs index 2d6827252d..0d6480a3ac 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/IgniteArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/IgniteArtifactSystem.cs @@ -27,7 +27,7 @@ public sealed class IgniteArtifactSystem : EntitySystem if (!flammable.TryGetComponent(target, out var fl)) continue; fl.FireStacks += _random.Next(component.MinFireStack, component.MaxFireStack); - _flammable.Ignite(target, fl); + _flammable.Ignite(target, uid, fl); } } }