Update ChemicalReaction and ReagentEffect logs. (#23649)

* Update ChemicalReaction and ReagentEffect logs.

* Updated explosion log as well, and small cleanup.
This commit is contained in:
Trevor Day
2024-01-07 11:23:18 -08:00
committed by GitHub
parent c6e829ca6e
commit aa7fcb19ec
2 changed files with 11 additions and 8 deletions

View File

@@ -14,12 +14,10 @@ using Content.Shared.Database;
using Content.Shared.Explosion;
using Content.Shared.GameTicking;
using Content.Shared.Inventory;
using Content.Shared.Mind;
using Content.Shared.Projectiles;
using Content.Shared.Throwing;
using Robust.Server.GameStates;
using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
@@ -252,7 +250,9 @@ public sealed partial class ExplosionSystem : EntitySystem
var pos = Transform(uid);
QueueExplosion(pos.MapPosition, typeId, totalIntensity, slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum, addLog: false);
var coordinates = _transformSystem.GetMapCoordinates(pos);
QueueExplosion(coordinates, typeId, totalIntensity, slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum, addLog: false);
if (!addLog)
return;
@@ -260,15 +260,15 @@ public sealed partial class ExplosionSystem : EntitySystem
if (user == null)
{
_adminLogger.Add(LogType.Explosion, LogImpact.High,
$"{ToPrettyString(uid):entity} exploded ({typeId}) at {pos.Coordinates:coordinates} with intensity {totalIntensity} slope {slope}");
$"{ToPrettyString(uid):entity} exploded ({typeId}) at {coordinates:coordinates} with intensity {totalIntensity} slope {slope}");
}
else
{
_adminLogger.Add(LogType.Explosion, LogImpact.High,
$"{ToPrettyString(user.Value):user} caused {ToPrettyString(uid):entity} to explode ({typeId}) at {pos.Coordinates:coordinates} with intensity {totalIntensity} slope {slope}");
$"{ToPrettyString(user.Value):user} caused {ToPrettyString(uid):entity} to explode ({typeId}) at {coordinates:coordinates} with intensity {totalIntensity} slope {slope}");
var alertMinExplosionIntensity = _cfg.GetCVar(CCVars.AdminAlertExplosionMinIntensity);
if (alertMinExplosionIntensity > -1 && totalIntensity >= alertMinExplosionIntensity)
_chat.SendAdminAlert(user.Value, $"caused {ToPrettyString(uid)} to explode ({typeId}:{totalIntensity}) at {pos.Coordinates:coordinates}");
_chat.SendAdminAlert(user.Value, $"caused {ToPrettyString(uid)} to explode ({typeId}:{totalIntensity}) at {coordinates:coordinates}");
}
}

View File

@@ -9,6 +9,7 @@ using Robust.Shared.Utility;
using System.Collections.Frozen;
using System.Linq;
namespace Content.Shared.Chemistry.Reaction
{
public sealed class ChemicalReactionSystem : EntitySystem
@@ -21,6 +22,7 @@ namespace Content.Shared.Chemistry.Reaction
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
/// <summary>
/// A cache of all reactions indexed by at most ONE of their required reactants.
@@ -199,7 +201,8 @@ namespace Content.Shared.Chemistry.Reaction
reagent,
unitReactions, EntityManager, null, 1f);
var coordinates = Transform(soln).Coordinates;
var coordinates = _transformSystem.GetMapCoordinates(soln);
_adminLogger.Add(LogType.ChemicalReaction, reaction.Impact,
$"Chemical reaction {reaction.ID:reaction} occurred with strength {unitReactions:strength} on entity {ToPrettyString(soln):metabolizer} at {coordinates}");
@@ -212,7 +215,7 @@ namespace Content.Shared.Chemistry.Reaction
{
var entity = args.SolutionEntity;
_adminLogger.Add(LogType.ReagentEffect, effect.LogImpact,
$"Reaction effect {effect.GetType().Name:effect} of reaction ${reaction.ID:reaction} applied on entity {ToPrettyString(entity):entity} at {Transform(entity).Coordinates:coordinates}");
$"Reaction effect {effect.GetType().Name:effect} of reaction {reaction.ID:reaction} applied on entity {ToPrettyString(entity):entity} at {coordinates}");
}
effect.Effect(args);