diff --git a/Content.Server/Stunnable/Systems/StunOnCollideSystem.cs b/Content.Server/Stunnable/Systems/StunOnCollideSystem.cs index 2257812da1..c1757b1c2d 100644 --- a/Content.Server/Stunnable/Systems/StunOnCollideSystem.cs +++ b/Content.Server/Stunnable/Systems/StunOnCollideSystem.cs @@ -22,7 +22,7 @@ internal sealed class StunOnCollideSystem : EntitySystem private void TryDoCollideStun(Entity ent, EntityUid target) { - _stunSystem.TryKnockdown(target, ent.Comp.KnockdownAmount, ent.Comp.Refresh, ent.Comp.AutoStand, ent.Comp.Drop); + _stunSystem.TryKnockdown(target, ent.Comp.KnockdownAmount, ent.Comp.Refresh, ent.Comp.AutoStand, ent.Comp.Drop, true); if (ent.Comp.Refresh) { diff --git a/Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs b/Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs index 7917f10bd5..098e3176d9 100644 --- a/Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs +++ b/Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs @@ -4,6 +4,7 @@ using Content.Shared.Damage; using Content.Shared.Damage.Components; using Content.Shared.Database; using Content.Shared.DoAfter; +using Content.Shared.Gravity; using Content.Shared.Hands.EntitySystems; using Content.Shared.Input; using Content.Shared.Movement.Events; @@ -60,6 +61,9 @@ public abstract partial class SharedStunSystem // Crawling SubscribeLocalEvent(OnKnockdownRefresh); SubscribeLocalEvent(OnDamaged); + SubscribeLocalEvent(OnWeightlessnessChanged); + SubscribeLocalEvent(OnKnockdownAttempt); + SubscribeLocalEvent(OnGetStandUpTime); // Handling Alternative Inputs SubscribeAllEvent(OnForceStandup); @@ -488,6 +492,32 @@ public abstract partial class SharedStunSystem args.SpeedModifier *= entity.Comp.SpeedModifier; } + private void OnWeightlessnessChanged(Entity entity, ref WeightlessnessChangedEvent args) + { + // I probably don't need this check since weightless -> non-weightless you shouldn't be knocked down + // But you never know. + if (!args.Weightless) + return; + + // Targeted moth attack + CancelKnockdownDoAfter((entity, entity.Comp)); + RemComp(entity); + } + + private void OnKnockdownAttempt(Entity entity, ref KnockDownAttemptEvent args) + { + // Directed, targeted moth attack. + if (entity.Comp.Weightless) + args.Cancelled = true; + } + + private void OnGetStandUpTime(Entity entity, ref GetStandUpTimeEvent args) + { + // Get up instantly if weightless + if (entity.Comp.Weightless) + args.DoAfterTime = TimeSpan.Zero; + } + #endregion #region Action Blockers