From c83b8c2cf866d5353977c8b4183d3aebaf61295a Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Wed, 15 Oct 2025 19:15:05 +1300 Subject: [PATCH] Undo effect logging changes (#40919) * Undo effect logging changes * remove ShouldLog --- .../Effects/Atmos/FlammableEntityEffect.cs | 5 ++-- .../Effects/Atmos/IgniteEntityEffect.cs | 4 +--- .../Solution/AreaReactionEntityEffect.cs | 4 +--- .../Transform/EmpEntityEffectSystem.cs | 4 +--- .../Transform/ExplosionEntityEffect.cs | 4 +--- .../SharedEntityEffectsSystem.cs | 23 +++++++------------ 6 files changed, 15 insertions(+), 29 deletions(-) diff --git a/Content.Shared/EntityEffects/Effects/Atmos/FlammableEntityEffect.cs b/Content.Shared/EntityEffects/Effects/Atmos/FlammableEntityEffect.cs index f08b609407..563201a40f 100644 --- a/Content.Shared/EntityEffects/Effects/Atmos/FlammableEntityEffect.cs +++ b/Content.Shared/EntityEffects/Effects/Atmos/FlammableEntityEffect.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Prototypes; +using Content.Shared.Database; +using Robust.Shared.Prototypes; namespace Content.Shared.EntityEffects.Effects.Atmos; @@ -24,5 +25,5 @@ public sealed partial class Flammable : EntityEffectBase public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("entity-effect-guidebook-flammable-reaction", ("chance", Probability)); - public override bool ShouldLog => true; + public override LogImpact? Impact => LogImpact.Low; } diff --git a/Content.Shared/EntityEffects/Effects/Atmos/IgniteEntityEffect.cs b/Content.Shared/EntityEffects/Effects/Atmos/IgniteEntityEffect.cs index e10aaf3cd1..7ca93e7c18 100644 --- a/Content.Shared/EntityEffects/Effects/Atmos/IgniteEntityEffect.cs +++ b/Content.Shared/EntityEffects/Effects/Atmos/IgniteEntityEffect.cs @@ -12,7 +12,5 @@ public sealed partial class Ignite : EntityEffectBase public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("entity-effect-guidebook-ignite", ("chance", Probability)); - public override bool ShouldLog => true; - - public override LogImpact LogImpact => LogImpact.Medium; + public override LogImpact? Impact => LogImpact.Medium; } diff --git a/Content.Shared/EntityEffects/Effects/Solution/AreaReactionEntityEffect.cs b/Content.Shared/EntityEffects/Effects/Solution/AreaReactionEntityEffect.cs index 5fbe948360..13175cfed1 100644 --- a/Content.Shared/EntityEffects/Effects/Solution/AreaReactionEntityEffect.cs +++ b/Content.Shared/EntityEffects/Effects/Solution/AreaReactionEntityEffect.cs @@ -33,7 +33,5 @@ public sealed partial class AreaReactionEffect : EntityEffectBase true; - - public override LogImpact LogImpact => LogImpact.High; + public override LogImpact? Impact => LogImpact.High; } diff --git a/Content.Shared/EntityEffects/Effects/Transform/EmpEntityEffectSystem.cs b/Content.Shared/EntityEffects/Effects/Transform/EmpEntityEffectSystem.cs index c4768dcd11..2cbb6d6dad 100644 --- a/Content.Shared/EntityEffects/Effects/Transform/EmpEntityEffectSystem.cs +++ b/Content.Shared/EntityEffects/Effects/Transform/EmpEntityEffectSystem.cs @@ -52,7 +52,5 @@ public sealed partial class Emp : EntityEffectBase public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("entity-effect-guidebook-emp-reaction-effect", ("chance", Probability)); - public override bool ShouldLog => true; - - public override LogImpact LogImpact => LogImpact.Medium; + public override LogImpact? Impact => LogImpact.Medium; } diff --git a/Content.Shared/EntityEffects/Effects/Transform/ExplosionEntityEffect.cs b/Content.Shared/EntityEffects/Effects/Transform/ExplosionEntityEffect.cs index 762ef24141..95fd98294c 100644 --- a/Content.Shared/EntityEffects/Effects/Transform/ExplosionEntityEffect.cs +++ b/Content.Shared/EntityEffects/Effects/Transform/ExplosionEntityEffect.cs @@ -52,7 +52,5 @@ public sealed partial class ExplosionEffect : EntityEffectBase public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("entity-effect-guidebook-explosion-reaction-effect", ("chance", Probability)); - public override bool ShouldLog => true; - - public override LogImpact LogImpact => LogImpact.High; + public override LogImpact? Impact => LogImpact.High; } diff --git a/Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs b/Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs index 6245fc0827..1122f75f93 100644 --- a/Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs +++ b/Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs @@ -1,10 +1,9 @@ -using System.Linq; +using System.Diagnostics.CodeAnalysis; using Content.Shared.Administration.Logs; using Content.Shared.Chemistry; using Content.Shared.Chemistry.Reaction; using Content.Shared.Database; using Content.Shared.EntityConditions; -using Content.Shared.Localizations; using Content.Shared.Random.Helpers; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -119,11 +118,11 @@ public sealed partial class SharedEntityEffectsSystem : EntitySystem, IEntityEff if (!effect.Scaling) scale = Math.Min(scale, 1f); - if (effect.ShouldLog) + if (effect.Impact is {} level) { _adminLog.Add( - LogType.EntityEffect, - effect.LogImpact, + effect.LogType, + level, $"Entity effect {effect.GetType().Name:effect}" + $" applied on entity {target:entity}" + $" at {Transform(target).Coordinates:coordinates}" @@ -213,22 +212,16 @@ public abstract partial class EntityEffect [DataField] public float Probability = 1.0f; - /// - /// The description of this entity effect that shows in guidebooks. - /// public virtual string? EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => null; - /// - /// Whether this effect should be logged in admin logs. - /// - [ViewVariables] - public virtual bool ShouldLog => true; - /// /// If this effect is logged, how important is the log? /// [ViewVariables] - public virtual LogImpact LogImpact => LogImpact.Low; + public virtual LogImpact? Impact => null; + + [ViewVariables] + public virtual LogType LogType => LogType.EntityEffect; } ///