* Revert "Cleanup ExecutionSystem (#24382)" This reverts commitbcbe2ec1af. * Revert "Executions (#24150)" This reverts commit2e83f5a0ec. # Conflicts: # Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
This commit is contained in:
@@ -34,6 +34,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ProjectileComponent, PreventCollideEvent>(PreventCollision);
|
||||
SubscribeLocalEvent<ProjectileComponent, AfterProjectileHitEvent>(AfterProjectileHit);
|
||||
SubscribeLocalEvent<EmbeddableProjectileComponent, ProjectileHitEvent>(OnEmbedProjectileHit);
|
||||
SubscribeLocalEvent<EmbeddableProjectileComponent, ThrowDoHitEvent>(OnEmbedThrowDoHit);
|
||||
SubscribeLocalEvent<EmbeddableProjectileComponent, ActivateInWorldEvent>(OnEmbedActivate);
|
||||
@@ -162,6 +163,18 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
{
|
||||
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]
|
||||
@@ -193,4 +206,4 @@ public record struct ProjectileHitEvent(DamageSpecifier Damage, EntityUid Target
|
||||
/// Raised after a projectile has dealt it's damage.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public record struct AfterProjectileHitEvent(DamageSpecifier Damage, EntityUid Target);
|
||||
public record struct AfterProjectileHitEvent(DamageSpecifier Damage, EntityUid Target, Fixture Fixture);
|
||||
|
||||
Reference in New Issue
Block a user