Reorganize commands into the Commands folder (#2679)

* Reorganize commands into the Commands folder

* RIDER
This commit is contained in:
DrSmugleaf
2020-12-03 03:40:47 +01:00
committed by GitHub
parent 7905d93564
commit 87f9a6e167
69 changed files with 2817 additions and 2293 deletions

View File

@@ -144,50 +144,5 @@ namespace Content.Server.GameObjects.EntitySystems.AI
}
public bool ProcessorTypeExists(string name) => _processorTypes.ContainsKey(name);
[AdminCommand(AdminFlags.Fun)]
private class AddAiCommand : IClientCommand
{
public string Command => "addai";
public string Description => "Add an ai component with a given processor to an entity.";
public string Help => "Usage: addai <processorId> <entityId>"
+ "\n processorId: Class that inherits AiLogicProcessor and has an AiLogicProcessor attribute."
+ "\n entityID: Uid of entity to add the AiControllerComponent to. Open its VV menu to find this.";
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
{
if(args.Length != 2)
{
shell.SendText(player, "Wrong number of args.");
return;
}
var processorId = args[0];
var entId = new EntityUid(int.Parse(args[1]));
var ent = IoCManager.Resolve<IEntityManager>().GetEntity(entId);
var aiSystem = Get<AiSystem>();
if (!aiSystem.ProcessorTypeExists(processorId))
{
shell.SendText(player, "Invalid processor type. Processor must inherit AiLogicProcessor and have an AiLogicProcessor attribute.");
return;
}
if (ent.HasComponent<AiControllerComponent>())
{
shell.SendText(player, "Entity already has an AI component.");
return;
}
if (ent.HasComponent<IMoverComponent>())
{
ent.RemoveComponent<IMoverComponent>();
}
var comp = ent.AddComponent<AiControllerComponent>();
comp.LogicName = processorId;
shell.SendText(player, "AI component added.");
}
}
}
}