Trash bag visualizer (#7199)
This commit is contained in:
@@ -73,9 +73,9 @@ namespace Content.Server.Storage.Components
|
||||
private EntityWhitelist? _whitelist = null;
|
||||
|
||||
private bool _storageInitialCalculated;
|
||||
private int _storageUsed;
|
||||
public int StorageUsed;
|
||||
[DataField("capacity")]
|
||||
private int _storageCapacityMax = 10000;
|
||||
public int StorageCapacityMax = 10000;
|
||||
public readonly HashSet<IPlayerSession> SubscribedSessions = new();
|
||||
|
||||
[DataField("storageSoundCollection")]
|
||||
@@ -123,7 +123,7 @@ namespace Content.Server.Storage.Components
|
||||
|
||||
private void RecalculateStorageUsed()
|
||||
{
|
||||
_storageUsed = 0;
|
||||
StorageUsed = 0;
|
||||
_sizeCache.Clear();
|
||||
|
||||
if (Storage == null)
|
||||
@@ -134,7 +134,7 @@ namespace Content.Server.Storage.Components
|
||||
foreach (var entity in Storage.ContainedEntities)
|
||||
{
|
||||
var item = _entityManager.GetComponent<SharedItemComponent>(entity);
|
||||
_storageUsed += item.Size;
|
||||
StorageUsed += item.Size;
|
||||
_sizeCache.Add(entity, item.Size);
|
||||
}
|
||||
}
|
||||
@@ -149,13 +149,13 @@ namespace Content.Server.Storage.Components
|
||||
EnsureInitialCalculated();
|
||||
|
||||
if (_entityManager.TryGetComponent(entity, out ServerStorageComponent? storage) &&
|
||||
storage._storageCapacityMax >= _storageCapacityMax)
|
||||
storage.StorageCapacityMax >= StorageCapacityMax)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_entityManager.TryGetComponent(entity, out SharedItemComponent? store) &&
|
||||
store.Size > _storageCapacityMax - _storageUsed)
|
||||
store.Size > StorageCapacityMax - StorageUsed)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ namespace Content.Server.Storage.Components
|
||||
if (_entityManager.TryGetComponent(message.Entity, out SharedItemComponent? storable))
|
||||
size = storable.Size;
|
||||
|
||||
_storageUsed += size;
|
||||
StorageUsed += size;
|
||||
_sizeCache[message.Entity] = size;
|
||||
|
||||
UpdateClientInventories();
|
||||
@@ -230,7 +230,7 @@ namespace Content.Server.Storage.Components
|
||||
return;
|
||||
}
|
||||
|
||||
_storageUsed -= size;
|
||||
StorageUsed -= size;
|
||||
|
||||
UpdateClientInventories();
|
||||
}
|
||||
@@ -350,7 +350,7 @@ namespace Content.Server.Storage.Components
|
||||
var stored = StoredEntities.Select(e => e).ToArray();
|
||||
|
||||
#pragma warning disable 618
|
||||
SendNetworkMessage(new StorageHeldItemsMessage(stored, _storageUsed, _storageCapacityMax), session.ConnectedClient);
|
||||
SendNetworkMessage(new StorageHeldItemsMessage(stored, StorageUsed, StorageCapacityMax), session.ConnectedClient);
|
||||
#pragma warning restore 618
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user