Remove IBody, IBodyPart, IMechanism and IMechanismBehavior (#4187)

* Remove IBody, IBodyPart, IMechanism and IMechanismBehavior interfaces

* Summary cleanup
This commit is contained in:
DrSmugleaf
2021-06-16 16:44:38 +02:00
committed by GitHub
parent 7cbfbad578
commit 69969bbdc6
72 changed files with 508 additions and 1142 deletions

View File

@@ -21,27 +21,26 @@ namespace Content.Server.Body
{
[RegisterComponent]
[ComponentReference(typeof(SharedBodyComponent))]
[ComponentReference(typeof(IBody))]
[ComponentReference(typeof(IGhostOnMove))]
public class BodyComponent : SharedBodyComponent, IRelayMoveInput, IGhostOnMove
{
private Container _partContainer = default!;
[Dependency] private readonly IGameTicker _gameTicker = default!;
protected override bool CanAddPart(string slotId, IBodyPart part)
protected override bool CanAddPart(string slotId, SharedBodyPartComponent part)
{
return base.CanAddPart(slotId, part) &&
_partContainer.CanInsert(part.Owner);
}
protected override void OnAddPart(BodyPartSlot slot, IBodyPart part)
protected override void OnAddPart(BodyPartSlot slot, SharedBodyPartComponent part)
{
base.OnAddPart(slot, part);
_partContainer.Insert(part.Owner);
}
protected override void OnRemovePart(BodyPartSlot slot, IBodyPart part)
protected override void OnRemovePart(BodyPartSlot slot, SharedBodyPartComponent part)
{
base.OnRemovePart(slot, part);
@@ -64,9 +63,9 @@ namespace Content.Server.Body
// a crash within the character preview menu in the lobby
var entity = Owner.EntityManager.SpawnEntity(preset.PartIDs[slot.Id], Owner.Transform.MapPosition);
if (!entity.TryGetComponent(out IBodyPart? part))
if (!entity.TryGetComponent(out SharedBodyPartComponent? part))
{
Logger.Error($"Entity {slot.Id} does not have a {nameof(IBodyPart)} component.");
Logger.Error($"Entity {slot.Id} does not have a {nameof(SharedBodyPartComponent)} component.");
continue;
}