Bullet impact effects (#9530)
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Projectiles
|
||||
{
|
||||
[NetworkedComponent()]
|
||||
[NetworkedComponent, Access(typeof(SharedProjectileSystem))]
|
||||
public abstract class SharedProjectileComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("impactEffect", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string? ImpactEffect;
|
||||
|
||||
private bool _ignoreShooter = true;
|
||||
public EntityUid Shooter { get; protected set; }
|
||||
public EntityUid Shooter { get; set; }
|
||||
|
||||
public bool IgnoreShooter
|
||||
{
|
||||
@@ -20,18 +24,5 @@ namespace Content.Shared.Projectiles
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
[NetSerializable, Serializable]
|
||||
protected sealed class ProjectileComponentState : ComponentState
|
||||
{
|
||||
public ProjectileComponentState(EntityUid shooter, bool ignoreShooter)
|
||||
{
|
||||
Shooter = shooter;
|
||||
IgnoreShooter = ignoreShooter;
|
||||
}
|
||||
|
||||
public EntityUid Shooter { get; }
|
||||
public bool IgnoreShooter { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Projectiles
|
||||
{
|
||||
@@ -20,5 +22,39 @@ namespace Content.Shared.Projectiles
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetShooter(SharedProjectileComponent component, EntityUid uid)
|
||||
{
|
||||
if (component.Shooter == uid) return;
|
||||
|
||||
component.Shooter = uid;
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
[NetSerializable, Serializable]
|
||||
protected sealed class ProjectileComponentState : ComponentState
|
||||
{
|
||||
public ProjectileComponentState(EntityUid shooter, bool ignoreShooter)
|
||||
{
|
||||
Shooter = shooter;
|
||||
IgnoreShooter = ignoreShooter;
|
||||
}
|
||||
|
||||
public EntityUid Shooter { get; }
|
||||
public bool IgnoreShooter { get; }
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
protected sealed class ImpactEffectEvent : EntityEventArgs
|
||||
{
|
||||
public string Prototype;
|
||||
public EntityCoordinates Coordinates;
|
||||
|
||||
public ImpactEffectEvent(string prototype, EntityCoordinates coordinates)
|
||||
{
|
||||
Prototype = prototype;
|
||||
Coordinates = coordinates;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user