public override bool Tick(Actor self) { mobile.TurnToMove = false; if (IsCanceling && mobile.CanStayInCell(mobile.ToCell)) { path?.Clear(); return(true); } if (mobile.IsTraitDisabled || mobile.IsTraitPaused) { return(false); } if (destination == mobile.ToCell) { return(true); } if (path.Count == 0) { destination = mobile.ToCell; return(false); } destination = path[0]; var nextCell = PopPath(self); if (nextCell == null) { return(false); } var firstFacing = self.World.Map.FacingBetween(mobile.FromCell, nextCell.Value.Cell, mobile.Facing); if (firstFacing != mobile.Facing) { path.Add(nextCell.Value.Cell); QueueChild(new Turn(self, firstFacing)); mobile.TurnToMove = true; return(false); } mobile.SetLocation(mobile.FromCell, mobile.FromSubCell, nextCell.Value.Cell, nextCell.Value.SubCell); var map = self.World.Map; var from = (mobile.FromCell.Layer == 0 ? map.CenterOfCell(mobile.FromCell) : self.World.GetCustomMovementLayers()[mobile.FromCell.Layer].CenterOfCell(mobile.FromCell)) + map.Grid.OffsetOfSubCell(mobile.FromSubCell); var to = Util.BetweenCells(self.World, mobile.FromCell, mobile.ToCell) + (map.Grid.OffsetOfSubCell(mobile.FromSubCell) + map.Grid.OffsetOfSubCell(mobile.ToSubCell)) / 2; WRot?toTerrainOrientation = null; var margin = mobile.Info.TerrainOrientationAdjustmentMargin.Length; if (margin >= 0) { toTerrainOrientation = WRot.SLerp(map.TerrainOrientation(mobile.FromCell), map.TerrainOrientation(mobile.ToCell), 1, 2); } QueueChild(new MoveFirstHalf(this, from, to, mobile.Facing, mobile.Facing, null, toTerrainOrientation, margin, carryoverProgress)); carryoverProgress = 0; return(false); }