Remove HTN ComponentReference (#19480)

This commit is contained in:
metalgearsloth
2023-08-25 17:05:21 +10:00
committed by GitHub
parent 2185a2bf45
commit b5afb96bbd
4 changed files with 21 additions and 21 deletions

View File

@@ -8,8 +8,10 @@ using Content.Server.NPC.Components;
using Content.Server.NPC.HTN.PrimitiveTasks;
using Content.Server.NPC.Systems;
using Content.Shared.Administration;
using Content.Shared.Mobs;
using Content.Shared.NPC;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Players;
using Robust.Shared.Prototypes;
@@ -32,6 +34,10 @@ public sealed class HTNSystem : EntitySystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HTNComponent, MobStateChangedEvent>(_npc.OnMobStateChange);
SubscribeLocalEvent<HTNComponent, MapInitEvent>(_npc.OnNPCMapInit);
SubscribeLocalEvent<HTNComponent, PlayerAttachedEvent>(_npc.OnPlayerNPCAttach);
SubscribeLocalEvent<HTNComponent, PlayerDetachedEvent>(_npc.OnPlayerNPCDetach);
SubscribeLocalEvent<HTNComponent, ComponentShutdown>(OnHTNShutdown);
SubscribeNetworkEvent<RequestHTNMessage>(OnHTNMessage);
@@ -132,6 +138,7 @@ public sealed class HTNSystem : EntitySystem
private void OnHTNShutdown(EntityUid uid, HTNComponent component, ComponentShutdown args)
{
_npc.OnNPCShutdown(uid, component, args);
component.PlanningToken?.Cancel();
component.PlanningJob = null;
}