Фиксы арбалета (#330)

* Crossbow fixes

* Add Penetrated to more mobs
This commit is contained in:
Aviu00
2023-08-25 13:31:33 +03:00
committed by Aviu00
parent d0431ee61e
commit bf8839e8b0
11 changed files with 45 additions and 4 deletions

View File

@@ -39,7 +39,10 @@ public abstract partial class SharedProjectileSystem : EntitySystem
SubscribeLocalEvent<EmbeddableProjectileComponent, ActivateInWorldEvent>(OnEmbedActivate);
SubscribeLocalEvent<EmbeddableProjectileComponent, RemoveEmbeddedProjectileEvent>(OnEmbedRemove);
SubscribeLocalEvent<EmbeddableProjectileComponent, AttemptPacifiedThrowEvent>(OnAttemptPacifiedThrow);
SubscribeLocalEvent<EmbeddableProjectileComponent, LandEvent>(OnLand); // WD
SubscribeLocalEvent<EmbeddableProjectileComponent, ComponentRemove>(OnRemove); // WD
SubscribeLocalEvent<EmbeddableProjectileComponent, EntityTerminatingEvent>(OnEntityTerminating); // WD
}
private void OnEmbedActivate(EntityUid uid, EmbeddableProjectileComponent component, ActivateInWorldEvent args)
@@ -201,6 +204,26 @@ public abstract partial class SharedProjectileSystem : EntitySystem
}
// WD EDIT START
private void OnEntityTerminating(EntityUid uid, EmbeddableProjectileComponent component,
ref EntityTerminatingEvent args)
{
FreePenetrated(component);
}
private void OnRemove(EntityUid uid, EmbeddableProjectileComponent component, ComponentRemove args)
{
FreePenetrated(component);
}
private void FreePenetrated(EmbeddableProjectileComponent component)
{
if (component.PenetratedUid == null)
return;
_penetratedSystem.FreePenetrated(component.PenetratedUid.Value);
component.PenetratedUid = null;
}
private void OnLand(EntityUid uid, EmbeddableProjectileComponent component, ref LandEvent args)
{
if (component.PenetratedUid == null)