From: lzk <124214523+lzk228@users.noreply.github.com> Date: Mon, 29 Jul 2024 06:19:43 +0000 (+0200) Subject: FINALLY FIX APPROVER IN CARGO INVOICE!!! (#29690) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=da5918c9519de6c32c9e9082dee5e2bad3774caa;p=space-station-14.git FINALLY FIX APPROVER IN CARGO INVOICE!!! (#29690) * OH DEAR LORD I WASTED 2 HOURS ON THIS STUPID SHIT!!! * change some logic --- diff --git a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs index dd408755e6..7a2a3d474a 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs @@ -177,6 +177,10 @@ namespace Content.Server.Cargo.Systems RaiseLocalEvent(ref ev); 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) { ev.FulfillmentEntity = TryFulfillOrder((station.Value, stationData), order, orderDatabase); @@ -189,18 +193,13 @@ namespace Content.Server.Cargo.Systems } } - _idCardSystem.TryFindIdCard(player, out var idCard); - // ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract - order.SetApproverData(idCard.Comp?.FullName, idCard.Comp?.JobTitle); + order.Approved = true; _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", ("productName", Loc.GetString(order.ProductName)), ("orderAmount", order.OrderQuantity), - ("approverName", approverName), - ("approverJob", approverJob), + ("approver", order.Approver ?? string.Empty), ("cost", cost)); _radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false); 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 order.SetApproverData(dest, sender); + order.Approved = true; // Log order addition _adminLogger.Add(LogType.Action, LogImpact.Low, diff --git a/Content.Shared/Cargo/CargoOrderData.cs b/Content.Shared/Cargo/CargoOrderData.cs index ce05d92236..5645cc454d 100644 --- a/Content.Shared/Cargo/CargoOrderData.cs +++ b/Content.Shared/Cargo/CargoOrderData.cs @@ -48,7 +48,7 @@ namespace Content.Shared.Cargo // public int RequesterId; [DataField] public string Reason { get; private set; } - public bool Approved => Approver is not null; + public bool Approved; [DataField] public string? Approver; diff --git a/Resources/Locale/en-US/cargo/cargo-console-component.ftl b/Resources/Locale/en-US/cargo/cargo-console-component.ftl index 3c032488b5..7114924c02 100644 --- a/Resources/Locale/en-US/cargo/cargo-console-component.ftl +++ b/Resources/Locale/en-US/cargo/cargo-console-component.ftl @@ -30,7 +30,7 @@ cargo-console-snip-snip = Order trimmed to capacity cargo-console-insufficient-funds = Insufficient funds (require {$cost}) cargo-console-unfulfilled = No room to fulfill order 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-text =