diff --git a/Content.Server/Body/Systems/MetabolizerSystem.cs b/Content.Server/Body/Systems/MetabolizerSystem.cs index b8530fdd2f..a1e2b3717b 100644 --- a/Content.Server/Body/Systems/MetabolizerSystem.cs +++ b/Content.Server/Body/Systems/MetabolizerSystem.cs @@ -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); } } diff --git a/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs b/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs index 36db8d549a..3a30a15d9c 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs @@ -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); } } diff --git a/Content.Shared/Administration/Logs/LogImpact.cs b/Content.Shared/Administration/Logs/LogImpact.cs index e6000013f4..9213225469 100644 --- a/Content.Shared/Administration/Logs/LogImpact.cs +++ b/Content.Shared/Administration/Logs/LogImpact.cs @@ -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, diff --git a/Content.Shared/Administration/Logs/LogType.cs b/Content.Shared/Administration/Logs/LogType.cs index 20485b37f2..052edeb2e3 100644 --- a/Content.Shared/Administration/Logs/LogType.cs +++ b/Content.Shared/Administration/Logs/LogType.cs @@ -14,4 +14,6 @@ public enum LogType EventStopped = 7, ShuttleCalled = 8, ShuttleRecalled = 9, + ChemicalReaction = 17, + ReagentEffect = 18, } diff --git a/Content.Shared/Chemistry/Reaction/ReactionPrototype.cs b/Content.Shared/Chemistry/Reaction/ReactionPrototype.cs index f163da7e83..6101aa351a 100644 --- a/Content.Shared/Chemistry/Reaction/ReactionPrototype.cs +++ b/Content.Shared/Chemistry/Reaction/ReactionPrototype.cs @@ -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 /// [DataField("effects", serverOnly: true)] public List Effects = new(); + /// + /// How dangerous is this effect? Stuff like bicaridine should be low, while things like methamphetamine + /// or potas/water should be high. + /// + [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"); } diff --git a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs index 970dad8b0f..ba43dd9983 100644 --- a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs +++ b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs @@ -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); } } diff --git a/Content.Shared/Chemistry/ReactiveSystem.cs b/Content.Shared/Chemistry/ReactiveSystem.cs index 8f65e4fae2..6fd136d752 100644 --- a/Content.Shared/Chemistry/ReactiveSystem.cs +++ b/Content.Shared/Chemistry/ReactiveSystem.cs @@ -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); } } diff --git a/Content.Shared/Chemistry/Reagent/ReagentEffect.cs b/Content.Shared/Chemistry/Reagent/ReagentEffect.cs index 087128f019..ba3f22450a 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentEffect.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentEffect.cs @@ -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; diff --git a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs index 88c4bdf21f..bf400deb11 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs @@ -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().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); } } diff --git a/Resources/Prototypes/Recipes/Reactions/chemicals.yml b/Resources/Prototypes/Recipes/Reactions/chemicals.yml index 5693ab5286..80d2e90230 100644 --- a/Resources/Prototypes/Recipes/Reactions/chemicals.yml +++ b/Resources/Prototypes/Recipes/Reactions/chemicals.yml @@ -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 diff --git a/Resources/Prototypes/Recipes/Reactions/cleaning.yml b/Resources/Prototypes/Recipes/Reactions/cleaning.yml index a49d10acaf..8ae72853be 100644 --- a/Resources/Prototypes/Recipes/Reactions/cleaning.yml +++ b/Resources/Prototypes/Recipes/Reactions/cleaning.yml @@ -22,6 +22,7 @@ - type: reaction id: SpaceLube + impact: Medium reactants: Water: amount: 1 diff --git a/Resources/Prototypes/Recipes/Reactions/medicine.yml b/Resources/Prototypes/Recipes/Reactions/medicine.yml index 3f5a736d65..7ba4721105 100644 --- a/Resources/Prototypes/Recipes/Reactions/medicine.yml +++ b/Resources/Prototypes/Recipes/Reactions/medicine.yml @@ -370,6 +370,7 @@ - type: reaction id: Lexorin + impact: High reactants: Ammonia: amount: 1