Remove manual container ejection checking code.

This fixes map load when something is in a storage component.
This commit is contained in:
Pieter-Jan Briers
2019-05-05 13:09:21 +02:00
parent 23d8b92f94
commit b7d30f0870
5 changed files with 82 additions and 71 deletions

View File

@@ -7,6 +7,7 @@ using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.EntitySystemMessages;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.Input;
@@ -91,22 +92,6 @@ namespace Content.Server.GameObjects
return false;
}
/// <inheritdoc />
public void RemoveHandEntity(IEntity entity)
{
if (entity == null)
return;
foreach (var slot in hands.Values)
{
if (slot.ContainedEntity == entity)
{
slot.Remove(entity);
}
}
Dirty();
}
public ItemComponent GetHand(string index)
{
var slot = hands[index];
@@ -504,5 +489,26 @@ namespace Content.Server.GameObjects
}
}
}
public void HandleSlotModifiedMaybe(ContainerModifiedMessage message)
{
foreach (var container in hands.Values)
{
if (container != message.Container)
{
continue;
}
Dirty();
if (!message.Entity.TryGetComponent(out PhysicsComponent physics))
{
return;
}
// set velocity to zero
physics.LinearVelocity = Vector2.Zero;
return;
}
}
}
}