Crawling Fixes Part 4: Can't crawl when weightless. (#39099)
* Init Commit * Typos * Commit 2 * Save Interaction Test Mob from failing * ssss * Confident I've gotten all the correct prototypes * Whoops forgot to edit those * aaaaa * Better solution * Test fail fixes * Yaml fix * THE FINAL TEST FIX * Final fix(?) * whoops * Added a WeightlessnessChangedEvent * Check out this diff * Wait I'm dumb * Final optimization and don't duplicate code * Death to IsWeightless * Moth directed targeted attack * A * Bugfixes and such * Grrr * Death * Cleanup * Cleanup 2 --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9de76e70c7
commit
da23bc9dcc
@@ -22,7 +22,7 @@ internal sealed class StunOnCollideSystem : EntitySystem
|
||||
|
||||
private void TryDoCollideStun(Entity<StunOnCollideComponent> 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)
|
||||
{
|
||||
|
||||
@@ -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<CrawlerComponent, KnockedDownRefreshEvent>(OnKnockdownRefresh);
|
||||
SubscribeLocalEvent<CrawlerComponent, DamageChangedEvent>(OnDamaged);
|
||||
SubscribeLocalEvent<KnockedDownComponent, WeightlessnessChangedEvent>(OnWeightlessnessChanged);
|
||||
SubscribeLocalEvent<GravityAffectedComponent, KnockDownAttemptEvent>(OnKnockdownAttempt);
|
||||
SubscribeLocalEvent<GravityAffectedComponent, GetStandUpTimeEvent>(OnGetStandUpTime);
|
||||
|
||||
// Handling Alternative Inputs
|
||||
SubscribeAllEvent<ForceStandUpEvent>(OnForceStandup);
|
||||
@@ -488,6 +492,32 @@ public abstract partial class SharedStunSystem
|
||||
args.SpeedModifier *= entity.Comp.SpeedModifier;
|
||||
}
|
||||
|
||||
private void OnWeightlessnessChanged(Entity<KnockedDownComponent> 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<KnockedDownComponent>(entity);
|
||||
}
|
||||
|
||||
private void OnKnockdownAttempt(Entity<GravityAffectedComponent> entity, ref KnockDownAttemptEvent args)
|
||||
{
|
||||
// Directed, targeted moth attack.
|
||||
if (entity.Comp.Weightless)
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnGetStandUpTime(Entity<GravityAffectedComponent> entity, ref GetStandUpTimeEvent args)
|
||||
{
|
||||
// Get up instantly if weightless
|
||||
if (entity.Comp.Weightless)
|
||||
args.DoAfterTime = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Action Blockers
|
||||
|
||||
Reference in New Issue
Block a user