From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Fri, 2 May 2025 10:07:12 +0000 (+1000) Subject: Fix AI movement (#37114) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=51bff89b238370926c25ab9bb30ca1225237cf6f;p=space-station-14.git Fix AI movement (#37114) Don't relay blocking anymore. --- diff --git a/Content.Shared/Interaction/SharedInteractionSystem.Blocking.cs b/Content.Shared/Interaction/SharedInteractionSystem.Blocking.cs index 52c40477c9..f6f4d8605d 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.Blocking.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.Blocking.cs @@ -2,6 +2,7 @@ using Content.Shared.Hands; using Content.Shared.Interaction.Components; using Content.Shared.Interaction.Events; using Content.Shared.Item; +using Content.Shared.Movement.Components; using Content.Shared.Movement.Events; namespace Content.Shared.Interaction; @@ -13,7 +14,7 @@ namespace Content.Shared.Interaction; /// public partial class SharedInteractionSystem { - public void InitializeBlocking() + private void InitializeBlocking() { SubscribeLocalEvent(OnMoveAttempt); SubscribeLocalEvent(CancelEvent); @@ -34,7 +35,8 @@ public partial class SharedInteractionSystem private void OnMoveAttempt(EntityUid uid, BlockMovementComponent component, UpdateCanMoveEvent args) { - if (component.LifeStage > ComponentLifeStage.Running) + // If we're relaying then don't cancel. + if (HasComp(uid)) return; args.Cancel(); // no more scurrying around diff --git a/Content.Shared/Movement/Systems/SharedMoverController.Relay.cs b/Content.Shared/Movement/Systems/SharedMoverController.Relay.cs index f843b66435..79c593cbe7 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.Relay.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.Relay.cs @@ -1,3 +1,4 @@ +using Content.Shared.ActionBlocker; using Content.Shared.Movement.Components; namespace Content.Shared.Movement.Systems; @@ -59,6 +60,7 @@ public abstract partial class SharedMoverController targetComp.Source = uid; Dirty(uid, component); Dirty(relayEntity, targetComp); + _blocker.UpdateCanMove(uid); } private void OnRelayShutdown(Entity entity, ref ComponentShutdown args) @@ -74,6 +76,8 @@ public abstract partial class SharedMoverController if (TryComp(entity.Comp.RelayEntity, out MovementRelayTargetComponent? target) && target.LifeStage <= ComponentLifeStage.Running) RemComp(entity.Comp.RelayEntity, target); + + _blocker.UpdateCanMove(entity.Owner); } private void OnTargetRelayShutdown(Entity entity, ref ComponentShutdown args) diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index 317bfdabbe..d8aacb7480 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Net; using System.Numerics; +using Content.Shared.ActionBlocker; using Content.Shared.Bed.Sleep; using Content.Shared.CCVar; using Content.Shared.Friction; @@ -38,6 +39,7 @@ public abstract partial class SharedMoverController : VirtualController [Dependency] private readonly IConfigurationManager _configManager = default!; [Dependency] protected readonly IGameTiming Timing = default!; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; + [Dependency] private readonly ActionBlockerSystem _blocker = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly InventorySystem _inventory = default!; [Dependency] private readonly MobStateSystem _mobState = default!; @@ -110,14 +112,6 @@ public abstract partial class SharedMoverController : VirtualController public override void UpdateAfterSolve(bool prediction, float frameTime) { base.UpdateAfterSolve(prediction, frameTime); - - var query = AllEntityQuery(); - - while (query.MoveNext(out var uid, out var _, out var physics)) - { - //PhysicsSystem.SetLinearVelocity(uid, Vector2.Zero, body: physics); - } - UsedMobMovement.Clear(); }