Local Material Silo (#36492)

* Material Silo

* fix board, fix copyright

* a bit of review.... for the vibe....

* a tiny bit of review

* 4 spaced

* sloths no good very tiny nitpick

* fix ui flickers

* oops

* slightly lower range

* Sloth Review

---------

Co-authored-by: ScarKy0 <scarky0@onet.eu>
This commit is contained in:
Nemanja
2025-04-18 19:43:17 -04:00
committed by GitHub
parent 667bda28df
commit f8ff7aee92
28 changed files with 842 additions and 46 deletions

View File

@@ -1,5 +1,6 @@
using System.Linq;
using Content.Shared.Materials;
using Content.Shared.Materials.OreSilo;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
@@ -15,6 +16,7 @@ namespace Content.Client.Materials.UI;
public sealed partial class MaterialStorageControl : ScrollContainer
{
[Dependency] private readonly IEntityManager _entityManager = default!;
private readonly MaterialStorageSystem _materialStorage;
private EntityUid? _owner;
@@ -24,6 +26,8 @@ public sealed partial class MaterialStorageControl : ScrollContainer
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_materialStorage = _entityManager.System<MaterialStorageSystem>();
}
public void SetOwner(EntityUid owner)
@@ -45,7 +49,8 @@ public sealed partial class MaterialStorageControl : ScrollContainer
}
var canEject = materialStorage.CanEjectStoredMaterials;
var mats = materialStorage.Storage;
var mats = _materialStorage.GetStoredMaterials((_owner.Value, materialStorage));
if (_currentMaterials.Equals(mats))
return;
@@ -89,5 +94,6 @@ public sealed partial class MaterialStorageControl : ScrollContainer
_currentMaterials = mats;
NoMatsLabel.Visible = MaterialList.ChildCount == 1;
SiloLinkedLabel.Visible = _entityManager.TryGetComponent<OreSiloClientComponent>(_owner.Value, out var client) && client.Silo != null;
}
}