Fix Hands Crash (#122)

* Fixed sprite issues with construction system (Thanks PJB!).

* Storage and Hands Systems now subscribe to Transform Parent changes, and will keep their containers in sync.

* Add check in Interaction System to prevent processing client-side entities on the server.
This commit is contained in:
Acruid
2018-11-11 11:32:05 -08:00
committed by Pieter-Jan Briers
parent 4720182cf4
commit 8038ebe37d
11 changed files with 108 additions and 38 deletions

View File

@@ -111,7 +111,7 @@ namespace Content.Server.GameObjects
return false;
}
clothing.EquippedToSlot(inventorySlot);
clothing.EquippedToSlot();
Dirty();
return true;

View File

@@ -71,6 +71,21 @@ namespace Content.Server.GameObjects
}
}
/// <inheritdoc />
public void RemoveHandEntity(IEntity entity)
{
if(entity == null)
return;
foreach (var slot in hands.Values)
{
if (slot.ContainedEntity == entity)
{
slot.Remove(entity);
}
}
}
public ItemComponent GetHand(string index)
{
var slot = hands[index];

View File

@@ -18,7 +18,7 @@ namespace Content.Server.GameObjects
}
}
public void EquippedToSlot(ContainerSlot slot)
public void EquippedToSlot()
{
foreach (var component in Owner.GetAllComponents<ISpriteRenderableComponent>())
{

View File

@@ -14,6 +14,7 @@ using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.Serialization;
using System.Collections.Generic;
using SS14.Shared.GameObjects.EntitySystemMessages;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects
@@ -70,7 +71,7 @@ namespace Content.Server.GameObjects
/// </summary>
/// <param name="toremove"></param>
/// <returns></returns>
bool Remove(IEntity toremove)
public bool Remove(IEntity toremove)
{
_ensureInitialCalculated();
if (storage.Remove(toremove))
@@ -88,7 +89,7 @@ namespace Content.Server.GameObjects
/// </summary>
/// <param name="toinsert"></param>
/// <returns></returns>
bool Insert(IEntity toinsert)
public bool Insert(IEntity toinsert)
{
if (CanInsert(toinsert) && storage.Insert(toinsert))
{
@@ -105,7 +106,7 @@ namespace Content.Server.GameObjects
/// </summary>
/// <param name="toinsert"></param>
/// <returns></returns>
bool CanInsert(IEntity toinsert)
public bool CanInsert(IEntity toinsert)
{
_ensureInitialCalculated();
if (toinsert.TryGetComponent(out StoreableComponent store))