Mob movement rewrite (#35931)

* Conveyor optimisations

- Optimise movement for moving stuff. Better flags + less resolves + slapped parallelrobustjob on it.
- Sleeping for entities getting conveyed into walls.

* Blocker version

* Finish

* Final

* Fix conveyor power mispredict

* Bagel save

* Revert "Bagel save"

This reverts commit 1b93fda81fb852d89b89b0beae0b80f8a61165f2.

* Conveyor resave

* Fix prediction

* Mob movement rewrite

* Bandaid

* Working version

* Tentatively working

* Friction to fix cornering

* More fixes

* Revert bagel

* Revert this

* a

* Reviewed

* Funky re-save

* Fix velocity

* Table fix

* Review

* a
This commit is contained in:
metalgearsloth
2025-03-28 09:29:02 +11:00
committed by GitHub
parent e98df217e2
commit 948588399c
8 changed files with 360 additions and 131 deletions

View File

@@ -2,6 +2,7 @@ using System.Numerics;
using Content.Server.Movement.Components;
using Content.Server.Physics.Controllers;
using Content.Shared.ActionBlocker;
using Content.Shared.Conveyor;
using Content.Shared.Gravity;
using Content.Shared.Input;
using Content.Shared.Movement.Pulling.Components;
@@ -122,6 +123,12 @@ public sealed class PullController : VirtualController
var pulled = pullerComp.Pulling;
// See update statement; this thing overwrites so many systems, DOESN'T EVEN LERP PROPERLY.
// We had a throwing version but it occasionally had issues.
// We really need the throwing version back.
if (TryComp(pulled, out ConveyedComponent? conveyed) && conveyed.Conveying)
return false;
if (!_pullableQuery.TryComp(pulled, out var pullable))
return false;
@@ -134,7 +141,7 @@ public sealed class PullController : VirtualController
var range = 2f;
var fromUserCoords = coords.WithEntityId(player, EntityManager);
var userCoords = new EntityCoordinates(player, Vector2.Zero);
if (!_transformSystem.InRange(coords, userCoords, range))
{
var direction = fromUserCoords.Position - userCoords.Position;
@@ -257,6 +264,13 @@ public sealed class PullController : VirtualController
continue;
}
// TODO: This whole thing is slop and really needs to be throwing again
if (TryComp(pullableEnt, out ConveyedComponent? conveyed) && conveyed.Conveying)
{
RemCompDeferred<PullMovingComponent>(pullableEnt);
continue;
}
var movingPosition = movingTo.Position;
var ownerPosition = TransformSystem.GetWorldPosition(pullableXform);