Revert "Storage TEST MERGE" (#21258)

This commit is contained in:
metalgearsloth
2023-10-26 18:46:22 +11:00
committed by GitHub
parent a850b1f568
commit c08349a947
235 changed files with 1019 additions and 1072 deletions

View File

@@ -180,13 +180,14 @@ namespace Content.Server.Chemistry.EntitySystems
var user = message.Session.AttachedEntity;
var maybeContainer = _itemSlotsSystem.GetItemOrNull(chemMaster, SharedChemMaster.OutputSlotName);
if (maybeContainer is not { Valid: true } container
|| !TryComp(container, out StorageComponent? storage))
|| !TryComp(container, out StorageComponent? storage)
|| storage.Container is null)
{
return; // output can't fit pills
}
// Ensure the number is valid.
if (message.Number == 0 || !_storageSystem.HasSpace((container, storage)))
if (message.Number == 0 || message.Number > storage.StorageCapacityMax - storage.StorageUsed)
return;
// Ensure the amount is valid.
@@ -344,7 +345,7 @@ namespace Content.Server.Chemistry.EntitySystems
}
}
if (!TryComp(container, out StorageComponent? storage) || storage.Container == null)
if (!TryComp(container, out StorageComponent? storage))
return null;
var pills = storage.Container?.ContainedEntities.Select((Func<EntityUid, (string, FixedPoint2 quantity)>) (pill =>
@@ -357,7 +358,7 @@ namespace Content.Server.Chemistry.EntitySystems
if (pills == null)
return null;
return new ContainerInfo(name, storage.Container!.ContainedEntities.Count, storage.MaxSlots)
return new ContainerInfo(name, storage.StorageUsed, storage.StorageCapacityMax)
{
Entities = pills
};

View File

@@ -1,4 +1,3 @@
using System.Linq;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Inventory;
@@ -123,7 +122,7 @@ public sealed class FoodSystem : EntitySystem
return (false, false);
// Check for used storage on the food item
if (TryComp<StorageComponent>(food, out var storageState) && storageState.Container.ContainedEntities.Any())
if (TryComp<StorageComponent>(food, out var storageState) && storageState.StorageUsed != 0)
{
_popup.PopupEntity(Loc.GetString("food-has-used-storage", ("food", food)), user, user);
return (false, true);

View File

@@ -19,7 +19,7 @@ namespace Content.Server.Storage.Components
/// Max item size that can be fitted into secret stash.
/// </summary>
[DataField("maxItemSize")]
public ItemSize MaxItemSize = ItemSize.Small;
public int MaxItemSize = (int) ReferenceSizes.Pocket;
/// <summary>
/// IC secret stash name. For example "the toilet cistern".

View File

@@ -1,6 +1,7 @@
using Content.Shared.Rounding;
using Content.Shared.Storage;
using Content.Shared.Storage.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
namespace Content.Server.Storage.EntitySystems;
@@ -12,12 +13,12 @@ public sealed class StorageFillVisualizerSystem : EntitySystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<StorageFillVisualizerComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<StorageFillVisualizerComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<StorageFillVisualizerComponent, EntInsertedIntoContainerMessage>(OnInserted);
SubscribeLocalEvent<StorageFillVisualizerComponent, EntRemovedFromContainerMessage>(OnRemoved);
}
private void OnStartup(EntityUid uid, StorageFillVisualizerComponent component, ComponentStartup args)
private void OnInit(EntityUid uid, StorageFillVisualizerComponent component, ComponentInit args)
{
UpdateAppearance(uid, component: component);
}
@@ -41,7 +42,7 @@ public sealed class StorageFillVisualizerSystem : EntitySystem
if (component.MaxFillLevels < 1)
return;
var level = ContentHelpers.RoundToEqualLevels(storage.Container.ContainedEntities.Count, storage.MaxSlots, component.MaxFillLevels);
var level = ContentHelpers.RoundToEqualLevels(storage.StorageUsed, storage.StorageCapacityMax, component.MaxFillLevels);
_appearance.SetData(uid, StorageFillVisuals.FillLevel, level, appearance);
}
}

View File

@@ -98,7 +98,7 @@ public sealed class EnergySwordSystem : EntitySystem
{
if (TryComp(uid, out ItemComponent? item))
{
_item.SetSize(uid, ItemSize.Small, item);
_item.SetSize(uid, 5, item);
}
if (TryComp<DisarmMalusComponent>(uid, out var malus))
@@ -125,7 +125,7 @@ public sealed class EnergySwordSystem : EntitySystem
{
if (TryComp(uid, out ItemComponent? item))
{
_item.SetSize(uid, ItemSize.Huge, item);
_item.SetSize(uid, 9999, item);
}
if (comp.IsSharp)