2023-08-24 21:56:01 -05:00
|
|
|
using Content.Shared.Actions;
|
2023-09-08 18:16:05 -07:00
|
|
|
using Robust.Shared.Prototypes;
|
2023-08-12 17:39:58 -04:00
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Silicons.Laws.Components;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This is used for entities which are bound to silicon laws and can view them.
|
|
|
|
|
/// </summary>
|
2023-08-14 19:34:23 -04:00
|
|
|
[RegisterComponent, Access(typeof(SharedSiliconLawSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class SiliconLawBoundComponent : Component
|
2023-08-12 17:39:58 -04:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The sidebar action that toggles the laws screen.
|
|
|
|
|
/// </summary>
|
2023-10-27 03:40:13 +01:00
|
|
|
[DataField]
|
|
|
|
|
public EntProtoId ViewLawsAction = "ActionViewLaws";
|
2023-08-12 17:39:58 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The action for toggling laws. Stored here so we can remove it later.
|
|
|
|
|
/// </summary>
|
2023-10-27 03:40:13 +01:00
|
|
|
[DataField]
|
2023-09-08 18:16:05 -07:00
|
|
|
public EntityUid? ViewLawsActionEntity;
|
2023-08-13 03:09:30 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The last entity that provided laws to this entity.
|
|
|
|
|
/// </summary>
|
2023-10-27 03:40:13 +01:00
|
|
|
[DataField]
|
2023-08-13 03:09:30 -04:00
|
|
|
public EntityUid? LastLawProvider;
|
2023-08-12 17:39:58 -04:00
|
|
|
}
|
|
|
|
|
|
2023-08-14 19:34:23 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Event raised to get the laws that a law-bound entity has.
|
|
|
|
|
///
|
|
|
|
|
/// Is first raised on the entity itself, then on the
|
|
|
|
|
/// entity's station, then on the entity's grid,
|
|
|
|
|
/// before being broadcast.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Entity"></param>
|
2023-08-12 17:39:58 -04:00
|
|
|
[ByRefEvent]
|
|
|
|
|
public record struct GetSiliconLawsEvent(EntityUid Entity)
|
|
|
|
|
{
|
|
|
|
|
public EntityUid Entity = Entity;
|
|
|
|
|
|
2023-10-27 03:40:13 +01:00
|
|
|
public SiliconLawset Laws = new();
|
2023-08-12 17:39:58 -04:00
|
|
|
|
|
|
|
|
public bool Handled = false;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ToggleLawsScreenEvent : InstantActionEvent
|
2023-08-12 17:39:58 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NetSerializable, Serializable]
|
|
|
|
|
public enum SiliconLawsUiKey : byte
|
|
|
|
|
{
|
|
|
|
|
Key
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class SiliconLawBuiState : BoundUserInterfaceState
|
|
|
|
|
{
|
|
|
|
|
public List<SiliconLaw> Laws;
|
2023-08-24 21:56:01 -05:00
|
|
|
public HashSet<string>? RadioChannels;
|
2023-08-12 17:39:58 -04:00
|
|
|
|
2023-08-24 21:56:01 -05:00
|
|
|
public SiliconLawBuiState(List<SiliconLaw> laws, HashSet<string>? radioChannels)
|
2023-08-12 17:39:58 -04:00
|
|
|
{
|
|
|
|
|
Laws = laws;
|
2023-08-24 21:56:01 -05:00
|
|
|
RadioChannels = radioChannels;
|
2023-08-12 17:39:58 -04:00
|
|
|
}
|
|
|
|
|
}
|