Fix ServerStorageComponent making bad assumptions about GetEntity/GetComponent.
It assumed they returned null instead of throwing, and had wrong/invalid logic as a result.
This commit is contained in:
@@ -374,7 +374,7 @@ namespace Content.Server.Storage.Components
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
// ReSharper disable once StringLiteralTypo
|
// ReSharper disable once StringLiteralTypo
|
||||||
_storage = ContainerHelpers.EnsureContainer<Container>(Owner, "storagebase");
|
_storage = Owner.EnsureContainer<Container>("storagebase");
|
||||||
_storage.OccludesLight = _occludesLight;
|
_storage.OccludesLight = _occludesLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,15 +409,12 @@ namespace Content.Server.Storage.Components
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = Owner.EntityManager.GetEntity(remove.EntityUid);
|
if (!Owner.EntityManager.TryGetEntity(remove.EntityUid, out var entity) || _storage?.Contains(entity) == false)
|
||||||
|
|
||||||
if (entity == null || _storage?.Contains(entity) == false)
|
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = entity.GetComponent<ItemComponent>();
|
if (!entity.TryGetComponent(out ItemComponent? item) || !player.TryGetComponent(out HandsComponent? hands))
|
||||||
if (item == null || !player.TryGetComponent(out HandsComponent? hands))
|
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user