Files
tbd-station-14/Content.Shared/Clothing/Components/ChameleonClothingComponent.cs
mhamster caf18f4bc6 Chameleon clothes + EMP behaviour (#30924)
* resolving conflicts??

* Controlled clothes changing

+ time stuff
+ EmpChangeIntensity

* Single clothes change

+ EmpContinious
+ moved random pick logic into GetRandomValidPrototype

* Changes from reviews

Co-Authored-By: Nemanja <98561806+emogarbage404@users.noreply.github.com>

* Update ChameleonClothingComponent.cs

* repairing irreparable damage

i failed, did i?

* damaging repaired irreparable

uh???

* 2025 FUN ALLOWED!!!!

* Minor changes from reviews

Co-Authored-By: beck-thompson <107373427+beck-thompson@users.noreply.github.com>

* Fix merge conflicts

* Fix that last bug

* cleanup

* Remove VV attr.

* AutoPausedField on emp time change

---------

Co-authored-by: Nemanja <98561806+emogarbage404@users.noreply.github.com>
Co-authored-by: beck-thompson <107373427+beck-thompson@users.noreply.github.com>
Co-authored-by: beck-thompson <beck314159@hotmail.com>
Co-authored-by: EmoGarbage404 <retron404@gmail.com>
2025-05-29 20:06:03 -04:00

101 lines
3.0 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;
namespace Content.Shared.Clothing.Components;
/// <summary>
/// Allow players to change clothing sprite to any other clothing prototype.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), AutoGenerateComponentPause]
[Access(typeof(SharedChameleonClothingSystem))]
public sealed partial class ChameleonClothingComponent : Component
{
/// <summary>
/// Filter possible chameleon options by their slot flag.
/// </summary>
[DataField(required: true)]
public SlotFlags Slot;
/// <summary>
/// EntityPrototype id that chameleon item is trying to mimic.
/// </summary>
[DataField(required: true), AutoNetworkedField]
public EntProtoId? Default;
/// <summary>
/// Current user that wears chameleon clothing.
/// </summary>
[ViewVariables]
public EntityUid? User;
/// <summary>
/// Filter possible chameleon options by a tag in addition to WhitelistChameleon.
/// </summary>
[DataField]
public string? RequireTag;
/// <summary>
/// Will component owner be affected by EMP pulses?
/// </summary>
[DataField]
public bool AffectedByEmp = true;
/// <summary>
/// Intensity of clothes change on EMP.
/// Can be interpreted as "How many times clothes will change every second?".
/// Useless without <see cref="AffectedByEmp"/> set to true.
/// </summary>
[DataField]
public int EmpChangeIntensity = 7;
/// <summary>
/// Should the EMP-change happen continuously, or only once?
/// (False = once, True = continuously)
/// Useless without <see cref="AffectedByEmp"/>
/// </summary>
[DataField]
public bool EmpContinuous = true;
/// <summary>
/// When should next EMP-caused appearance change happen?
/// </summary>
[AutoPausedField, DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextEmpChange = TimeSpan.Zero;
}
[Serializable, NetSerializable]
public sealed class ChameleonBoundUserInterfaceState : BoundUserInterfaceState
{
public readonly SlotFlags Slot;
public readonly string? SelectedId;
public readonly string? RequiredTag;
public ChameleonBoundUserInterfaceState(SlotFlags slot, string? selectedId, string? requiredTag)
{
Slot = slot;
SelectedId = selectedId;
RequiredTag = requiredTag;
}
}
[Serializable, NetSerializable]
public sealed class ChameleonPrototypeSelectedMessage : BoundUserInterfaceMessage
{
public readonly string SelectedId;
public ChameleonPrototypeSelectedMessage(string selectedId)
{
SelectedId = selectedId;
}
}
[Serializable, NetSerializable]
public enum ChameleonUiKey : byte
{
Key
}