Skip to content

Commit

Permalink
Optimise mob movement (space-wizards#21978)
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth authored Nov 29, 2023
1 parent 6f19854 commit acf60db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Content.Shared/Movement/Systems/SharedMoverController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Robust.Shared.Configuration;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Controllers;
Expand Down Expand Up @@ -190,8 +191,8 @@ protected void HandleMobMovement(

// Don't bother getting the tiledef here if we're weightless or in-air
// since no tile-based modifiers should be applying in that situation
if (_mapManager.TryFindGridAt(xform.MapPosition, out var grid, out var gridComp)
&& _mapSystem.TryGetTileRef(grid, gridComp, xform.Coordinates, out var tile)
if (TryComp(xform.GridUid, out MapGridComponent? gridComp)
&& _mapSystem.TryGetTileRef(xform.GridUid.Value, gridComp, xform.Coordinates, out var tile)
&& !(weightless || physicsComponent.BodyStatus == BodyStatus.InAir))
{
tileDef = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId];
Expand Down

0 comments on commit acf60db

Please sign in to comment.