Add multiple logs (#12857)

This commit is contained in:
Chief-Engineer
2022-12-15 12:33:27 -06:00
committed by GitHub
parent 343e695524
commit eb18363bd2
8 changed files with 92 additions and 4 deletions

View File

@@ -5,10 +5,12 @@ using Content.Server.MachineLinking.System;
using Content.Server.Popups;
using Content.Server.Station.Systems;
using Content.Shared.Access.Systems;
using Content.Shared.Administration.Logs;
using Content.Shared.Cargo;
using Content.Shared.Cargo.BUI;
using Content.Shared.Cargo.Events;
using Content.Shared.Cargo.Prototypes;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
@@ -35,6 +37,7 @@ namespace Content.Server.Cargo.Systems
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
private void InitializeConsole()
{
@@ -160,6 +163,10 @@ namespace Content.Server.Cargo.Systems
SoundSystem.Play(component.ConfirmSound.GetSound(), Filter.Pvs(uid, entityManager: EntityManager), uid);
// Log order approval
_adminLogger.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(player):user} approved order [orderNum:{order.OrderNumber}, amount:{order.Amount}, product:{order.ProductId}, requester:{order.Requester}, reason:{order.Reason}] with balance at {bankAccount.Balance}");
DeductFunds(bankAccount, cost);
UpdateOrders(orderDatabase);
}
@@ -173,6 +180,9 @@ namespace Content.Server.Cargo.Systems
private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleAddOrderMessage args)
{
if (args.Session.AttachedEntity is not {Valid: true} player)
return;
if (args.Amount <= 0)
return;
@@ -188,6 +198,11 @@ namespace Content.Server.Cargo.Systems
PlayDenySound(uid, component);
return;
}
// Log order addition
_adminLogger.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(player):user} added order [orderNum:{data.OrderNumber}, amount:{data.Amount}, product:{data.ProductId}, requester:{data.Requester}, reason:{data.Reason}]");
}
private void OnOrderUIOpened(EntityUid uid, CargoOrderConsoleComponent component, BoundUIOpenedEvent args)