public static ushort GetTeleporterCell(MapRecord map, InteractiveElementRecord ele) { ushort cellId = (ushort)ele.Point.GetCellInDirection(DirectionsEnum.DIRECTION_SOUTH_WEST, 1).CellId; if (!map.Walkable(cellId)) { ushort[] array = map.CloseCells(ele.CellId); cellId = array.Length == 0 ? map.RandomWalkableCell() : array[0]; } return(cellId); }