diff --git a/Content.Server/Body/Systems/MetabolizerSystem.cs b/Content.Server/Body/Systems/MetabolizerSystem.cs index a1e2b3717b..17059a8a27 100644 --- a/Content.Server/Body/Systems/MetabolizerSystem.cs +++ b/Content.Server/Body/Systems/MetabolizerSystem.cs @@ -160,10 +160,13 @@ namespace Content.Server.Body.Systems if (!effect.ShouldApply(args, _random)) continue; - var entity = EntityManager.GetEntity(args.SolutionEntity); - _logSystem.Add(LogType.ReagentEffect, LogImpact.Low, - $"Metabolism effect {effect.GetType().Name} of reagent {args.Reagent.Name:reagent} applied on entity {entity} at {entity.Transform.Coordinates}"); - effect.Effect(args); + if (effect.ShouldLog) + { + var entity = EntityManager.GetEntity(args.SolutionEntity); + _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, + $"Metabolism effect {effect.GetType().Name} of reagent {args.Reagent.Name:reagent} applied on entity {entity} at {entity.Transform.Coordinates}"); + effect.Effect(args); + } } } diff --git a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs index 53df3f2e49..d3a6eb9df5 100644 --- a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs @@ -2,6 +2,7 @@ using Content.Server.Chemistry.Components; using Content.Server.Chemistry.EntitySystems; using Content.Server.Coordinates.Helpers; +using Content.Shared.Administration.Logs; using Content.Shared.Audio; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reaction; @@ -78,6 +79,9 @@ namespace Content.Server.Chemistry.ReactionEffects /// [DataField("sound", required: true)] private SoundSpecifier _sound = default!; + public override bool ShouldLog => true; + public override LogImpact LogImpact => LogImpact.High; + void ISerializationHooks.AfterDeserialization() { IoCManager.InjectDependencies(this); diff --git a/Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs index a63397fec4..6b4931be1b 100644 --- a/Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs @@ -1,6 +1,7 @@ using System; using Content.Server.Chemistry.Components.SolutionManager; using Content.Server.Explosion.EntitySystems; +using Content.Shared.Administration.Logs; using Content.Shared.Chemistry.Reagent; using Robust.Shared.GameObjects; using Robust.Shared.Serialization.Manager.Attributes; @@ -26,6 +27,9 @@ namespace Content.Server.Chemistry.ReactionEffects /// [DataField("maxScale")] private float _maxScale = 1; + public override bool ShouldLog => true; + public override LogImpact LogImpact => LogImpact.High; + public override void Effect(ReagentEffectArgs args) { var floatIntensity = (float) args.Quantity; diff --git a/Content.Server/Chemistry/ReagentEffects/Electrocute.cs b/Content.Server/Chemistry/ReagentEffects/Electrocute.cs index 8b1389aedf..049b594cb5 100644 --- a/Content.Server/Chemistry/ReagentEffects/Electrocute.cs +++ b/Content.Server/Chemistry/ReagentEffects/Electrocute.cs @@ -15,6 +15,8 @@ public class Electrocute : ReagentEffect [DataField("electrocuteDamageScale")] public int ElectrocuteDamageScale = 5; + public override bool ShouldLog => true; + public override void Effect(ReagentEffectArgs args) { EntitySystem.Get().TryDoElectrocution(args.SolutionEntity, null, diff --git a/Content.Server/Chemistry/ReagentEffects/FlammableReaction.cs b/Content.Server/Chemistry/ReagentEffects/FlammableReaction.cs index f2544c2f1f..beb569016e 100644 --- a/Content.Server/Chemistry/ReagentEffects/FlammableReaction.cs +++ b/Content.Server/Chemistry/ReagentEffects/FlammableReaction.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Content.Server.Atmos.Components; using Content.Server.Atmos.EntitySystems; +using Content.Shared.Administration.Logs; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reagent; using Content.Shared.FixedPoint; @@ -14,6 +15,9 @@ namespace Content.Server.Chemistry.ReagentEffects [UsedImplicitly] public class FlammableReaction : ReagentEffect { + public override bool ShouldLog => true; + public override LogImpact LogImpact => LogImpact.Medium; + public override void Effect(ReagentEffectArgs args) { if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out FlammableComponent? flammable)) return; diff --git a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs index d2a58d30d8..8bf9a2d8c7 100644 --- a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs +++ b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs @@ -114,10 +114,13 @@ namespace Content.Shared.Chemistry.Reaction if (!effect.ShouldApply(args)) continue; - var entity = EntityManager.GetEntity(args.SolutionEntity); - _logSystem.Add(LogType.ReagentEffect, LogImpact.Low, - $"Reaction effect {effect.GetType().Name} of reaction ${reaction.ID:reaction} applied on entity {entity} at {entity.Transform.Coordinates}"); - effect.Effect(args); + if (effect.ShouldLog) + { + var entity = EntityManager.GetEntity(args.SolutionEntity); + _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, + $"Reaction effect {effect.GetType().Name} of reaction ${reaction.ID:reaction} applied on entity {entity} at {entity.Transform.Coordinates}"); + effect.Effect(args); + } } } diff --git a/Content.Shared/Chemistry/ReactiveSystem.cs b/Content.Shared/Chemistry/ReactiveSystem.cs index 6fd136d752..ae6a26addb 100644 --- a/Content.Shared/Chemistry/ReactiveSystem.cs +++ b/Content.Shared/Chemistry/ReactiveSystem.cs @@ -61,10 +61,13 @@ namespace Content.Shared.Chemistry if (!effect.ShouldApply(args, _robustRandom)) continue; - var entity = EntityManager.GetEntity(args.SolutionEntity); - _logSystem.Add(LogType.ReagentEffect, LogImpact.Medium, - $"Reactive effect {effect.GetType().Name} of reagent {reagent.ID:reagent} with method {method} applied on entity {entity} at {entity.Transform.Coordinates}"); - effect.Effect(args); + if (effect.ShouldLog) + { + var entity = EntityManager.GetEntity(args.SolutionEntity); + _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, + $"Reactive effect {effect.GetType().Name} of reagent {reagent.ID:reagent} with method {method} applied on entity {entity} at {entity.Transform.Coordinates}"); + effect.Effect(args); + } } } } @@ -85,10 +88,13 @@ namespace Content.Shared.Chemistry if (!effect.ShouldApply(args, _robustRandom)) continue; - var entity = EntityManager.GetEntity(args.SolutionEntity); - _logSystem.Add(LogType.ReagentEffect, LogImpact.Low, - $"Reactive effect {effect.GetType().Name} of {entity} using reagent {reagent.ID} with method {method} at {entity.Transform.Coordinates}"); - effect.Effect(args); + if (effect.ShouldLog) + { + var entity = EntityManager.GetEntity(args.SolutionEntity); + _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, + $"Reactive effect {effect.GetType().Name} of {entity} using reagent {reagent.ID} with method {method} at {entity.Transform.Coordinates}"); + effect.Effect(args); + } } } } diff --git a/Content.Shared/Chemistry/Reagent/ReagentEffect.cs b/Content.Shared/Chemistry/Reagent/ReagentEffect.cs index ba3f22450a..10886c3f27 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentEffect.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentEffect.cs @@ -31,6 +31,15 @@ namespace Content.Shared.Chemistry.Reagent [DataField("probability")] public float Probability = 1.0f; + [DataField("logImpact")] + public virtual LogImpact LogImpact { get; } = LogImpact.Low; + + /// + /// Should this reagent effect log at all? + /// + [DataField("shouldLog")] + public virtual bool ShouldLog { get; } = false; + public abstract void Effect(ReagentEffectArgs args); } diff --git a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs index bf400deb11..5ab4a69433 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs @@ -120,10 +120,13 @@ namespace Content.Shared.Chemistry.Reagent if (!plantMetabolizable.ShouldApply(args, random)) continue; - var entity = entMan.GetEntity(args.SolutionEntity); - EntitySystem.Get().Add(LogType.ReagentEffect, LogImpact.Low, - $"Plant metabolism effect {plantMetabolizable.GetType().Name:effect} of reagent {ID} applied on entity {entity} at {entity.Transform.Coordinates}"); - plantMetabolizable.Effect(args); + if (plantMetabolizable.ShouldLog) + { + var entity = entMan.GetEntity(args.SolutionEntity); + EntitySystem.Get().Add(LogType.ReagentEffect, plantMetabolizable.LogImpact, + $"Plant metabolism effect {plantMetabolizable.GetType().Name:effect} of reagent {ID} applied on entity {entity} at {entity.Transform.Coordinates}"); + plantMetabolizable.Effect(args); + } } } }