Add admin alerts for explosions (#15786)
This commit is contained in:
@@ -118,7 +118,8 @@ namespace Content.Server.Chat.Managers
|
|||||||
|
|
||||||
public void SendAdminAlert(EntityUid player, string message, MindComponent? mindComponent = null)
|
public void SendAdminAlert(EntityUid player, string message, MindComponent? mindComponent = null)
|
||||||
{
|
{
|
||||||
if(mindComponent == null && !_entityManager.TryGetComponent(player, out mindComponent))
|
if((mindComponent == null && !_entityManager.TryGetComponent(player, out mindComponent))
|
||||||
|
|| mindComponent.Mind == null)
|
||||||
{
|
{
|
||||||
SendAdminAlert(message);
|
SendAdminAlert(message);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.Explosion.Components;
|
using Content.Server.Explosion.Components;
|
||||||
using Content.Server.NodeContainer.EntitySystems;
|
using Content.Server.NodeContainer.EntitySystems;
|
||||||
using Content.Server.NPC.Pathfinding;
|
using Content.Server.NPC.Pathfinding;
|
||||||
using Content.Shared.Camera;
|
using Content.Shared.Camera;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Explosion;
|
using Content.Shared.Explosion;
|
||||||
@@ -38,6 +40,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
[Dependency] private readonly PathfindingSystem _pathfindingSystem = default!;
|
[Dependency] private readonly PathfindingSystem _pathfindingSystem = default!;
|
||||||
[Dependency] private readonly SharedCameraRecoilSystem _recoilSystem = default!;
|
[Dependency] private readonly SharedCameraRecoilSystem _recoilSystem = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
[Dependency] private readonly IChatManager _chat = default!;
|
||||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||||
[Dependency] private readonly PVSOverrideSystem _pvsSys = default!;
|
[Dependency] private readonly PVSOverrideSystem _pvsSys = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
@@ -227,11 +230,18 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
|
{
|
||||||
_adminLogger.Add(LogType.Explosion, LogImpact.High,
|
_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 {pos.Coordinates:coordinates} with intensity {totalIntensity} slope {slope}");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_adminLogger.Add(LogType.Explosion, LogImpact.High,
|
_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 {pos.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}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -604,6 +604,12 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<bool> AdminAnnounceLogout =
|
public static readonly CVarDef<bool> AdminAnnounceLogout =
|
||||||
CVarDef.Create("admin.announce_logout", true, CVar.SERVERONLY);
|
CVarDef.Create("admin.announce_logout", true, CVar.SERVERONLY);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Minimum explosion intensity to create an admin alert message. -1 to disable the alert.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<int> AdminAlertExplosionMinIntensity =
|
||||||
|
CVarDef.Create("admin.alert.explosion_min_intensity", 60, CVar.SERVERONLY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Explosions
|
* Explosions
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user