using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; namespace Content.Shared._RMC14.Scoping; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] [Access(typeof(SharedScopeSystem))] public sealed partial class ScopeComponent : Component { [DataField, AutoNetworkedField] public int CurrentZoomLevel = 0; [DataField, AutoNetworkedField] public List ZoomLevels = new() { new ScopeZoomLevel(null, 1f, 15, false, TimeSpan.FromSeconds(1)) }; /// /// The entity that's scoping /// [ViewVariables, AutoNetworkedField] public EntityUid? User; [DataField, AutoNetworkedField] public EntProtoId ScopingToggleAction = "ActionToggleScope"; [DataField, AutoNetworkedField] public EntityUid? ScopingToggleActionEntity; [DataField, AutoNetworkedField] public EntProtoId CycleZoomLevelAction = "ActionCycleZoomLevel"; [DataField, AutoNetworkedField] public EntityUid? CycleZoomLevelActionEntity; [DataField, AutoNetworkedField] public bool RequireWielding; [DataField, AutoNetworkedField] public bool UseInHand; [DataField, AutoNetworkedField] public Direction? ScopingDirection; [DataField, AutoNetworkedField] public EntityUid? RelayEntity; [DataField, AutoNetworkedField] public bool Attachment; } [DataRecord, Serializable, NetSerializable] public record struct ScopeZoomLevel( /// /// This is used in the popup when cycling through zoom levels. /// string? Name, /// /// Value to which zoom will be set when scoped in. /// float Zoom, // TODO RMC14 scoping making this too high causes pop-in // wait until https://github.com/space-wizards/RobustToolbox/pull/5228 is fixed to increase it // cm13 values: 11 tile offset, 24x24 view in 4x | 6 tile offset, normal view in 2x. // right now we are doing a mix of both and only one setting. /// /// How much to offset the user's view by when scoping. /// float Offset, /// /// If set to true, the user's movement won't interrupt the scoping action. /// bool AllowMovement, /// /// The length of the doafter to zoom in. /// TimeSpan DoAfter );