@@ -4,6 +4,7 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.White.Crossbow;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
@@ -56,7 +57,8 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
|
||||
args.Handled = true;
|
||||
|
||||
AttemptEmbedRemove(uid, args.User, component);
|
||||
if (!AttemptEmbedRemove(uid, args.User, component))
|
||||
FreePenetrated(component);
|
||||
// WD EDIT END
|
||||
}
|
||||
|
||||
@@ -129,6 +131,8 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
|
||||
if (component.PenetratedUid == args.Target)
|
||||
args.Handled = true;
|
||||
else if (HasComp<MobMoverComponent>(args.Target) || HasComp<InputMoverComponent>(args.Target))
|
||||
FreePenetrated(component);
|
||||
// WD END
|
||||
|
||||
Embed(uid, args.Target, component);
|
||||
@@ -242,16 +246,16 @@ public abstract partial class SharedProjectileSystem : EntitySystem
|
||||
Embed(uid, penetratedUid, component);
|
||||
}
|
||||
|
||||
public void AttemptEmbedRemove(EntityUid uid, EntityUid user, EmbeddableProjectileComponent? component = null)
|
||||
public bool AttemptEmbedRemove(EntityUid uid, EntityUid user, EmbeddableProjectileComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false))
|
||||
return;
|
||||
return false;
|
||||
|
||||
// Nuh uh
|
||||
if (component.RemovalTime == null)
|
||||
return;
|
||||
return false;
|
||||
|
||||
_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.RemovalTime.Value,
|
||||
return _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.RemovalTime.Value,
|
||||
new RemoveEmbeddedProjectileEvent(), eventTarget: uid, target: uid)
|
||||
{
|
||||
DistanceThreshold = SharedInteractionSystem.InteractionRange,
|
||||
|
||||
@@ -22,10 +22,15 @@ public sealed class PenetratedSystem : EntitySystem
|
||||
private void OnMoveInput(EntityUid uid, PenetratedComponent component, ref MoveInputEvent args)
|
||||
{
|
||||
if (component is {ProjectileUid: not null, IsPinned: true})
|
||||
_projectile.AttemptEmbedRemove(component.ProjectileUid.Value, uid);
|
||||
{
|
||||
if (!_projectile.AttemptEmbedRemove(component.ProjectileUid.Value, uid))
|
||||
FreePenetrated(uid, component);
|
||||
}
|
||||
else if (component.ProjectileUid == null && TryComp(uid, out PhysicsComponent? physics) &&
|
||||
physics.BodyType == BodyType.Static)
|
||||
{
|
||||
FreePenetrated(uid, component, physics);
|
||||
}
|
||||
}
|
||||
|
||||
public void FreePenetrated(EntityUid uid, PenetratedComponent? penetrated = null, PhysicsComponent? physics = null)
|
||||
|
||||
Reference in New Issue
Block a user