Add welder toggle logs (#13303)

This commit is contained in:
Chief-Engineer
2023-01-20 10:05:05 -06:00
committed by GitHub
parent c925505ca1
commit d6228d7a4c
3 changed files with 22 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Tools.Components;
using Content.Shared.Database;
using Content.Shared.Examine;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
@@ -108,6 +109,12 @@ namespace Content.Server.Tools
welder.Lit = true;
// Logging
if (user != null)
_adminLogger.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user.Value):user} toggled {ToPrettyString(uid):welder} on");
else
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(uid):welder} toggled on");
var ev = new WelderToggledEvent(true);
RaiseLocalEvent(welder.Owner, ev, false);
@@ -145,6 +152,12 @@ namespace Content.Server.Tools
welder.Lit = false;
// Logging
if (user != null)
_adminLogger.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user.Value):user} toggled {ToPrettyString(uid):welder} off");
else
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(uid):welder} toggled off");
var ev = new WelderToggledEvent(false);
RaiseLocalEvent(welder.Owner, ev, false);
@@ -207,6 +220,8 @@ namespace Content.Server.Tools
private void OnWelderActivate(EntityUid uid, WelderComponent welder, ActivateInWorldEvent args)
{
args.Handled = TryToggleWelder(uid, args.User, welder);
if (args.Handled)
args.WasLogged = true;
var hotEvent = new IsHotEvent() {IsHot = true};
RaiseLocalEvent(uid, hotEvent);
}

View File

@@ -18,6 +18,11 @@ public sealed class ActivateInWorldEvent : HandledEntityEventArgs, ITargetedInte
/// </summary>
public EntityUid Target { get; }
/// <summary>
/// Set to true when the activation is logged by a specific logger.
/// </summary>
public bool WasLogged { get; set; }
public ActivateInWorldEvent(EntityUid user, EntityUid target)
{
User = user;

View File

@@ -870,6 +870,7 @@ namespace Content.Shared.Interaction
DoContactInteraction(user, used, activateMsg);
_useDelay.BeginDelay(used, delayComponent);
if (!activateMsg.WasLogged)
_adminLogger.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}");
return true;
}