Adds like 17 new logs (#5499)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
Moony
2021-11-24 16:52:31 -06:00
committed by GitHub
parent 078f3a7738
commit c576eb91d3
10 changed files with 116 additions and 5 deletions

View File

@@ -20,4 +20,22 @@ public enum LogType
ReagentEffect = 18,
CanisterValve = 20,
CanisterPressure = 21,
CanisterPurged = 22,
CanisterTankEjected = 23,
CanisterTankInserted = 24,
DisarmedAction = 25,
DisarmedKnockdown = 26,
AttackArmedClick = 27,
AttackArmedWide = 28,
AttackUnarmedClick = 29,
AttackUnarmedWide = 30,
InteractHand = 31,
InteractActivate = 32,
Throw = 33,
Landed = 34,
ThrowHit = 35,
Pickup = 36,
Drop = 37,
BulletHit = 38,
CrayonDraw = 39,
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Shared.ActionBlocker;
using Content.Shared.Administration.Logs;
using Content.Shared.Interaction;
using Content.Shared.Item;
using Robust.Shared.Containers;
@@ -668,6 +669,7 @@ namespace Content.Shared.Hands.Components
HandlePickupAnimation(entity);
PutEntityIntoHand(hand, entity);
EntitySystem.Get<SharedAdminLogSystem>().Add(LogType.Pickup, LogImpact.Low, $"{Owner} picked up {entity}");
return true;
}

View File

@@ -2,6 +2,7 @@ using System;
using System.Linq;
using System.Threading.Tasks;
using Content.Shared.ActionBlocker;
using Content.Shared.Administration.Logs;
using Content.Shared.Hands;
using Content.Shared.Hands.Components;
using Content.Shared.Inventory;
@@ -34,6 +35,7 @@ namespace Content.Shared.Interaction
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly SharedVerbSystem _verbSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _adminLogSystem = default!;
public const float InteractionRange = 2;
public const float InteractionRangeSquared = InteractionRange * InteractionRange;
@@ -454,13 +456,17 @@ namespace Content.Shared.Interaction
var activateMsg = new ActivateInWorldEvent(user, used);
RaiseLocalEvent(used.Uid, activateMsg);
if (activateMsg.Handled)
{
_adminLogSystem.Add(LogType.InteractActivate, LogImpact.Low, $"{user} activated {used}");
return;
}
if (!used.TryGetComponent(out IActivate? activateComp))
return;
var activateEventArgs = new ActivateEventArgs(user, used);
activateComp.Activate(activateEventArgs);
_adminLogSystem.Add(LogType.InteractActivate, LogImpact.Low, $"{user} activated {used}"); // No way to check success.
}
#endregion
@@ -558,7 +564,10 @@ namespace Content.Shared.Interaction
var throwMsg = new ThrownEvent(user, thrown);
RaiseLocalEvent(thrown.Uid, throwMsg);
if (throwMsg.Handled)
{
_adminLogSystem.Add(LogType.Throw, LogImpact.Low,$"{user} threw {thrown}");
return;
}
var comps = thrown.GetAllComponents<IThrown>().ToList();
var args = new ThrownEventArgs(user);
@@ -568,6 +577,7 @@ namespace Content.Shared.Interaction
{
comp.Thrown(args);
}
_adminLogSystem.Add(LogType.Throw, LogImpact.Low,$"{user} threw {thrown}");
}
#endregion
@@ -675,7 +685,10 @@ namespace Content.Shared.Interaction
var dropMsg = new DroppedEvent(user.Uid, item.Uid);
RaiseLocalEvent(item.Uid, dropMsg);
if (dropMsg.Handled)
{
_adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{user} dropped {item}");
return;
}
item.Transform.LocalRotation = Angle.Zero;
@@ -686,6 +699,7 @@ namespace Content.Shared.Interaction
{
comp.Dropped(new DroppedEventArgs(user));
}
_adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{user} dropped {item}");
}
#endregion

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Content.Shared.Administration.Logs;
using Content.Shared.CCVar;
using Content.Shared.Hands.Components;
using Content.Shared.Physics;
@@ -23,6 +24,7 @@ namespace Content.Shared.Throwing
{
[Dependency] private readonly SharedBroadphaseSystem _broadphaseSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _adminLogSystem = default!;
private const string ThrowingFixture = "throw-fixture";
@@ -128,6 +130,11 @@ namespace Content.Shared.Throwing
var landMsg = new LandEvent {User = thrownItem.Thrower?.Uid};
RaiseLocalEvent(landing.Uid, landMsg, false);
// Assume it's uninteresting if it has no thrower. For now anyway.
if (thrownItem.Thrower is not null)
_adminLogSystem.Add(LogType.Landed, LogImpact.Low, $"{landing} thrown by {thrownItem.Thrower:thrower} landed.");
}
/// <summary>
@@ -138,6 +145,8 @@ namespace Content.Shared.Throwing
// TODO: Just pass in the bodies directly
RaiseLocalEvent(target.Owner.Uid, new ThrowHitByEvent(user, thrown.Owner, target.Owner));
RaiseLocalEvent(thrown.Owner.Uid, new ThrowDoHitEvent(user, thrown.Owner, target.Owner));
if (user is not null)
_adminLogSystem.Add(LogType.ThrowHit, LogImpact.Low, $"{thrown.Owner:thrown} thrown by {user:thrower} hit {target.Owner:target}.");
}
}
}