Reaction & reagent effect logging (#5463)
* Reaction logging * effect logging * position
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Sound;
|
||||
@@ -36,6 +37,12 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
/// </summary>
|
||||
[DataField("effects", serverOnly: true)] public List<ReagentEffect> Effects = new();
|
||||
|
||||
/// <summary>
|
||||
/// How dangerous is this effect? Stuff like bicaridine should be low, while things like methamphetamine
|
||||
/// or potas/water should be high.
|
||||
/// </summary>
|
||||
[DataField("impact", serverOnly: true)] public LogImpact Impact = LogImpact.Low;
|
||||
|
||||
// TODO SERV3: Empty on the client, (de)serialize on the server with module manager is server module
|
||||
[DataField("sound", serverOnly: true)] public SoundSpecifier Sound { get; private set; } = new SoundPathSpecifier("/Audio/Effects/Chemistry/bubbles.ogg");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
@@ -18,6 +19,7 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] protected readonly SharedAdminLogSystem _logSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -97,6 +99,9 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
@@ -15,6 +16,7 @@ namespace Content.Shared.Chemistry
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!;
|
||||
|
||||
public void ReactionEntity(EntityUid uid, ReactionMethod method, Solution solution)
|
||||
{
|
||||
@@ -59,6 +61,9 @@ 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);
|
||||
}
|
||||
}
|
||||
@@ -80,6 +85,9 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Body.Prototypes;
|
||||
using Content.Shared.Botany;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
@@ -119,6 +120,9 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user