more component ref removal + combining server/client comps (#13178)

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
Nemanja
2022-12-24 23:28:21 -05:00
committed by GitHub
parent fddcc0cece
commit faca40b8d5
78 changed files with 504 additions and 643 deletions

View File

@@ -1,11 +1,13 @@
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
{
[NetworkedComponent, Access(typeof(SharedProjectileSystem))]
public abstract class SharedProjectileComponent : Component
[RegisterComponent, NetworkedComponent]
public sealed class ProjectileComponent : Component
{
[ViewVariables(VVAccess.ReadWrite), DataField("impactEffect", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? ImpactEffect;
@@ -24,5 +26,23 @@ namespace Content.Shared.Projectiles
Dirty();
}
}
[DataField("damage", required: true)]
[ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier Damage = default!;
[DataField("deleteOnCollide")]
public bool DeleteOnCollide { get; } = true;
[DataField("ignoreResistances")]
public bool IgnoreResistances { get; } = false;
// Get that juicy FPS hit sound
[DataField("soundHit")] public SoundSpecifier? SoundHit;
[DataField("soundForce")]
public bool ForceSound = false;
public bool DamagedEntity;
}
}

View File

@@ -12,10 +12,10 @@ namespace Content.Shared.Projectiles
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedProjectileComponent, PreventCollideEvent>(PreventCollision);
SubscribeLocalEvent<ProjectileComponent, PreventCollideEvent>(PreventCollision);
}
private void PreventCollision(EntityUid uid, SharedProjectileComponent component, ref PreventCollideEvent args)
private void PreventCollision(EntityUid uid, ProjectileComponent component, ref PreventCollideEvent args)
{
if (component.IgnoreShooter && args.BodyB.Owner == component.Shooter)
{
@@ -23,7 +23,7 @@ namespace Content.Shared.Projectiles
}
}
public void SetShooter(SharedProjectileComponent component, EntityUid uid)
public void SetShooter(ProjectileComponent component, EntityUid uid)
{
if (component.Shooter == uid) return;