Fix projectiles (#25636)
This commit is contained in:
@@ -69,9 +69,6 @@ public sealed class ProjectileSystem : SharedProjectileSystem
|
|||||||
|
|
||||||
component.DamagedEntity = true;
|
component.DamagedEntity = true;
|
||||||
|
|
||||||
var afterProjectileHitEvent = new AfterProjectileHitEvent(component.Damage, target, args.OtherFixture);
|
|
||||||
RaiseLocalEvent(uid, ref afterProjectileHitEvent);
|
|
||||||
|
|
||||||
if (component.DeleteOnCollide)
|
if (component.DeleteOnCollide)
|
||||||
QueueDel(uid);
|
QueueDel(uid);
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<ProjectileComponent, PreventCollideEvent>(PreventCollision);
|
SubscribeLocalEvent<ProjectileComponent, PreventCollideEvent>(PreventCollision);
|
||||||
SubscribeLocalEvent<ProjectileComponent, AfterProjectileHitEvent>(AfterProjectileHit);
|
|
||||||
SubscribeLocalEvent<EmbeddableProjectileComponent, ProjectileHitEvent>(OnEmbedProjectileHit);
|
SubscribeLocalEvent<EmbeddableProjectileComponent, ProjectileHitEvent>(OnEmbedProjectileHit);
|
||||||
SubscribeLocalEvent<EmbeddableProjectileComponent, ThrowDoHitEvent>(OnEmbedThrowDoHit);
|
SubscribeLocalEvent<EmbeddableProjectileComponent, ThrowDoHitEvent>(OnEmbedThrowDoHit);
|
||||||
SubscribeLocalEvent<EmbeddableProjectileComponent, ActivateInWorldEvent>(OnEmbedActivate);
|
SubscribeLocalEvent<EmbeddableProjectileComponent, ActivateInWorldEvent>(OnEmbedActivate);
|
||||||
@@ -163,18 +162,6 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
args.Cancel("pacified-cannot-throw-embed");
|
args.Cancel("pacified-cannot-throw-embed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks if the projectile is allowed to penetrate the target it hit.
|
|
||||||
/// </summary>
|
|
||||||
private void AfterProjectileHit(EntityUid uid, ProjectileComponent component, ref AfterProjectileHitEvent args)
|
|
||||||
{
|
|
||||||
//Overrides the original DeleteOnCollide if the projectile passes all penetration checks.
|
|
||||||
//This is to prevent having to set DeleteOnCollide to false on every prototype
|
|
||||||
//you want to give the ability to penetrate entities.
|
|
||||||
if(component.DeleteOnCollide)
|
|
||||||
component.DeleteOnCollide = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
@@ -201,9 +188,3 @@ public record struct ProjectileReflectAttemptEvent(EntityUid ProjUid, Projectile
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ByRefEvent]
|
[ByRefEvent]
|
||||||
public record struct ProjectileHitEvent(DamageSpecifier Damage, EntityUid Target, EntityUid? Shooter = null);
|
public record struct ProjectileHitEvent(DamageSpecifier Damage, EntityUid Target, EntityUid? Shooter = null);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Raised after a projectile has dealt it's damage.
|
|
||||||
/// </summary>
|
|
||||||
[ByRefEvent]
|
|
||||||
public record struct AfterProjectileHitEvent(DamageSpecifier Damage, EntityUid Target, Fixture Fixture);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user