Salvage expeditions (#12745)

This commit is contained in:
metalgearsloth
2023-04-20 10:43:13 +10:00
committed by GitHub
parent 486d7c179e
commit 122350f19c
79 changed files with 2764 additions and 662 deletions

View File

@@ -162,8 +162,9 @@ public sealed class HTNSystem : EntitySystem
public void UpdateNPC(ref int count, int maxUpdates, float frameTime)
{
_planQueue.Process();
var query = EntityQueryEnumerator<ActiveNPCComponent, HTNComponent>();
foreach (var (_, comp) in EntityQuery<ActiveNPCComponent, HTNComponent>())
while(query.MoveNext(out var uid, out _, out var comp))
{
// If we're over our max count or it's not MapInit then ignore the NPC.
if (count >= maxUpdates)
@@ -173,10 +174,10 @@ public sealed class HTNSystem : EntitySystem
{
if (comp.PlanningJob.Exception != null)
{
_sawmill.Fatal($"Received exception on planning job for {comp.Owner}!");
_npc.SleepNPC(comp.Owner);
_sawmill.Fatal($"Received exception on planning job for {uid}!");
_npc.SleepNPC(uid);
var exc = comp.PlanningJob.Exception;
RemComp<HTNComponent>(comp.Owner);
RemComp<HTNComponent>(uid);
throw exc;
}
@@ -231,7 +232,7 @@ public sealed class HTNSystem : EntitySystem
RaiseNetworkEvent(new HTNMessage()
{
Uid = comp.Owner,
Uid = uid,
Text = text.ToString(),
}, session.ConnectedClient);
}