Log a lot less reagent effects (#5572)

This commit is contained in:
mirrorcult
2021-11-27 00:31:56 -07:00
committed by GitHub
parent bf30f82ff5
commit f697bf413c
9 changed files with 58 additions and 20 deletions

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}
}

View File

@@ -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;
/// <summary>
/// Should this reagent effect log at all?
/// </summary>
[DataField("shouldLog")]
public virtual bool ShouldLog { get; } = false;
public abstract void Effect(ReagentEffectArgs args);
}

View File

@@ -120,10 +120,13 @@ namespace Content.Shared.Chemistry.Reagent
if (!plantMetabolizable.ShouldApply(args, random))
continue;
var entity = entMan.GetEntity(args.SolutionEntity);
EntitySystem.Get<SharedAdminLogSystem>().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<SharedAdminLogSystem>().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);
}
}
}
}