Storage system refactor & map init.
* Demonstrated map init working with guns, toolboxes, tool lockers. * Refactored EntityStorage and ServerStorage to have a common interface. * EntityStorage no longer uses ServerStorage PURELY for visuals. Use an appearance visualizer instead.
This commit is contained in:
@@ -18,6 +18,7 @@ using Robust.Shared.GameObjects.EntitySystemMessages;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Content.Server.GameObjects.Components;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Robust.Server.GameObjects.EntitySystemMessages;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
@@ -25,7 +26,7 @@ namespace Content.Server.GameObjects
|
||||
/// <summary>
|
||||
/// Storage component for containing entities within this one, matches a UI on the client which shows stored entities
|
||||
/// </summary>
|
||||
public class ServerStorageComponent : SharedStorageComponent, IAttackBy, IUse, IActivate
|
||||
public class ServerStorageComponent : SharedStorageComponent, IAttackBy, IUse, IActivate, IStorageComponent
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
@@ -40,20 +41,6 @@ namespace Content.Server.GameObjects
|
||||
private int StorageCapacityMax = 10000;
|
||||
public HashSet<IPlayerSession> SubscribedSessions = new HashSet<IPlayerSession>();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool Open
|
||||
{
|
||||
get => _open;
|
||||
set
|
||||
{
|
||||
if (_open == value)
|
||||
return;
|
||||
|
||||
_open = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -61,12 +48,6 @@ namespace Content.Server.GameObjects
|
||||
storage = ContainerManagerComponent.Ensure<Container>("storagebase", Owner);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new StorageComponentState(_open);
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
@@ -243,7 +224,10 @@ namespace Content.Server.GameObjects
|
||||
|
||||
private void UpdateDoorState()
|
||||
{
|
||||
Open = SubscribedSessions.Count != 0;
|
||||
if (Owner.TryGetComponent(out AppearanceComponent appearance))
|
||||
{
|
||||
appearance.SetData(StorageVisuals.Open, SubscribedSessions.Count != 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void HandlePlayerSessionChangeEvent(object obj, SessionStatusEventArgs SSEA)
|
||||
|
||||
Reference in New Issue
Block a user