FINALLY FIX APPROVER IN CARGO INVOICE!!! (#29690)

* OH DEAR LORD I WASTED 2 HOURS ON THIS STUPID SHIT!!!

* change some logic
This commit is contained in:
lzk
2024-07-29 08:19:43 +02:00
committed by GitHub
parent 46c8cecbbc
commit da5918c951
3 changed files with 9 additions and 9 deletions

View File

@@ -177,6 +177,10 @@ namespace Content.Server.Cargo.Systems
RaiseLocalEvent(ref ev); RaiseLocalEvent(ref ev);
ev.FulfillmentEntity ??= station.Value; ev.FulfillmentEntity ??= station.Value;
_idCardSystem.TryFindIdCard(player, out var idCard);
// ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
order.SetApproverData(idCard.Comp?.FullName, idCard.Comp?.JobTitle);
if (!ev.Handled) if (!ev.Handled)
{ {
ev.FulfillmentEntity = TryFulfillOrder((station.Value, stationData), order, orderDatabase); ev.FulfillmentEntity = TryFulfillOrder((station.Value, stationData), order, orderDatabase);
@@ -189,18 +193,13 @@ namespace Content.Server.Cargo.Systems
} }
} }
_idCardSystem.TryFindIdCard(player, out var idCard); order.Approved = true;
// ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
order.SetApproverData(idCard.Comp?.FullName, idCard.Comp?.JobTitle);
_audio.PlayPvs(component.ConfirmSound, uid); _audio.PlayPvs(component.ConfirmSound, uid);
var approverName = idCard.Comp?.FullName ?? Loc.GetString("access-reader-unknown-id");
var approverJob = idCard.Comp?.JobTitle ?? Loc.GetString("access-reader-unknown-id");
var message = Loc.GetString("cargo-console-unlock-approved-order-broadcast", var message = Loc.GetString("cargo-console-unlock-approved-order-broadcast",
("productName", Loc.GetString(order.ProductName)), ("productName", Loc.GetString(order.ProductName)),
("orderAmount", order.OrderQuantity), ("orderAmount", order.OrderQuantity),
("approverName", approverName), ("approver", order.Approver ?? string.Empty),
("approverJob", approverJob),
("cost", cost)); ("cost", cost));
_radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false); _radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false);
ConsolePopup(args.Actor, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(ev.FulfillmentEntity.Value).EntityName))); ConsolePopup(args.Actor, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(ev.FulfillmentEntity.Value).EntityName)));
@@ -421,6 +420,7 @@ namespace Content.Server.Cargo.Systems
// Approve it now // Approve it now
order.SetApproverData(dest, sender); order.SetApproverData(dest, sender);
order.Approved = true;
// Log order addition // Log order addition
_adminLogger.Add(LogType.Action, LogImpact.Low, _adminLogger.Add(LogType.Action, LogImpact.Low,

View File

@@ -48,7 +48,7 @@ namespace Content.Shared.Cargo
// public int RequesterId; // public int RequesterId;
[DataField] [DataField]
public string Reason { get; private set; } public string Reason { get; private set; }
public bool Approved => Approver is not null; public bool Approved;
[DataField] [DataField]
public string? Approver; public string? Approver;

View File

@@ -30,7 +30,7 @@ cargo-console-snip-snip = Order trimmed to capacity
cargo-console-insufficient-funds = Insufficient funds (require {$cost}) cargo-console-insufficient-funds = Insufficient funds (require {$cost})
cargo-console-unfulfilled = No room to fulfill order cargo-console-unfulfilled = No room to fulfill order
cargo-console-trade-station = Sent to {$destination} cargo-console-trade-station = Sent to {$destination}
cargo-console-unlock-approved-order-broadcast = [bold]{$productName} x{$orderAmount}[/bold], which cost [bold]{$cost}[/bold], was approved by [bold]{$approverName}, {$approverJob}[/bold] cargo-console-unlock-approved-order-broadcast = [bold]{$productName} x{$orderAmount}[/bold], which cost [bold]{$cost}[/bold], was approved by [bold]{$approver}[/bold]
cargo-console-paper-print-name = Order #{$orderNumber} cargo-console-paper-print-name = Order #{$orderNumber}
cargo-console-paper-print-text = cargo-console-paper-print-text =