Chameleon clothing (#8444)

Co-authored-by: Moony <moonheart08@users.noreply.github.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Alex Evgrashin
2022-09-14 10:42:14 +02:00
committed by GitHub
parent 54947c137c
commit 9ce3a18e3f
33 changed files with 868 additions and 29 deletions

View File

@@ -0,0 +1,66 @@
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
}

View File

@@ -42,6 +42,10 @@ public abstract class SharedClothingComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
[DataField("sprite")]
public string? RsiPath;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("femaleMask")]
public FemaleClothingMask FemaleMask = FemaleClothingMask.UniformFull;
}
[Serializable, NetSerializable]
@@ -54,3 +58,10 @@ public sealed class ClothingComponentState : ComponentState
EquippedPrefix = equippedPrefix;
}
}
public enum FemaleClothingMask : byte
{
NoMask = 0,
UniformFull,
UniformTop
}