Add airlock painting logs (#13301)
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.DoAfter;
|
using Content.Server.DoAfter;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.AirlockPainter;
|
using Content.Shared.AirlockPainter;
|
||||||
using Content.Shared.AirlockPainter.Prototypes;
|
using Content.Shared.AirlockPainter.Prototypes;
|
||||||
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Doors.Components;
|
using Content.Shared.Doors.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
@@ -18,6 +20,7 @@ namespace Content.Server.AirlockPainter
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class AirlockPainterSystem : SharedAirlockPainterSystem
|
public sealed class AirlockPainterSystem : SharedAirlockPainterSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
|
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
|
||||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
@@ -39,8 +42,11 @@ namespace Content.Server.AirlockPainter
|
|||||||
if (TryComp<AppearanceComponent>(ev.Target, out var appearance) &&
|
if (TryComp<AppearanceComponent>(ev.Target, out var appearance) &&
|
||||||
TryComp<PaintableAirlockComponent>(ev.Target, out PaintableAirlockComponent? airlock))
|
TryComp<PaintableAirlockComponent>(ev.Target, out PaintableAirlockComponent? airlock))
|
||||||
{
|
{
|
||||||
SoundSystem.Play(ev.Component.SpraySound.GetSound(), Filter.Pvs(ev.User, entityManager:EntityManager), ev.User);
|
SoundSystem.Play(ev.Component.SpraySound.GetSound(), Filter.Pvs(ev.UsedTool, entityManager:EntityManager), ev.UsedTool);
|
||||||
appearance.SetData(DoorVisuals.BaseRSI, ev.Sprite);
|
appearance.SetData(DoorVisuals.BaseRSI, ev.Sprite);
|
||||||
|
|
||||||
|
// Log success
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(ev.User):user} painted {ToPrettyString(ev.Target):target}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,22 +93,28 @@ namespace Content.Server.AirlockPainter
|
|||||||
BreakOnDamage = true,
|
BreakOnDamage = true,
|
||||||
BreakOnStun = true,
|
BreakOnStun = true,
|
||||||
NeedHand = true,
|
NeedHand = true,
|
||||||
BroadcastFinishedEvent = new AirlockPainterDoAfterComplete(uid, target, sprite, component),
|
BroadcastFinishedEvent = new AirlockPainterDoAfterComplete(uid, target, sprite, component, args.User),
|
||||||
BroadcastCancelledEvent = new AirlockPainterDoAfterCancelled(component),
|
BroadcastCancelledEvent = new AirlockPainterDoAfterCancelled(component),
|
||||||
};
|
};
|
||||||
_doAfterSystem.DoAfter(doAfterEventArgs);
|
_doAfterSystem.DoAfter(doAfterEventArgs);
|
||||||
|
|
||||||
|
// Log attempt
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(args.User):user} is painting {ToPrettyString(uid):target} to '{style}' at {Transform(uid).Coordinates:targetlocation}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class AirlockPainterDoAfterComplete : EntityEventArgs
|
private sealed class AirlockPainterDoAfterComplete : EntityEventArgs
|
||||||
{
|
{
|
||||||
public readonly EntityUid User;
|
public readonly EntityUid User;
|
||||||
|
public readonly EntityUid UsedTool;
|
||||||
public readonly EntityUid Target;
|
public readonly EntityUid Target;
|
||||||
public readonly string Sprite;
|
public readonly string Sprite;
|
||||||
public readonly AirlockPainterComponent Component;
|
public readonly AirlockPainterComponent Component;
|
||||||
|
|
||||||
public AirlockPainterDoAfterComplete(EntityUid user, EntityUid target, string sprite, AirlockPainterComponent component)
|
public AirlockPainterDoAfterComplete(EntityUid usedTool, EntityUid target, string sprite,
|
||||||
|
AirlockPainterComponent component, EntityUid user)
|
||||||
{
|
{
|
||||||
User = user;
|
User = user;
|
||||||
|
UsedTool = usedTool;
|
||||||
Target = target;
|
Target = target;
|
||||||
Sprite = sprite;
|
Sprite = sprite;
|
||||||
Component = component;
|
Component = component;
|
||||||
|
|||||||
Reference in New Issue
Block a user