Skip to content

Commit

Permalink
Dont even look what I did at first I'm silly
Browse files Browse the repository at this point in the history
  • Loading branch information
beck-thompson committed Sep 22, 2024
1 parent b430c70 commit a012744
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,11 @@ private void OnInsertAttempt(EntityUid uid, StorageComponent component, Containe
}
}

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

// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
Expand All @@ -753,15 +753,19 @@ public void UpdateAppearance(Entity<StorageComponent?, AppearanceComponent?, Sto

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);

if (TryComp<StorageFillVisualizerComponent>(uid, out var storageFillVisualizerComp))
{
var level = ContentHelpers.RoundToLevels(used, capacity, storageFillVisualizerComp.MaxFillLevels);
_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 a012744

Please sign in to comment.