Added mapped storage for things like crayon belts and tools (#4201)

* Added mapped storage for things like crayon belts and tools

* Attempt to get StorageFillEvent to work

* Managed to get it working with Visualizer logi

* Improved PR and did some light refactoring of components

* Update Content.Client/Storage/Visualizers/MappedItemVisualizer.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Removed event, went with stateful ApperanceData

* Removed ids in favor of whitelist

* Refactor YAML, Moved functionality to Shared and renamed it.

* Changed so insert/remove always send full state.

* Move logic to component

* Fix some issues on MappedVisualizer and few nitpicks

- Fix mapped visualizer only doing init or update layers
- Fixed naming of systems
- Fixed sort of crayons

* Forgot to apply Vera's suggestion

* Fix the data to be more strict and to avoid unnecessary clearing

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Ygg01
2021-07-22 11:56:55 +02:00
committed by GitHub
parent e15151d052
commit 3fd28c2565
8 changed files with 333 additions and 20 deletions

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Shared.Storage.ItemCounter
{
[RegisterComponent]
public class ItemCounterComponent : Component, ISerializationHooks
{
public override string Name => "ItemCounter";
[DataField("mapLayers")] public readonly Dictionary<string, SharedMapLayerData> MapLayers = new();
void ISerializationHooks.AfterDeserialization()
{
foreach (var (layerName, val) in MapLayers)
{
val.Layer = layerName;
}
}
}
}