Shooting NPCs and more (#18042)

* Add pirate shooting

* Shooting working

* Basics working

* Refactor time

* More conversion

* Update primitives

* Update yml

* weh

* Building again

* Draft

* weh

* b

* Start shutdown

* Starting to take form

* Code side done

* is it worky

* Fix prototypes

* stuff

* Shitty working

* Juke events working

* Even more cleanup

* RTX

* Fix interaction combat mode and compquery

* GetAmmoCount relays

* Fix rotation speed

* Juke fixes

* fixes

* weh

* The collision avoidance never ends

* Fixes

* Pause support

* framework

* lazy

* Fix idling

* Fix drip

* goobed

* Fix takeover shutdown bug

* Merge fixes

* shitter

* Fix carpos
This commit is contained in:
metalgearsloth
2023-08-02 10:48:56 +10:00
committed by GitHub
parent 018e465fad
commit c31c848afd
103 changed files with 2089 additions and 810 deletions

View File

@@ -19,8 +19,6 @@ namespace Content.Server.NPC.Systems
[Dependency] private readonly HTNSystem _htn = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
private ISawmill _sawmill = default!;
/// <summary>
/// Whether any NPCs are allowed to run at all.
/// </summary>
@@ -35,8 +33,6 @@ namespace Content.Server.NPC.Systems
{
base.Initialize();
_sawmill = Logger.GetSawmill("npc");
_sawmill.Level = LogLevel.Info;
SubscribeLocalEvent<NPCComponent, MobStateChangedEvent>(OnMobStateChange);
SubscribeLocalEvent<NPCComponent, MapInitEvent>(OnNPCMapInit);
SubscribeLocalEvent<NPCComponent, ComponentShutdown>(OnNPCShutdown);
@@ -98,7 +94,7 @@ namespace Content.Server.NPC.Systems
return;
}
_sawmill.Debug($"Waking {ToPrettyString(uid)}");
Log.Debug($"Waking {ToPrettyString(uid)}");
EnsureComp<ActiveNPCComponent>(uid);
}
@@ -109,7 +105,19 @@ namespace Content.Server.NPC.Systems
return;
}
_sawmill.Debug($"Sleeping {ToPrettyString(uid)}");
// Don't bother with an event
if (TryComp<HTNComponent>(uid, out var htn))
{
if (htn.Plan != null)
{
var currentOperator = htn.Plan.CurrentOperator;
_htn.ShutdownTask(currentOperator, htn.Blackboard, HTNOperatorStatus.Failed);
_htn.ShutdownPlan(htn);
htn.Plan = null;
}
}
Log.Debug($"Sleeping {ToPrettyString(uid)}");
RemComp<ActiveNPCComponent>(uid);
}