This commit is contained in:
Sir Warock 2025-11-26 14:29:54 +01:00 committed by GitHub
parent 03eccfbeee
commit 4a0736235b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -404,7 +404,7 @@ public abstract partial class SharedGunSystem : EntitySystem
var shooterEv = new ShooterImpulseEvent();
RaiseLocalEvent(user, ref shooterEv);
if (shooterEv.Push)
if (shooterEv.Push && !shooterEv.CannotBePushed) // DeltaV - Bipods stop you from being moved by recoil.
CauseImpulse(fromCoordinates, toCoordinates.Value, user, userPhysics);
}
@ -662,6 +662,7 @@ public record struct GunShotEvent(EntityUid User, List<(EntityUid? Uid, IShootab
public record struct ShooterImpulseEvent()
{
public bool Push;
public bool CannotBePushed; // DeltaV - Bipods stop you from being moved by recoil.
};
public enum EffectLayers : byte

View File

@ -26,8 +26,10 @@ public abstract partial class SharedGunSystem
SubscribeLocalEvent<GunBipodComponent, GunRefreshModifiersEvent>(OnGunRefreshModifiers);
SubscribeLocalEvent<GunBipodComponent, BipodSetupFinishedEvent>(SetupBipod);
SubscribeLocalEvent<GunBipodComponent, ShotAttemptedEvent>(OnShotAttempted);
SubscribeLocalEvent<IsUsingBipodComponent, MoveEvent>(OnMove);
SubscribeLocalEvent<GunBipodComponent, ShotAttemptedEvent>(OnShotAttempted);
SubscribeLocalEvent<IsUsingBipodComponent, ShooterImpulseEvent>(OnImpulse);
}
private void OnMapInit(Entity<GunBipodComponent> weapon, ref MapInitEvent args)
@ -188,9 +190,14 @@ public abstract partial class SharedGunSystem
private void OnShotAttempted(Entity<GunBipodComponent> ent, ref ShotAttemptedEvent args)
{
// This is true when the bipod is being set up - Preventing the gun from shooting.
if (Timing.CurTime < ent.Comp.BipodSetupTime + ent.Comp.SetupDelay)
if (Timing.CurTime < ent.Comp.BipodSetupTime + ent.Comp.SetupDelay + TimeSpan.FromSeconds(0.1))
args.Cancel();
}
private void OnImpulse(Entity<IsUsingBipodComponent> bipodUser, ref ShooterImpulseEvent args)
{
args.CannotBePushed = true;
}
}
/// <summary>