Files
tbd-station-14/Content.Server/Explosion/Components/TriggerOnProximityComponent.cs
Aexxie 467e983ba9 Move grenade components to shared (#22691)
* Moves FlashComponent.cs, FlashOnTriggerComponent.cs, and SmokeOnTriggerComponent.cs to Shared

* Moves ExplodeOnTriggerComponent.cs, OnUseTimerTriggerComponent.cs, ActiveTimerTriggerComponent.cs, and SmokeOnTriggerComponent.cs to Shared

* Delete .run/Content Server+Client.run.xml

HOW DID THIS GET IN HERE ITS NOT AHHHH

* Update Content.Client/Explosion/SmokeOnTriggerSystem.cs

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Update Content.Shared/Explosion/Components/ActiveTimerTriggerComponent.cs

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Update Content.Shared/Explosion/Components/OnUseTimerTriggerComponent.cs

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Update Content.Shared/Explosion/Components/OnUseTimerTriggerComponent.cs

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Update Content.Shared/Explosion/EntitySystems/SharedTriggerSystem.cs

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Update Content.Shared/Explosion/EntitySystems/SharedSmokeOnTriggerSystem.cs

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Update ExplodeOnTriggerComponent.cs

* Revert "Delete .run/Content Server+Client.run.xml"

This reverts commit 29ee05f57de60eab5c92158d8eba5e3acba483c2.

* Fix?

* cannot figure out how to get this to go back please forgive

* Fixes a network issue

* leftovers

* Fixes

---------

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2024-02-02 00:29:01 +11:00

92 lines
3.3 KiB
C#

using Content.Server.Explosion.EntitySystems;
using Content.Shared.Explosion;
using Content.Shared.Explosion.Components;
using Content.Shared.Physics;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Explosion.Components
{
/// <summary>
/// Raises a <see cref="TriggerEvent"/> whenever an entity collides with a fixture attached to the owner of this component.
/// </summary>
[RegisterComponent]
public sealed partial class TriggerOnProximityComponent : SharedTriggerOnProximityComponent
{
public const string FixtureID = "trigger-on-proximity-fixture";
[ViewVariables]
public readonly Dictionary<EntityUid, PhysicsComponent> Colliding = new();
/// <summary>
/// What is the shape of the proximity fixture?
/// </summary>
[ViewVariables]
[DataField("shape")]
public IPhysShape Shape = new PhysShapeCircle(2f);
/// <summary>
/// How long the the proximity trigger animation plays for.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("animationDuration")]
public TimeSpan AnimationDuration = TimeSpan.FromSeconds(0.6f);
/// <summary>
/// Whether the entity needs to be anchored for the proximity to work.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("requiresAnchored")]
public bool RequiresAnchored = true;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("enabled")]
public bool Enabled = true;
/// <summary>
/// The minimum delay between repeating triggers.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("cooldown")]
public TimeSpan Cooldown = TimeSpan.FromSeconds(5);
/// <summary>
/// When can the trigger run again?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("nextTrigger", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextTrigger = TimeSpan.Zero;
/// <summary>
/// When will the visual state be updated again after activation?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("nextVisualUpdate", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextVisualUpdate = TimeSpan.Zero;
/// <summary>
/// What speed should the other object be moving at to trigger the proximity fixture?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("triggerSpeed")]
public float TriggerSpeed = 3.5f;
/// <summary>
/// If this proximity is triggered should we continually repeat it?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("repeating")]
public bool Repeating = true;
/// <summary>
/// What layer is the trigger fixture on?
/// </summary>
[ViewVariables]
[DataField("layer", customTypeSerializer: typeof(FlagSerializer<CollisionLayer>))]
public int Layer = (int) (CollisionGroup.MidImpassable | CollisionGroup.LowImpassable | CollisionGroup.HighImpassable);
}
}