using Robust.Shared.Audio;
using Robust.Shared.Serialization;
namespace Content.Shared.Beam.Components;
///
/// Use this as a generic beam. Not for something like a laser gun, more for something continuous like lightning.
///
public abstract partial class SharedBeamComponent : Component
{
///
/// A unique list of targets that this beam collided with.
/// Useful for code like Arcing in the Lightning Component.
///
[DataField("hitTargets")]
public HashSet HitTargets = new();
///
/// The virtual entity representing a beam.
///
[DataField("virtualBeamController")]
public EntityUid? VirtualBeamController;
///
/// The first beam created, useful for keeping track of chains.
///
[DataField("originBeam")]
public EntityUid OriginBeam;
///
/// The entity that fired the beam originally
///
[DataField("beamShooter")]
public EntityUid BeamShooter;
///
/// A unique list of created beams that the controller keeps track of.
///
[DataField("createdBeams")]
public HashSet CreatedBeams = new();
///
/// Sound played upon creation
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("sound")]
public SoundSpecifier? Sound;
}
///
/// Called where a is first created. Stores the originator beam euid and the controller euid.
/// Raised on the and broadcast.
///
public sealed class BeamControllerCreatedEvent : EntityEventArgs
{
public EntityUid OriginBeam;
public EntityUid BeamControllerEntity;
public BeamControllerCreatedEvent(EntityUid originBeam, EntityUid beamControllerEntity)
{
OriginBeam = originBeam;
BeamControllerEntity = beamControllerEntity;
}
}
///
/// Called after TryCreateBeam succeeds.
///
public sealed class CreateBeamSuccessEvent : EntityEventArgs
{
public readonly EntityUid User;
public readonly EntityUid Target;
public CreateBeamSuccessEvent(EntityUid user, EntityUid target)
{
User = user;
Target = target;
}
}
///
/// Called once the beam is fully created
///
public sealed class BeamFiredEvent : EntityEventArgs
{
public readonly EntityUid CreatedBeam;
public BeamFiredEvent(EntityUid createdBeam)
{
CreatedBeam = createdBeam;
}
}
///
/// Raised on the new entity created after the creates one.
/// Used to get sprite data over to the client.
///
[Serializable, NetSerializable]
public sealed class BeamVisualizerEvent : EntityEventArgs
{
public readonly NetEntity Beam;
public readonly float DistanceLength;
public readonly Angle UserAngle;
public readonly string? BodyState;
public readonly string Shader = "unshaded";
public BeamVisualizerEvent(NetEntity beam, float distanceLength, Angle userAngle, string? bodyState = null, string shader = "unshaded")
{
Beam = beam;
DistanceLength = distanceLength;
UserAngle = userAngle;
BodyState = bodyState;
Shader = shader;
}
}