]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix expeditions console not having any expeditions (#21148)
authorDrSmugleaf <DrSmugleaf@users.noreply.github.com>
Sat, 21 Oct 2023 21:34:00 +0000 (14:34 -0700)
committerGitHub <noreply@github.com>
Sat, 21 Oct 2023 21:34:00 +0000 (14:34 -0700)
Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs
Content.Server/Salvage/SalvageSystem.Expeditions.cs

index 237645dadf9947056a64f853d8cad6b49402e4c2..f7f3718208ed38b607895fdb9d7341042b017051 100644 (file)
@@ -20,7 +20,7 @@ public sealed partial class SalvageSystem
         data.ActiveMission = args.Index;
         var mission = GetMission(_prototypeManager.Index<SalvageDifficultyPrototype>(missionparams.Difficulty), missionparams.Seed);
         data.NextOffer = _timing.CurTime + mission.Duration + TimeSpan.FromSeconds(1);
-        UpdateConsoles(data);
+        UpdateConsoles((station.Value, data));
     }
 
     private void OnSalvageConsoleInit(Entity<SalvageExpeditionConsoleComponent> console, ref ComponentInit args)
@@ -33,7 +33,7 @@ public sealed partial class SalvageSystem
         UpdateConsole(console);
     }
 
-    private void UpdateConsoles(SalvageExpeditionDataComponent component)
+    private void UpdateConsoles(Entity<SalvageExpeditionDataComponent> component)
     {
         var state = GetState(component);
 
@@ -42,7 +42,7 @@ public sealed partial class SalvageSystem
         {
             var station = _station.GetOwningStation(uid, xform);
 
-            if (station != uid)
+            if (station != component.Owner)
                 continue;
 
             _ui.TrySetUiState(uid, SalvageConsoleUiKey.Expedition, state, ui: uiComp);
index 6021cb62360af067dc4337bcd0599b9d6b706bc6..f2be8cd5008ce3538fcd7f02b65c8fac2c8bb47e 100644 (file)
@@ -1,15 +1,12 @@
-using Content.Server.Cargo.Components;
+using System.Linq;
+using System.Threading;
 using Content.Server.Salvage.Expeditions;
 using Content.Server.Salvage.Expeditions.Structure;
 using Content.Shared.CCVar;
 using Content.Shared.Examine;
-using Content.Shared.Salvage;
+using Content.Shared.Salvage.Expeditions;
 using Robust.Shared.CPUJob.JobQueues;
 using Robust.Shared.CPUJob.JobQueues.Queues;
-using System.Linq;
-using System.Threading;
-using Content.Shared.Procedural;
-using Content.Shared.Salvage.Expeditions;
 using Robust.Shared.GameStates;
 
 namespace Content.Server.Salvage;
@@ -93,7 +90,7 @@ public sealed partial class SalvageSystem
         // Finish mission
         if (TryComp<SalvageExpeditionDataComponent>(component.Station, out var data))
         {
-            FinishExpedition(data, uid);
+            FinishExpedition((component.Station, data), uid);
         }
     }
 
@@ -122,7 +119,8 @@ public sealed partial class SalvageSystem
             }
         }
 
-        foreach (var comp in EntityQuery<SalvageExpeditionDataComponent>())
+        var query = EntityQueryEnumerator<SalvageExpeditionDataComponent>();
+        while (query.MoveNext(out var uid, out var comp))
         {
             // Update offers
             if (comp.NextOffer > currentTime || comp.Claimed)
@@ -131,17 +129,18 @@ public sealed partial class SalvageSystem
             comp.Cooldown = false;
             comp.NextOffer += TimeSpan.FromSeconds(_cooldown);
             GenerateMissions(comp);
-            UpdateConsoles(comp);
+            UpdateConsoles((uid, comp));
         }
     }
 
-    private void FinishExpedition(SalvageExpeditionDataComponent component, EntityUid uid)
+    private void FinishExpedition(Entity<SalvageExpeditionDataComponent> expedition, EntityUid uid)
     {
+        var component = expedition.Comp;
         component.NextOffer = _timing.CurTime + TimeSpan.FromSeconds(_cooldown);
         Announce(uid, Loc.GetString("salvage-expedition-mission-completed"));
         component.ActiveMission = 0;
         component.Cooldown = true;
-        UpdateConsoles(component);
+        UpdateConsoles(expedition);
     }
 
     private void GenerateMissions(SalvageExpeditionDataComponent component)