CatStation/Content.Shared/Projectiles/ProjectileComponent.cs
Samuka 838984971c
Xenoborg guided missile (#45247)
* update math

* target finder system

* ports

* guns with projectiles

* make sure

* custom sprites for the laser

* add auto link

* add module

* sprite for the missile

* update animation speed

* ops

* make it glow

* overlay sprite

* stuff that doesn't work

* update launcher

* fix it

* make it see from far

* make it work

* sprite for the module

* 30 seconds is too much

* sprite for the range finder

* why was that here?

* update sprite of the missile

* update module icon

* ops

* update missile and missile launcher

* make it look like the launcher item

* remove ammo counter from range finder

* increase to 15 seconds

* no longer show the battery percentage

* use comp

* change summary

* ops

* new line

* make it last longer

* commentary

* acme moment

* fix bug when shooter was also the target and the projectile wouldn't move

* empty commit

* fix test fail

* replace with global behavior

* forgot to remove from the yml

* important

* check to see if the target exists

* fix autorefill bug

* remove unused system

* make it reload a tad slower

---------

Co-authored-by: beck-thompson <beck314159@hotmail.com>
2026-08-16 05:10:57 +00:00

113 lines
3.6 KiB
C#

using Content.Shared.Damage;
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Projectiles;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
public sealed partial class ProjectileComponent : Component
{
/// <summary>
/// The angle of the fired projectile.
/// </summary>
[DataField, AutoNetworkedField]
public Angle Angle;
/// <summary>
/// The effect that appears when a projectile collides with an entity.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public EntProtoId? ImpactEffect;
/// <summary>
/// User that shot this projectile.
/// </summary>
[DataField, AutoNetworkedField]
public EntityUid? Shooter;
/// <summary>
/// Weapon used to shoot.
/// </summary>
[DataField, AutoNetworkedField]
public EntityUid? Weapon;
/// <summary>
/// How much time after being shot the projectile can collide with the shooter.
/// </summary>
/// <remarks>
/// Since projectiles spawn inside the shooter,
/// they have to ignore the shooter for a little while while they fly away.
/// </remarks>
[DataField, AutoNetworkedField]
public TimeSpan DelayToAcknowledgeShooter = TimeSpan.FromSeconds(1);
/// <summary>
/// Time from which after the projectile can hit the shooter.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan? WhenToStopIgnoringShooter;
/// <summary>
/// The amount of damage the projectile will do.
/// </summary>
[DataField(required: true)] [ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier Damage = new();
/// <summary>
/// If the projectile should be deleted on collision.
/// </summary>
[DataField]
public bool DeleteOnCollide = true;
/// <summary>
/// Ignore all damage resistances the target has.
/// </summary>
[DataField]
public bool IgnoreResistances = false;
/// <summary>
/// Get that juicy FPS hit sound.
/// </summary>
[DataField]
public SoundSpecifier? SoundHit;
/// <summary>
/// Force the projectiles sound to play rather than potentially playing the entity's sound.
/// </summary>
[DataField]
public bool ForceSound = false;
/// <summary>
/// Whether this projectile will only collide with entities if it was shot from a gun (if <see cref="Weapon"/> is not null).
/// </summary>
[DataField]
public bool OnlyCollideWhenShot = false;
/// <summary>
/// If true, the projectile has hit enough targets and should no longer interact with further collisions pending deletion.
/// </summary>
[DataField]
public bool ProjectileSpent;
/// <summary>
/// When a projectile has this threshold set, it will continue to penetrate entities until the damage dealt reaches this threshold.
/// </summary>
[DataField]
public FixedPoint2 PenetrationThreshold = FixedPoint2.Zero;
/// <summary>
/// If set, the projectile will not penetrate objects that lack the ability to take these damage types.
/// </summary>
[DataField]
public List<string>? PenetrationDamageTypeRequirement;
/// <summary>
/// Tracks the amount of damage dealt for penetration purposes.
/// </summary>
[DataField]
public FixedPoint2 PenetrationAmount = FixedPoint2.Zero;
}