Files
tbd-station-14/Content.Shared/Clothing/Components/ChameleonClothingComponent.cs
Alex Evgrashin 9ce3a18e3f Chameleon clothing (#8444)
Co-authored-by: Moony <moonheart08@users.noreply.github.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2022-09-14 18:42:14 +10:00

67 lines
1.9 KiB
C#

using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Inventory;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Clothing.Components;
/// <summary>
/// Allow players to change clothing sprite to any other clothing prototype.
/// </summary>
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedChameleonClothingSystem))]
public sealed class ChameleonClothingComponent : Component
{
/// <summary>
/// Filter possible chameleon options by their slot flag.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
[DataField("slot", required: true)]
public SlotFlags Slot;
/// <summary>
/// EntityPrototype id that chameleon item is trying to mimic.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
[DataField("default", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? SelectedId;
}
[Serializable, NetSerializable]
public sealed class ChameleonClothingComponentState : ComponentState
{
public string? SelectedId;
}
[Serializable, NetSerializable]
public sealed class ChameleonBoundUserInterfaceState : BoundUserInterfaceState
{
public readonly SlotFlags Slot;
public readonly string? SelectedId;
public ChameleonBoundUserInterfaceState(SlotFlags slot, string? selectedId)
{
Slot = slot;
SelectedId = selectedId;
}
}
[Serializable, NetSerializable]
public sealed class ChameleonPrototypeSelectedMessage: BoundUserInterfaceMessage
{
public readonly string SelectedId;
public ChameleonPrototypeSelectedMessage(string selectedId)
{
SelectedId = selectedId;
}
}
[Serializable, NetSerializable]
public enum ChameleonUiKey : byte
{
Key
}