decelerator nerf and projectile penetration mini refactor (#24032)

* decelerator nerf and projectile fix

* datafield name difference

* forgot to add component

* missed datafield styling

* comment made summary

* CanPenetrateComponent and CollisionLayer check.

* Small comment changes
This commit is contained in:
Arendian
2024-01-15 00:39:09 +01:00
committed by GitHub
parent f9a57dc11e
commit 04a8761bb6
7 changed files with 154 additions and 38 deletions

View File

@@ -2,57 +2,75 @@ using Content.Shared.Damage;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Projectiles;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ProjectileComponent : Component
{
[ViewVariables(VVAccess.ReadWrite), DataField("impactEffect", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? ImpactEffect;
/// <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.
/// User that shot this projectile.
/// </summary>
[DataField("shooter"), AutoNetworkedField]
[DataField, AutoNetworkedField]
public EntityUid? Shooter;
/// <summary>
/// Weapon used to shoot.
/// Weapon used to shoot.
/// </summary>
[DataField("weapon"), AutoNetworkedField]
[DataField, AutoNetworkedField]
public EntityUid? Weapon;
[DataField("ignoreShooter"), AutoNetworkedField]
/// <summary>
/// The projectile spawns inside the shooter most of the time, this prevents entities from shooting themselves.
/// </summary>
[DataField, AutoNetworkedField]
public bool IgnoreShooter = true;
[DataField("damage", required: true)] [ViewVariables(VVAccess.ReadWrite)]
/// <summary>
/// The amount of damage the projectile will do.
/// </summary>
[DataField(required: true)] [ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier Damage = new();
[DataField("deleteOnCollide")]
/// <summary>
/// If the projectile should be deleted on collision.
/// </summary>
[DataField]
public bool DeleteOnCollide = true;
[DataField("canPenetrate")]
public bool CanPenetrate = false;
[DataField("ignoreResistances")]
/// <summary>
/// Ignore all damage resistances the target has.
/// </summary>
[DataField]
public bool IgnoreResistances = false;
// Get that juicy FPS hit sound
[DataField("soundHit")] public SoundSpecifier? SoundHit;
/// <summary>
/// Get that juicy FPS hit sound.
/// </summary>
[DataField]
public SoundSpecifier? SoundHit;
[DataField("soundForce")]
/// <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)
/// Whether this projectile will only collide with entities if it was shot from a gun (if <see cref="Weapon"/> is not null).
/// </summary>
[DataField("onlyCollideWhenShot")]
[DataField]
public bool OnlyCollideWhenShot = false;
/// <summary>
/// Whether this projectile has already damaged an entity.
/// </summary>
[DataField]
public bool DamagedEntity;
}