107 {
108 distanceCoveredInTiles = 0;
109 startFloorPosition.
Y--;
110 lastIteratedFloorSpot = startFloorPosition;
111 for (
int i = 0;
i < maxDistance;
i++)
112 {
113 for (int j = 0; j < 3; j++)
114 {
115 if (!
WorldGen.SolidTile3(startFloorPosition.
X, startFloorPosition.
Y))
116 {
117 break;
118 }
119 startFloorPosition.
Y--;
120 }
121 Collision.ExpandVertically(startFloorPosition.
X, startFloorPosition.
Y, out var topY, out var bottomY, height, 2);
122 topY++;
123 bottomY--;
124 if (!
WorldGen.SolidTile3(startFloorPosition.
X, bottomY + 1))
125 {
126 Collision.ExpandVertically(startFloorPosition.
X, bottomY, out var topY2, out var bottomY2, 0, 6);
127 if (showDebug)
128 {
129 Dust.QuickBox(
new Vector2(startFloorPosition.
X * 16 + 8, topY2 * 16),
new Vector2(startFloorPosition.
X * 16 + 8, bottomY2 * 16), 1,
Color.
Blue,
null);
130 }
131 if (!
WorldGen.SolidTile3(startFloorPosition.
X, bottomY2))
132 {
133 break;
134 }
135 }
136 if (bottomY - topY < height - 1)
137 {
138 break;
139 }
140 if (showDebug)
141 {
142 Dust.QuickDust(startFloorPosition,
Color.
Green).scale = 1f;
143 Dust.QuickBox(
new Vector2(startFloorPosition.
X * 16 + 8, topY * 16),
new Vector2(startFloorPosition.
X * 16 + 8, bottomY * 16 + 16), 1,
Color.
Red,
null);
144 }
145 distanceCoveredInTiles += direction;
146 startFloorPosition.X += direction;
147 startFloorPosition.Y = bottomY;
148 lastIteratedFloorSpot = startFloorPosition;
149 if (
Math.
Abs(distanceCoveredInTiles) >= maxDistance)
150 {
151 break;
152 }
153 }
154 distanceCoveredInTiles =
Math.
Abs(distanceCoveredInTiles);
155 }
static double Abs(double value)