CatStation/Content.Shared/Light/Components/HandheldLightComponent.cs
deltanedas cf7fde3d62
Big prototype and datafield cleanup (#45202)
* giant protoid cleanup

* yml changes

* !

---------

Co-authored-by: deltanedas <@deltanedas:goida.zip>
2026-08-12 02:07:22 +00:00

95 lines
2.5 KiB
C#

using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Light.Components;
[RegisterComponent, NetworkedComponent, Access(typeof(SharedHandheldLightSystem))]
public sealed partial class HandheldLightComponent : Component
{
public byte? Level;
[DataField]
public bool Activated;
[DataField]
public float Wattage { get; set; } = .8f;
[DataField]
public SoundSpecifier TurnOnSound = new SoundPathSpecifier("/Audio/Items/flashlight_on.ogg");
[DataField]
public SoundSpecifier TurnOnFailSound = new SoundPathSpecifier("/Audio/Machines/button.ogg");
[DataField]
public SoundSpecifier TurnOffSound = new SoundPathSpecifier("/Audio/Items/flashlight_off.ogg");
/// <summary>
/// Whether to automatically set item-prefixes when toggling the flashlight.
/// </summary>
/// <remarks>
/// Flashlights should probably be using explicit unshaded sprite, in-hand and clothing layers, this is
/// mostly here for backwards compatibility.
/// </remarks>
[DataField]
public bool AddPrefix = false;
[DataField]
public EntProtoId ToggleAction = "ActionToggleLight";
/// <summary>
/// Whether or not the light can be toggled via standard interactions
/// (alt verbs, using in hand, etc)
/// </summary>
[DataField]
public bool ToggleOnInteract = true;
[DataField]
public EntityUid? ToggleActionEntity;
[DataField]
public EntityUid? SelfToggleActionEntity;
public const int StatusLevels = 6;
/// <summary>
/// Specify the ID of the light behaviour to use when the state of the light is Dying
/// </summary>
[DataField]
public string BlinkingBehaviourId { get; set; } = string.Empty;
/// <summary>
/// Specify the ID of the light behaviour to use when the state of the light is LowPower
/// </summary>
[DataField]
public string RadiatingBehaviourId { get; set; } = string.Empty;
[Serializable, NetSerializable]
public sealed class HandheldLightComponentState : ComponentState
{
public byte? Charge { get; }
public bool Activated { get; }
public HandheldLightComponentState(bool activated, byte? charge)
{
Activated = activated;
Charge = charge;
}
}
}
[Serializable, NetSerializable]
public enum HandheldLightVisuals
{
Power
}
[Serializable, NetSerializable]
public enum HandheldLightPowerStates
{
FullPower,
LowPower,
Dying,
}