using Content.Shared.Projectiles; using Robust.Shared.Map; using Robust.Shared.Physics.Events; using Robust.Shared.Serialization; namespace Content.Shared.Projectiles { public abstract class SharedProjectileSystem : EntitySystem { public const string ProjectileFixture = "projectile"; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(PreventCollision); } private void PreventCollision(EntityUid uid, ProjectileComponent component, ref PreventCollideEvent args) { if (component.IgnoreShooter && args.BodyB.Owner == component.Shooter) { args.Cancelled = true; } } public void SetShooter(ProjectileComponent component, EntityUid uid) { if (component.Shooter == uid) return; component.Shooter = uid; Dirty(component); } } [Serializable, NetSerializable] public sealed class ImpactEffectEvent : EntityEventArgs { public string Prototype; public EntityCoordinates Coordinates; public ImpactEffectEvent(string prototype, EntityCoordinates coordinates) { Prototype = prototype; Coordinates = coordinates; } } } /// /// Raised when entity is just about to be hit with projectile but can reflect it /// [ByRefEvent] public record struct ProjectileReflectAttemptEvent(EntityUid ProjUid, ProjectileComponent Component, bool Cancelled);