2022-12-24 23:28:21 -05:00
|
|
|
using Content.Shared.Damage;
|
|
|
|
|
using Robust.Shared.Audio;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2022-07-09 13:46:11 +10:00
|
|
|
using Robust.Shared.Prototypes;
|
2020-07-02 23:24:27 +02:00
|
|
|
|
2023-05-14 13:15:18 +10:00
|
|
|
namespace Content.Shared.Projectiles;
|
|
|
|
|
|
|
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
|
|
|
|
public sealed partial class ProjectileComponent : Component
|
2020-07-02 23:24:27 +02:00
|
|
|
{
|
2024-01-15 00:39:09 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// The effect that appears when a projectile collides with an entity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public EntProtoId? ImpactEffect;
|
2023-05-14 13:15:18 +10:00
|
|
|
|
|
|
|
|
/// <summary>
|
2024-01-15 00:39:09 +01:00
|
|
|
/// User that shot this projectile.
|
2023-05-14 13:15:18 +10:00
|
|
|
/// </summary>
|
2024-01-15 00:39:09 +01:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-09-22 02:45:21 -07:00
|
|
|
public EntityUid? Shooter;
|
2022-07-09 13:46:11 +10:00
|
|
|
|
2023-05-14 13:15:18 +10:00
|
|
|
/// <summary>
|
2024-01-15 00:39:09 +01:00
|
|
|
/// Weapon used to shoot.
|
2023-05-14 13:15:18 +10:00
|
|
|
/// </summary>
|
2024-01-15 00:39:09 +01:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-09-22 02:45:21 -07:00
|
|
|
public EntityUid? Weapon;
|
2020-07-02 23:24:27 +02:00
|
|
|
|
2024-03-21 09:54:11 +07:00
|
|
|
/// <summary>
|
|
|
|
|
/// Entity being targeted by crosshair.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[AutoNetworkedField]
|
|
|
|
|
public EntityUid? Target;
|
|
|
|
|
|
2024-04-22 22:14:23 +07:00
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public bool IgnoreTarget;
|
|
|
|
|
|
2024-01-15 00:39:09 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// The projectile spawns inside the shooter most of the time, this prevents entities from shooting themselves.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
2023-05-14 13:15:18 +10:00
|
|
|
public bool IgnoreShooter = true;
|
2022-12-24 23:28:21 -05:00
|
|
|
|
2024-01-15 00:39:09 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// The amount of damage the projectile will do.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField(required: true)] [ViewVariables(VVAccess.ReadWrite)]
|
2023-05-14 13:15:18 +10:00
|
|
|
public DamageSpecifier Damage = new();
|
2022-12-24 23:28:21 -05:00
|
|
|
|
2024-01-15 00:39:09 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// If the projectile should be deleted on collision.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
2023-05-14 13:15:18 +10:00
|
|
|
public bool DeleteOnCollide = true;
|
2022-12-24 23:28:21 -05:00
|
|
|
|
2024-01-15 00:39:09 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Ignore all damage resistances the target has.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
2023-05-14 13:15:18 +10:00
|
|
|
public bool IgnoreResistances = false;
|
2022-12-24 23:28:21 -05:00
|
|
|
|
2024-01-15 00:39:09 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Get that juicy FPS hit sound.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public SoundSpecifier? SoundHit;
|
2022-12-24 23:28:21 -05:00
|
|
|
|
2024-01-15 00:39:09 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Force the projectiles sound to play rather than potentially playing the entity's sound.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
2023-05-14 13:15:18 +10:00
|
|
|
public bool ForceSound = false;
|
2022-12-24 23:28:21 -05:00
|
|
|
|
2023-09-22 02:45:21 -07:00
|
|
|
/// <summary>
|
2024-01-15 00:39:09 +01:00
|
|
|
/// Whether this projectile will only collide with entities if it was shot from a gun (if <see cref="Weapon"/> is not null).
|
2023-09-22 02:45:21 -07:00
|
|
|
/// </summary>
|
2024-01-15 00:39:09 +01:00
|
|
|
[DataField]
|
2023-09-22 02:45:21 -07:00
|
|
|
public bool OnlyCollideWhenShot = false;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this projectile has already damaged an entity.
|
|
|
|
|
/// </summary>
|
2024-01-15 00:39:09 +01:00
|
|
|
[DataField]
|
2023-05-14 13:15:18 +10:00
|
|
|
public bool DamagedEntity;
|
2020-07-02 23:24:27 +02:00
|
|
|
}
|