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

@@ -22,7 +22,9 @@ using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
using System;
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Popups;
using Content.Shared.Administration.Logs;
using Content.Shared.Popups;
namespace Content.Server.Actions.Actions
@@ -94,6 +96,8 @@ namespace Content.Server.Actions.Actions
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(args.Target.Uid, eventArgs);
EntitySystem.Get<AdminLogSystem>().Add(LogType.DisarmedAction, LogImpact.Low, $"{args.Performer:performer} used disarm on {args.Target:target}");
// Check if the event has been handled, and if so, do nothing else!
if (eventArgs.Handled)
return;

View File

@@ -66,6 +66,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (environment is not null)
_atmosphereSystem.Merge(environment, canister.Air);
_adminLogSystem.Add(LogType.CanisterPurged, LogImpact.Medium, $"Canister {uid} purged its contents of {canister.Air} into the environment.");
canister.Air.Clear();
}
@@ -132,6 +133,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (container.ContainedEntities.Count == 0)
return;
_adminLogSystem.Add(LogType.CanisterTankEjected, LogImpact.Medium, $"Player {args.Session.AttachedEntity:player} ejected tank {container.ContainedEntities[0]:tank} from {uid}");
container.Remove(container.ContainedEntities[0]);
}
@@ -142,7 +144,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
var pressure = Math.Clamp(args.Pressure, canister.MinReleasePressure, canister.MaxReleasePressure);
_adminLogSystem.Add(LogType.CanisterPressure, LogImpact.Medium, $"{(args.Session as IPlayerSession):player} set the release pressure on {uid} to {args.Pressure:valveState}");
_adminLogSystem.Add(LogType.CanisterPressure, LogImpact.Medium, $"{args.Session.AttachedEntity:player} set the release pressure on {uid} to {args.Pressure}");
canister.ReleasePressure = pressure;
DirtyUI(uid, canister);
@@ -153,7 +155,12 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (!CheckInteract(args.Session))
return;
_adminLogSystem.Add(LogType.CanisterValve, LogImpact.High, $"{(args.Session as IPlayerSession):player} set the valve on {uid} to {args.Valve:valveState}");
var impact = LogImpact.High;
if (EntityManager.TryGetComponent(uid, out ContainerManagerComponent containerManager)
&& containerManager.TryGetContainer(canister.ContainerName, out var container))
impact = container.ContainedEntities.Count != 0 ? LogImpact.Medium : LogImpact.High;
_adminLogSystem.Add(LogType.CanisterValve, impact, $"{args.Session.AttachedEntity:player} set the valve on {uid} to {args.Valve:valveState}");
canister.ReleaseValve = args.Valve;
DirtyUI(uid, canister);
@@ -275,6 +282,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (!hands.Drop(args.Used, container))
return;
_adminLogSystem.Add(LogType.CanisterTankInserted, LogImpact.Medium, $"Player {args.User:player} inserted tank {container.ContainedEntities[0]} into {uid}");
args.Handled = true;
}

View File

@@ -1,6 +1,8 @@
using System.Linq;
using System.Threading.Tasks;
using Content.Server.Administration.Logs;
using Content.Server.UserInterface;
using Content.Shared.Administration.Logs;
using Content.Shared.Audio;
using Content.Shared.Crayon;
using Content.Shared.Interaction;
@@ -141,6 +143,7 @@ namespace Content.Server.Crayon
// Decrease "Ammo"
Charges--;
Dirty();
EntitySystem.Get<AdminLogSystem>().Add(LogType.CrayonDraw, $"{eventArgs.User:player} drew a {_color:color} {SelectedState}");
return true;
}

View File

