Adds portable flasher (#4523)
Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System.Collections.Generic;
|
||||
|
||||
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 class TriggerOnProximityComponent : Component
|
||||
{
|
||||
public const string FixtureID = "trigger-on-proximity-fixture";
|
||||
|
||||
public HashSet<PhysicsComponent> Colliding = new();
|
||||
|
||||
[DataField("shape", required: true)]
|
||||
public IPhysShape Shape { get; set; } = new PhysShapeCircle {Radius = 2};
|
||||
|
||||
/// <summary>
|
||||
/// How long the the proximity trigger animation plays for.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("animationDuration")]
|
||||
public float AnimationDuration = 0.3f;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the entity needs to be anchored for the proximity to work.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("requiresAnchored")]
|
||||
public bool RequiresAnchored { get; set; } = true;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("enabled")]
|
||||
public bool Enabled = true;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("cooldown")]
|
||||
public float Cooldown { get; set; } = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// How much cooldown has elapsed (if relevant).
|
||||
/// </summary>
|
||||
public float Accumulator = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// What speed should the other object be moving at to trigger the proximity fixture?
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("triggerSpeed")]
|
||||
public float TriggerSpeed { get; set; } = 3.5f;
|
||||
|
||||
/// <summary>
|
||||
/// If this proximity is triggered should we continually repeat it?
|
||||
/// </summary>
|
||||
[DataField("repeating")]
|
||||
internal bool Repeating = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user