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:
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.NPC.HTN;
|
||||
using Content.Shared.Administration;
|
||||
@@ -13,9 +12,13 @@ namespace Content.Server.NPC.Commands;
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class NPCDomainCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntitySystemManager _sysManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
||||
|
||||
public string Command => "npcdomain";
|
||||
public string Description => "Lists the domain of a particular HTN compound task";
|
||||
public string Help => $"{Command} <htncompoundtask>";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
@@ -24,17 +27,15 @@ public sealed class NPCDomainCommand : IConsoleCommand
|
||||
return;
|
||||
}
|
||||
|
||||
var protoManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
if (!protoManager.TryIndex<HTNCompoundTask>(args[0], out var compound))
|
||||
if (!_protoManager.HasIndex<HTNCompoundPrototype>(args[0]))
|
||||
{
|
||||
shell.WriteError($"Unable to find HTN compound task for '{args[0]}'");
|
||||
return;
|
||||
}
|
||||
|
||||
var htnSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<HTNSystem>();
|
||||
var htnSystem = _sysManager.GetEntitySystem<HTNSystem>();
|
||||
|
||||
foreach (var line in htnSystem.GetDomain(compound).Split("\n"))
|
||||
foreach (var line in htnSystem.GetDomain(new HTNCompoundTask {Task = args[0]}).Split("\n"))
|
||||
{
|
||||
shell.WriteLine(line);
|
||||
}
|
||||
@@ -42,11 +43,9 @@ public sealed class NPCDomainCommand : IConsoleCommand
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
{
|
||||
var protoManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
if (args.Length > 1)
|
||||
return CompletionResult.Empty;
|
||||
|
||||
return CompletionResult.FromHintOptions(protoManager.EnumeratePrototypes<HTNCompoundTask>().Select(o => o.ID), "compound task");
|
||||
return CompletionResult.FromHintOptions(CompletionHelper.PrototypeIDs<HTNCompoundPrototype>(proto: _protoManager), "compound task");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user