using Content.Shared.Explosion.EntitySystems; using Content.Shared.Whitelist; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; namespace Content.Shared.Explosion.Components; /// /// Use this component if the grenade splits into entities that make use of Timers /// or if you just want it to throw entities out in the world /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedScatteringGrenadeSystem))] public sealed partial class ScatteringGrenadeComponent : Component { public Container Container = default!; [DataField] public EntityWhitelist? Whitelist; /// /// What we fill our prototype with if we want to pre-spawn with entities. /// [DataField] public EntProtoId? FillPrototype; /// /// If we have a pre-fill how many more can we spawn. /// [ViewVariables(VVAccess.ReadOnly), AutoNetworkedField] public int UnspawnedCount; /// /// Max amount of entities inside the container /// [DataField] public int Capacity = 3; /// /// Number of grenades currently contained in the cluster (both spawned and unspawned) /// [ViewVariables(VVAccess.ReadOnly)] public int Count => UnspawnedCount + Container.ContainedEntities.Count; /// /// Decides if contained entities trigger after getting launched /// [DataField] public bool TriggerContents = true; #region Trigger time parameters for scattered entities /// /// Minimum delay in seconds before any entities start to be triggered. /// [DataField] public float DelayBeforeTriggerContents = 1.0f; /// /// Maximum delay in seconds to add between individual entity triggers /// [DataField] public float IntervalBetweenTriggersMax; /// /// Minimum delay in seconds to add between individual entity triggers /// [DataField] public float IntervalBetweenTriggersMin; #endregion #region Throwing parameters for the scattered entities /// /// Should the angle the entities get thrown at be random /// instead of uniformly distributed /// [DataField] public bool RandomAngle; /// /// The speed at which the entities get thrown /// [DataField] public float Velocity = 5; /// /// Static distance grenades will be thrown to if RandomDistance is false. /// [DataField] public float Distance = 1f; /// /// Should the distance the entities get thrown be random /// [DataField] public bool RandomDistance; /// /// Max distance grenades can randomly be thrown to. /// [DataField] public float RandomThrowDistanceMax = 2.5f; /// /// Minimal distance grenades can randomly be thrown to. /// [DataField] public float RandomThrowDistanceMin; #endregion /// /// Whether the main grenade has been triggered or not /// We need to store this because we are only allowed to spawn and trigger timed entities on the next available frame update /// public bool IsTriggered = false; /// /// The trigger key that will activate the grenade. /// [DataField] public string TriggerKey = "timer"; }