Fix expeditions console not having any expeditions (#21148)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user