@@ -2,11 +2,13 @@ using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
using Content.Server.Administration.Logs;
using Content.Server.CombatMode;
using Content.Server.Hands.Components;
using Content.Server.Items;
using Content.Server.Pulling;
using Content.Shared.ActionBlocker;
using Content.Shared.Administration.Logs;
using Content.Shared.DragDrop;
using Content.Shared.Input;
using Content.Shared.Interaction;
@@ -39,6 +41,7 @@ namespace Content.Server.Interaction
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly PullingSystem _pullSystem = default!;
[Dependency] private readonly RotateToFaceSystem _rotateToFaceSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
public override void Initialize()
{
@@ -376,6 +379,7 @@ namespace Content.Server.Interaction
// all interactions should only happen when in range / unobstructed, so no range check is needed
var message = new InteractHandEvent(user, target);
RaiseLocalEvent(target.Uid, message);
_adminLogSystem.Add(LogType.InteractHand, LogImpact.Low, $"{user} interacted with {target}");
if (message.Handled)
return;
@@ -469,7 +473,10 @@ namespace Content.Server.Interaction
RaiseLocalEvent(item.Uid, ev, false);
if (ev.Handled)
{
_adminLogSystem.Add(LogType.AttackArmedWide, LogImpact.Medium, $"{user} wide attacked with {item} at {coordinates}");
return;
}
}
else
{
@@ -477,7 +484,20 @@ namespace Content.Server.Interaction
RaiseLocalEvent(item.Uid, ev, false);
if (ev.Handled)
{
if (targetEnt != null)
{
_adminLogSystem.Add(LogType.AttackArmedClick, LogImpact.Medium,
$"{user} attacked {targetEnt} with {item} at {coordinates}");
}
else
{
_adminLogSystem.Add(LogType.AttackArmedClick, LogImpact.Medium,
$"{user} attacked with {item} at {coordinates}");
}
return;
}
}
}
else if (!wideAttack &&
@@ -493,9 +513,30 @@ namespace Content.Server.Interaction
// TODO: Make this saner?
// Attempt to do unarmed combat. We don't check for handled just because at this point it doesn't matter.
if (wideAttack)
RaiseLocalEvent(user.Uid, new WideAttackEvent(user, user, coordinates), false);
{
var ev = new WideAttackEvent(user, user, coordinates);
RaiseLocalEvent(user.Uid, ev, false);
if (ev.Handled)
_adminLogSystem.Add(LogType.AttackUnarmedWide, $"{user} wide attacked at {coordinates}");
}
else
RaiseLocalEvent(user.Uid, new ClickAttackEvent(user, user, coordinates, targetUid), false);
{
var ev = new ClickAttackEvent(user, user, coordinates, targetUid);
RaiseLocalEvent(user.Uid, ev, false);
if (ev.Handled)
{
if (targetEnt != null)
{
_adminLogSystem.Add(LogType.AttackUnarmedClick, LogImpact.Medium,
$"{user} attacked {targetEnt} at {coordinates}");
}
else
{
_adminLogSystem.Add(LogType.AttackUnarmedClick, LogImpact.Medium,
$"{user} attacked at {coordinates}");
}
}
}
}
}
}

View File

@@ -1,5 +1,7 @@
using Content.Server.Administration.Logs;
using Content.Server.Camera;
using Content.Server.Projectiles.Components;
using Content.Shared.Administration.Logs;
using Content.Shared.Body.Components;
using Content.Shared.Damage;
using JetBrains.Annotations;
@@ -15,6 +17,7 @@ namespace Content.Server.Projectiles
internal sealed class ProjectileSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
public override void Initialize()
{
@@ -50,8 +53,11 @@ namespace Content.Server.Projectiles
if (!otherEntity.Deleted)
{
_damageableSystem.TryChangeDamage(otherEntity.Uid, component.Damage);
var dmg = _damageableSystem.TryChangeDamage(otherEntity.Uid, component.Damage);
component.DamagedEntity = true;
if (dmg is not null && EntityManager.TryGetEntity(component.Shooter, out var shooter))
_adminLogSystem.Add(LogType.BulletHit, LogImpact.Low, $"Bullet shot by {shooter} hit {otherEntity}");
// "DamagedEntity" is misleading. Hit entity may be more accurate, as the damage may have been resisted
// by resistance sets.
}

View File

@@ -1,6 +1,8 @@
using System;
using Content.Server.Act;
using Content.Server.Administration.Logs;
using Content.Server.Popups;
using Content.Shared.Administration.Logs;
using Content.Shared.Audio;
using Content.Shared.Popups;
using Content.Shared.StatusEffect;
@@ -17,6 +19,7 @@ namespace Content.Server.Stunnable
public sealed class StunSystem : SharedStunSystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
public override void Initialize()
{
@@ -49,6 +52,8 @@ namespace Content.Server.Stunnable
}
}
_adminLogSystem.Add(LogType.DisarmedKnockdown, LogImpact.Medium, $"{args.Source:performer} knocked down {args.Target:target}");
args.Handled = true;
}
}