Optimize ContainerSlot
This commit is contained in:
@@ -10,7 +10,18 @@ namespace Content.Server.GameObjects
|
|||||||
public class ContainerSlot : BaseContainer
|
public class ContainerSlot : BaseContainer
|
||||||
{
|
{
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public IEntity ContainedEntity { get; private set; } = null;
|
public IEntity ContainedEntity
|
||||||
|
{
|
||||||
|
get => _containedEntity;
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_containedEntity = value;
|
||||||
|
_containedArray[0] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly IEntity[] _containedArray = new IEntity[1];
|
||||||
|
private IEntity _containedEntity;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override IReadOnlyCollection<IEntity> ContainedEntities
|
public override IReadOnlyCollection<IEntity> ContainedEntities
|
||||||
@@ -22,7 +33,7 @@ namespace Content.Server.GameObjects
|
|||||||
return Array.Empty<IEntity>();
|
return Array.Empty<IEntity>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<IEntity> {ContainedEntity}.AsReadOnly();
|
return _containedArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user