]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
FINALLY FIX APPROVER IN CARGO INVOICE!!! (#29690)
authorlzk <124214523+lzk228@users.noreply.github.com>
Mon, 29 Jul 2024 06:19:43 +0000 (08:19 +0200)
committerGitHub <noreply@github.com>
Mon, 29 Jul 2024 06:19:43 +0000 (23:19 -0700)
* OH DEAR LORD I WASTED 2 HOURS ON THIS STUPID SHIT!!!

* change some logic

Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Content.Shared/Cargo/CargoOrderData.cs
Resources/Locale/en-US/cargo/cargo-console-component.ftl

index dd408755e672b4afdfec591e6b3c0e9557cd4206..7a2a3d474aa85596077a9843658a87c349b6f076 100644 (file)
@@ -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,
index ce05d92236208de879f973ef6d0536ad60072513..5645cc454dd902d9003815b506d6767db0dcf983 100644 (file)
@@ -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;
 
index 3c032488b522e2f3dff7c1317e31eb17f911e568..7114924c02602a75b104066744633941cd983cc2 100644 (file)
@@ -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 =