Fix AI movement (#37114)

Don't relay blocking anymore.
This commit is contained in:
metalgearsloth
2025-05-02 20:07:12 +10:00
committed by GitHub
parent 26ebf06b81
commit 51bff89b23
3 changed files with 10 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ using Content.Shared.Hands;
using Content.Shared.Interaction.Components; using Content.Shared.Interaction.Components;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Item; using Content.Shared.Item;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Events; using Content.Shared.Movement.Events;
namespace Content.Shared.Interaction; namespace Content.Shared.Interaction;
@@ -13,7 +14,7 @@ namespace Content.Shared.Interaction;
/// </summary> /// </summary>
public partial class SharedInteractionSystem public partial class SharedInteractionSystem
{ {
public void InitializeBlocking() private void InitializeBlocking()
{ {
SubscribeLocalEvent<BlockMovementComponent, UpdateCanMoveEvent>(OnMoveAttempt); SubscribeLocalEvent<BlockMovementComponent, UpdateCanMoveEvent>(OnMoveAttempt);
SubscribeLocalEvent<BlockMovementComponent, UseAttemptEvent>(CancelEvent); SubscribeLocalEvent<BlockMovementComponent, UseAttemptEvent>(CancelEvent);
@@ -34,7 +35,8 @@ public partial class SharedInteractionSystem
private void OnMoveAttempt(EntityUid uid, BlockMovementComponent component, UpdateCanMoveEvent args) 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; return;
args.Cancel(); // no more scurrying around args.Cancel(); // no more scurrying around

View File

@@ -1,3 +1,4 @@
using Content.Shared.ActionBlocker;
using Content.Shared.Movement.Components; using Content.Shared.Movement.Components;
namespace Content.Shared.Movement.Systems; namespace Content.Shared.Movement.Systems;
@@ -59,6 +60,7 @@ public abstract partial class SharedMoverController
targetComp.Source = uid; targetComp.Source = uid;
Dirty(uid, component); Dirty(uid, component);
Dirty(relayEntity, targetComp); Dirty(relayEntity, targetComp);
_blocker.UpdateCanMove(uid);
} }
private void OnRelayShutdown(Entity<RelayInputMoverComponent> entity, ref ComponentShutdown args) 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) if (TryComp(entity.Comp.RelayEntity, out MovementRelayTargetComponent? target) && target.LifeStage <= ComponentLifeStage.Running)
RemComp(entity.Comp.RelayEntity, target); RemComp(entity.Comp.RelayEntity, target);
_blocker.UpdateCanMove(entity.Owner);
} }
private void OnTargetRelayShutdown(Entity<MovementRelayTargetComponent> entity, ref ComponentShutdown args) private void OnTargetRelayShutdown(Entity<MovementRelayTargetComponent> entity, ref ComponentShutdown args)

View File

@@ -1,6 +1,7 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Net; using System.Net;
using System.Numerics; using System.Numerics;
using Content.Shared.ActionBlocker;
using Content.Shared.Bed.Sleep; using Content.Shared.Bed.Sleep;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.Friction; using Content.Shared.Friction;
@@ -38,6 +39,7 @@ public abstract partial class SharedMoverController : VirtualController
[Dependency] private readonly IConfigurationManager _configManager = default!; [Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] protected readonly IGameTiming Timing = default!; [Dependency] protected readonly IGameTiming Timing = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly InventorySystem _inventory = default!; [Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly MobStateSystem _mobState = 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) public override void UpdateAfterSolve(bool prediction, float frameTime)
{ {
base.UpdateAfterSolve(prediction, 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(); UsedMobMovement.Clear();
} }