]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix AI movement (#37114)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Fri, 2 May 2025 10:07:12 +0000 (20:07 +1000)
committerGitHub <noreply@github.com>
Fri, 2 May 2025 10:07:12 +0000 (12:07 +0200)
Don't relay blocking anymore.

Content.Shared/Interaction/SharedInteractionSystem.Blocking.cs
Content.Shared/Movement/Systems/SharedMoverController.Relay.cs
Content.Shared/Movement/Systems/SharedMoverController.cs

index 52c40477c9cf28f59244d6224f9746883711ce25..f6f4d8605d883581b129f30705818982ab0e98c7 100644 (file)
@@ -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;
 /// </summary>
 public partial class SharedInteractionSystem
 {
-    public void InitializeBlocking()
+    private void InitializeBlocking()
     {
         SubscribeLocalEvent<BlockMovementComponent, UpdateCanMoveEvent>(OnMoveAttempt);
         SubscribeLocalEvent<BlockMovementComponent, UseAttemptEvent>(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<RelayInputMoverComponent>(uid))
             return;
 
         args.Cancel(); // no more scurrying around
index f843b664359be4752b8abf773846593b558689a3..79c593cbe7e90d2ecf4c62e0e6b43fa9c63e7c93 100644 (file)
@@ -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<RelayInputMoverComponent> 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<MovementRelayTargetComponent> entity, ref ComponentShutdown args)
index 317bfdabbe294d091f6cf7fe07c3834f060de300..d8aacb74801343cf9ca3c7d9978e4872f5045928 100644 (file)
@@ -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<InputMoverComponent, PhysicsComponent>();
-
-        while (query.MoveNext(out var uid, out var _, out var physics))
-        {
-            //PhysicsSystem.SetLinearVelocity(uid, Vector2.Zero, body: physics);
-        }
-
         UsedMobMovement.Clear();
     }