Reaction & reagent effect logging (#5463)
* Reaction logging * effect logging * position
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Chemistry.Components.SolutionManager;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
@@ -20,6 +21,7 @@ namespace Content.Server.Body.Systems
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -158,6 +160,9 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
@@ -14,6 +15,10 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
{
|
||||
base.OnReaction(solution, reaction, randomReagent, ownerUid, unitReactions);
|
||||
|
||||
var entity = EntityManager.GetEntity(ownerUid);
|
||||
_logSystem.Add(LogType.ChemicalReaction, reaction.Impact,
|
||||
$"Chemical reaction {reaction.ID} occurred with strength {unitReactions:strength} on entity {entity} at {entity.Transform.Coordinates}");
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(ownerUid, entityManager:EntityManager), reaction.Sound.GetSound(), ownerUid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
namespace Content.Shared.Administration.Logs;
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Administration.Logs;
|
||||
|
||||
// DO NOT CHANGE THE NUMERIC VALUES OF THESE
|
||||
[Serializable, NetSerializable]
|
||||
public enum LogImpact : sbyte
|
||||
{
|
||||
Low = -1,
|
||||
|
||||
@@ -14,4 +14,6 @@ public enum LogType
|
||||
EventStopped = 7,
|
||||
ShuttleCalled = 8,
|
||||
ShuttleRecalled = 9,
|
||||
ChemicalReaction = 17,
|
||||
ReagentEffect = 18,
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: PotassiumExplosion
|
||||
impact: High
|
||||
reactants:
|
||||
Water:
|
||||
amount: 1
|
||||
@@ -73,6 +74,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: Smoke
|
||||
impact: High
|
||||
reactants:
|
||||
Phosphorus:
|
||||
amount: 1
|
||||
@@ -95,6 +97,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: Foam
|
||||
impact: High
|
||||
reactants:
|
||||
Fluorosurfactant:
|
||||
amount: 1
|
||||
@@ -118,6 +121,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: IronMetalFoam
|
||||
impact: High
|
||||
reactants:
|
||||
Iron:
|
||||
amount: 3
|
||||
@@ -143,6 +147,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: AluminiumMetalFoam
|
||||
impact: High
|
||||
reactants:
|
||||
Aluminium:
|
||||
amount: 3
|
||||
@@ -178,6 +183,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: Thermite
|
||||
impact: Medium
|
||||
reactants:
|
||||
Iron:
|
||||
amount: 1
|
||||
@@ -224,6 +230,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: Fluorosurfactant
|
||||
impact: Medium
|
||||
reactants:
|
||||
Carbon:
|
||||
amount: 2
|
||||
@@ -236,6 +243,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: Desoxyephedrine
|
||||
impact: Medium
|
||||
reactants:
|
||||
Ephedrine:
|
||||
amount: 1
|
||||
@@ -250,6 +258,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: Ephedrine
|
||||
impact: Medium
|
||||
reactants:
|
||||
Oil:
|
||||
amount: 1
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: SpaceLube
|
||||
impact: Medium
|
||||
reactants:
|
||||
Water:
|
||||
amount: 1
|
||||
|
||||
@@ -370,6 +370,7 @@
|
||||
|
||||
- type: reaction
|
||||
id: Lexorin
|
||||
impact: High
|
||||
reactants:
|
||||
Ammonia:
|
||||
amount: 1
|
||||
|
||||
Reference in New Issue
Block a user