Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
beck-thompson committed Sep 22, 2024
1 parent 4f5255b commit b430c70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 56 deletions.

This file was deleted.

10 changes: 7 additions & 3 deletions Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
using Robust.Shared.Random;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Content.Shared.Rounding;
using Content.Shared.Storage;

namespace Content.Shared.Storage.EntitySystems;

Expand Down Expand Up @@ -738,11 +740,11 @@ private void OnInsertAttempt(EntityUid uid, StorageComponent component, Containe
}
}

public void UpdateAppearance(Entity<StorageComponent?, AppearanceComponent?> entity)
public void UpdateAppearance(Entity<StorageComponent?, AppearanceComponent?, StorageFillVisualizerComponent?> entity)
{
// TODO STORAGE remove appearance data and just use the data on the component.
var (uid, storage, appearance) = entity;
if (!Resolve(uid, ref storage, ref appearance, false))
var (uid, storage, appearance, storageFillVis) = entity;
if (!Resolve(uid, ref storage, ref appearance, ref storageFillVis, false))
return;

// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
Expand All @@ -751,13 +753,15 @@ public void UpdateAppearance(Entity<StorageComponent?, AppearanceComponent?> ent

var capacity = storage.Grid.GetArea();
var used = GetCumulativeItemAreas((uid, storage));
var level = ContentHelpers.RoundToLevels(used, capacity, storageFillVis.MaxFillLevels);

var isOpen = _ui.IsUiOpen(entity.Owner, StorageComponent.StorageUiKey.Key);

_appearance.SetData(uid, StorageVisuals.StorageUsed, used, appearance);
_appearance.SetData(uid, StorageVisuals.Capacity, capacity, appearance);
_appearance.SetData(uid, StorageVisuals.Open, isOpen, appearance);
_appearance.SetData(uid, SharedBagOpenVisuals.BagState, isOpen ? SharedBagState.Open : SharedBagState.Closed, appearance);
_appearance.SetData(uid, StorageFillVisuals.FillLevel, level, appearance);

// HideClosedStackVisuals true sets the StackVisuals.Hide to the open state of the storage.
// This is for containers that only show their contents when open. (e.g. donut boxes)
Expand Down

0 comments on commit b430c70

Please sign in to comment.