decouple material insertion visualization from lathes (#13242)

This commit is contained in:
Nemanja
2023-01-07 21:36:50 -05:00
committed by GitHub
parent 1f5bae751f
commit 26786b5839
10 changed files with 184 additions and 108 deletions

View File

@@ -2,6 +2,7 @@ using Content.Shared.Whitelist;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
@@ -38,44 +39,56 @@ public sealed class MaterialStorageComponent : Component
[DataField("materialWhiteList", customTypeSerializer: typeof(PrototypeIdListSerializer<MaterialPrototype>))]
public List<string>? MaterialWhiteList;
/// <summary>
/// Whether or not the visualization for the insertion animation
/// should ignore the color of the material being inserted.
/// </summary>
[DataField("ignoreColor")]
public bool IgnoreColor;
/// <summary>
/// The sound that plays when inserting an item into the storage
/// </summary>
[DataField("insertingSound")]
public SoundSpecifier? InsertingSound;
/// <summary>
/// How long the inserting animation will play
/// </summary>
[DataField("insertionTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan InsertionTime = TimeSpan.FromSeconds(0.79f); // 0.01 off for animation timing
}
[Serializable, NetSerializable]
public enum MaterialStorageVisuals : byte
{
Inserting
}
/// <summary>
/// event raised on the materialStorage when a material entity is inserted into it.
/// </summary>
public readonly struct MaterialEntityInsertedEvent
[ByRefEvent]
public readonly record struct MaterialEntityInsertedEvent(MaterialComponent MaterialComp)
{
public readonly MaterialComponent MaterialComp;
public MaterialEntityInsertedEvent(MaterialComponent materials)
{
MaterialComp = materials;
}
public readonly MaterialComponent MaterialComp = MaterialComp;
}
/// <summary>
/// Event raised when a material amount is changed
/// </summary>
public readonly struct MaterialAmountChangedEvent
{
[ByRefEvent]
public readonly record struct MaterialAmountChangedEvent;
}
public sealed class GetMaterialWhitelistEvent : EntityEventArgs
/// <summary>
/// Event raised to get all the materials that the
/// </summary>
[ByRefEvent]
public record struct GetMaterialWhitelistEvent(EntityUid Storage)
{
public readonly EntityUid Storage;
public readonly EntityUid Storage = Storage;
public List<string> Whitelist = new();
public GetMaterialWhitelistEvent(EntityUid storage)
{
Storage = storage;
}
}
[Serializable, NetSerializable]