ECS and cleanup body system, merge body templates and presets into body prototypes (#11991)

Co-authored-by: Jezithyr <Jezithyr@gmail.com>
This commit is contained in:
DrSmugleaf
2022-10-23 00:46:28 +02:00
committed by GitHub
parent 9a38736c3c
commit f323fb7644
140 changed files with 2478 additions and 2571 deletions

View File

@@ -1,6 +1,5 @@
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Shared.Administration;
using Content.Shared.Body.Components;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
@@ -20,35 +19,28 @@ namespace Content.Server.Administration.Commands
return;
}
if (!EntityUid.TryParse(args[0], out var entityUid))
if (!EntityUid.TryParse(args[0], out var organId))
{
shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
return;
}
if (!EntityUid.TryParse(args[1], out var storageUid))
if (!EntityUid.TryParse(args[1], out var partId))
{
shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
return;
}
var entityManager = IoCManager.Resolve<IEntityManager>();
var bodySystem = entityManager.System<BodySystem>();
if (entityManager.TryGetComponent<BodyPartComponent>(storageUid, out var storage)
&& entityManager.TryGetComponent<MechanismComponent>(entityUid, out var bodyPart))
if (bodySystem.AddOrganToFirstValidSlot(organId, partId))
{
if (storage.TryAddMechanism(bodyPart))
{
shell.WriteLine($@"Added {entityUid} to {storageUid}.");
}
else
{
shell.WriteError($@"Could not add {entityUid} to {storageUid}.");
}
shell.WriteLine($@"Added {organId} to {partId}.");
}
else
{
shell.WriteError("Could not insert.");
shell.WriteError($@"Could not add {organId} to {partId}.");
}
}
}