* lathe and material storage refactor * materialStorage ECS it kinda sus tho * beginning the lathe shitcode dive * couple lathe visuals and lathe system * lathe changes and such * dynamic lathe databases * rewrote internal logic on to ui * da newI * material display clientside * misc ui changes * component state handling and various other things * moar * Update Content.Shared/Lathe/LatheComponent.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * first volley of sloth review * more fixes * losin' my mind * all da changes * test fix and other review Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
89 lines
2.5 KiB
C#
89 lines
2.5 KiB
C#
using Content.Shared.Whitelist;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
|
|
|
namespace Content.Shared.Materials;
|
|
|
|
[Access(typeof(SharedMaterialStorageSystem))]
|
|
[RegisterComponent, NetworkedComponent]
|
|
public sealed class MaterialStorageComponent : Component
|
|
{
|
|
[ViewVariables]
|
|
public Dictionary<string, int> Storage { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// How much material the storage can store in total.
|
|
/// </summary>
|
|
[ViewVariables(VVAccess.ReadWrite), DataField("storageLimit")]
|
|
public int? StorageLimit;
|
|
|
|
/// <summary>
|
|
/// Whitelist for specifying the kind of items that can be insert into this entity.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
[DataField("whitelist")]
|
|
public EntityWhitelist? EntityWhitelist;
|
|
|
|
/// <summary>
|
|
/// Whitelist generated on runtime for what specific materials can be inserted into this entity.
|
|
/// </summary>
|
|
[ViewVariables]
|
|
[DataField("materialWhiteList", customTypeSerializer: typeof(PrototypeIdListSerializer<MaterialPrototype>))]
|
|
public List<string>? MaterialWhiteList;
|
|
|
|
/// <summary>
|
|
/// The sound that plays when inserting an item into the storage
|
|
/// </summary>
|
|
[DataField("insertingSound")]
|
|
public SoundSpecifier? InsertingSound;
|
|
}
|
|
|
|
/// <summary>
|
|
/// event raised on the materialStorage when a material entity is inserted into it.
|
|
/// </summary>
|
|
public readonly struct MaterialEntityInsertedEvent
|
|
{
|
|
public readonly Dictionary<string, int> Materials;
|
|
|
|
public MaterialEntityInsertedEvent(Dictionary<string, int> materials)
|
|
{
|
|
Materials = materials;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Event raised when a material amount is changed
|
|
/// </summary>
|
|
public readonly struct MaterialAmountChangedEvent
|
|
{
|
|
|
|
}
|
|
|
|
public sealed class GetMaterialWhitelistEvent : EntityEventArgs
|
|
{
|
|
public readonly EntityUid Storage;
|
|
|
|
public List<string> Whitelist = new();
|
|
|
|
public GetMaterialWhitelistEvent(EntityUid storage)
|
|
{
|
|
Storage = storage;
|
|
}
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public sealed class MaterialStorageComponentState : ComponentState
|
|
{
|
|
public Dictionary<string, int> Storage;
|
|
|
|
public List<string>? MaterialWhitelist;
|
|
|
|
public MaterialStorageComponentState(Dictionary<string, int> storage, List<string>? materialWhitelist)
|
|
{
|
|
Storage = storage;
|
|
MaterialWhitelist = materialWhitelist;
|
|
}
|
|
}
|