Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ GERunner()

static void Terraria.WorldGen.GERunner ( int i,
int j,
double speedX = 0::0,
double speedY = 0::0,
bool good = true )
inlinestatic

Definition at line 66105 of file WorldGen.cs.

66106 {
66107 //IL_0129: Unknown result type (might be due to invalid IL or missing references)
66108 //IL_013f: Unknown result type (might be due to invalid IL or missing references)
66109 //IL_0155: Unknown result type (might be due to invalid IL or missing references)
66110 //IL_016b: Unknown result type (might be due to invalid IL or missing references)
66111 //IL_0e2d: Unknown result type (might be due to invalid IL or missing references)
66112 //IL_0e2e: Unknown result type (might be due to invalid IL or missing references)
66113 //IL_0e2f: Unknown result type (might be due to invalid IL or missing references)
66114 //IL_0e34: Unknown result type (might be due to invalid IL or missing references)
66115 //IL_0e59: Unknown result type (might be due to invalid IL or missing references)
66116 //IL_0e7e: Unknown result type (might be due to invalid IL or missing references)
66117 //IL_01ca: Unknown result type (might be due to invalid IL or missing references)
66118 //IL_01d9: Unknown result type (might be due to invalid IL or missing references)
66119 //IL_0ea3: Unknown result type (might be due to invalid IL or missing references)
66120 //IL_0eaf: Unknown result type (might be due to invalid IL or missing references)
66121 //IL_0ebb: Unknown result type (might be due to invalid IL or missing references)
66122 //IL_0ecc: Unknown result type (might be due to invalid IL or missing references)
66123 int num = 0;
66124 for (int k = 20; k < Main.maxTilesX - 20; k++)
66125 {
66126 for (int l = 20; l < Main.maxTilesY - 20; l++)
66127 {
66128 if (Main.tile[k, l].active() && Main.tile[k, l].type == 225)
66129 {
66130 num++;
66131 }
66132 }
66133 }
66134 bool flag = false;
66135 if (num > 200000)
66136 {
66137 flag = true;
66138 }
66139 int num2 = genRand.Next(200, 250);
66140 double num3 = (double)Main.maxTilesX / 4200.0;
66141 num2 = (int)((double)num2 * num3);
66142 double num4 = num2;
66143 Vector2D val = default(Vector2D);
66144 val.X = i;
66145 val.Y = j;
66146 Vector2D val2 = default(Vector2D);
66147 val2.X = (double)genRand.Next(-10, 11) * 0.1;
66148 val2.Y = (double)genRand.Next(-10, 11) * 0.1;
66149 if (speedX != 0.0 || speedY != 0.0)
66150 {
66151 val2.X = speedX;
66152 val2.Y = speedY;
66153 }
66154 bool flag2 = true;
66155 while (flag2)
66156 {
66157 int num5 = (int)(val.X - num4 * 0.5);
66158 int num6 = (int)(val.X + num4 * 0.5);
66159 int num7 = (int)(val.Y - num4 * 0.5);
66160 int num8 = (int)(val.Y + num4 * 0.5);
66161 if (num5 < 0)
66162 {
66163 num5 = 0;
66164 }
66165 if (num6 > Main.maxTilesX)
66166 {
66167 num6 = Main.maxTilesX;
66168 }
66169 if (num7 < 0)
66170 {
66171 num7 = 0;
66172 }
66173 if (num8 > Main.maxTilesY - 5)
66174 {
66175 num8 = Main.maxTilesY - 5;
66176 }
66177 for (int m = num5; m < num6; m++)
66178 {
66179 for (int n = num7; n < num8; n++)
66180 {
66181 if (!(Math.Abs((double)m - val.X) + Math.Abs((double)n - val.Y) < (double)num2 * 0.5 * (1.0 + (double)genRand.Next(-10, 11) * 0.015)))
66182 {
66183 continue;
66184 }
66185 if (good)
66186 {
66187 if (Main.tile[m, n].wall == 63 || Main.tile[m, n].wall == 65 || Main.tile[m, n].wall == 66 || Main.tile[m, n].wall == 68 || Main.tile[m, n].wall == 69 || Main.tile[m, n].wall == 81)
66188 {
66189 Main.tile[m, n].wall = 70;
66190 }
66191 else if (Main.tile[m, n].wall == 216)
66192 {
66193 Main.tile[m, n].wall = 219;
66194 }
66195 else if (Main.tile[m, n].wall == 187)
66196 {
66197 Main.tile[m, n].wall = 222;
66198 }
66199 else if (Main.tile[m, n].wall == 3 || Main.tile[m, n].wall == 83)
66200 {
66201 Main.tile[m, n].wall = 28;
66202 }
66203 if (flag && Main.tile[m, n].type == 225)
66204 {
66205 Main.tile[m, n].type = 117;
66207 }
66208 else if (flag && Main.tile[m, n].type == 230)
66209 {
66210 Main.tile[m, n].type = 402;
66212 }
66213 else if (Main.tile[m, n].type == 2)
66214 {
66215 Main.tile[m, n].type = 109;
66217 }
66218 else if (Main.tile[m, n].type == 1 || Main.tile[m, n].type == 25 || Main.tile[m, n].type == 203)
66219 {
66220 Main.tile[m, n].type = 117;
66222 }
66223 else if (Main.tile[m, n].type == 53 || Main.tile[m, n].type == 123 || Main.tile[m, n].type == 112 || Main.tile[m, n].type == 234)
66224 {
66225 Main.tile[m, n].type = 116;
66227 }
66228 else if (Main.tile[m, n].type == 661 || Main.tile[m, n].type == 662)
66229 {
66230 Main.tile[m, n].type = 60;
66232 }
66233 else if (Main.tile[m, n].type == 23 || Main.tile[m, n].type == 199)
66234 {
66235 Main.tile[m, n].type = 109;
66237 }
66238 else if (Main.tile[m, n].type == 161 || Main.tile[m, n].type == 163 || Main.tile[m, n].type == 200)
66239 {
66240 Main.tile[m, n].type = 164;
66242 }
66243 else if (Main.tile[m, n].type == 396)
66244 {
66245 Main.tile[m, n].type = 403;
66247 }
66248 else if (Main.tile[m, n].type == 397)
66249 {
66250 Main.tile[m, n].type = 402;
66252 }
66253 }
66254 else if (crimson)
66255 {
66256 if (Main.tile[m, n].wall == 63 || Main.tile[m, n].wall == 65 || Main.tile[m, n].wall == 66 || Main.tile[m, n].wall == 68)
66257 {
66258 Main.tile[m, n].wall = 81;
66259 }
66260 else if (Main.tile[m, n].wall == 216)
66261 {
66262 Main.tile[m, n].wall = 218;
66263 }
66264 else if (Main.tile[m, n].wall == 187)
66265 {
66266 Main.tile[m, n].wall = 221;
66267 }
66268 if (flag && Main.tile[m, n].type == 225)
66269 {
66270 Main.tile[m, n].type = 203;
66272 }
66273 else if (flag && Main.tile[m, n].type == 230)
66274 {
66275 Main.tile[m, n].type = 399;
66277 }
66278 else if (Main.tile[m, n].type == 60 || Main.tile[m, n].type == 661)
66279 {
66280 Main.tile[m, n].type = 662;
66282 }
66283 else if (Main.tile[m, n].type == 2 || Main.tile[m, n].type == 109)
66284 {
66285 Main.tile[m, n].type = 199;
66287 }
66288 else if (Main.tile[m, n].type == 1 || Main.tile[m, n].type == 117)
66289 {
66290 Main.tile[m, n].type = 203;
66292 }
66293 else if (Main.tile[m, n].type == 53 || Main.tile[m, n].type == 123 || Main.tile[m, n].type == 116)
66294 {
66295 Main.tile[m, n].type = 234;
66297 }
66298 else if (Main.tile[m, n].type == 161 || Main.tile[m, n].type == 164)
66299 {
66300 Main.tile[m, n].type = 200;
66302 }
66303 else if (Main.tile[m, n].type == 396)
66304 {
66305 Main.tile[m, n].type = 401;
66307 }
66308 else if (Main.tile[m, n].type == 397)
66309 {
66310 Main.tile[m, n].type = 399;
66312 }
66313 }
66314 else
66315 {
66316 if (Main.tile[m, n].wall == 63 || Main.tile[m, n].wall == 65 || Main.tile[m, n].wall == 66 || Main.tile[m, n].wall == 68)
66317 {
66318 Main.tile[m, n].wall = 69;
66319 }
66320 else if (Main.tile[m, n].wall == 216)
66321 {
66322 Main.tile[m, n].wall = 217;
66323 }
66324 else if (Main.tile[m, n].wall == 187)
66325 {
66326 Main.tile[m, n].wall = 220;
66327 }
66328 if (flag && Main.tile[m, n].type == 225)
66329 {
66330 Main.tile[m, n].type = 25;
66332 }
66333 else if (flag && Main.tile[m, n].type == 230)
66334 {
66335 Main.tile[m, n].type = 398;
66337 }
66338 else if (Main.tile[m, n].type == 60 || Main.tile[m, n].type == 662)
66339 {
66340 Main.tile[m, n].type = 661;
66342 }
66343 else if (Main.tile[m, n].type == 2 || Main.tile[m, n].type == 109)
66344 {
66345 Main.tile[m, n].type = 23;
66347 }
66348 else if (Main.tile[m, n].type == 1 || Main.tile[m, n].type == 117)
66349 {
66350 Main.tile[m, n].type = 25;
66352 }
66353 else if (Main.tile[m, n].type == 53 || Main.tile[m, n].type == 123 || Main.tile[m, n].type == 116)
66354 {
66355 Main.tile[m, n].type = 112;
66357 }
66358 else if (Main.tile[m, n].type == 161 || Main.tile[m, n].type == 164)
66359 {
66360 Main.tile[m, n].type = 163;
66362 }
66363 else if (Main.tile[m, n].type == 396)
66364 {
66365 Main.tile[m, n].type = 400;
66367 }
66368 else if (Main.tile[m, n].type == 397)
66369 {
66370 Main.tile[m, n].type = 398;
66372 }
66373 }
66374 }
66375 }
66376 val += val2;
66377 val2.X += (double)genRand.Next(-10, 11) * 0.05;
66378 if (val2.X > speedX + 1.0)
66379 {
66380 val2.X = speedX + 1.0;
66381 }
66382 if (val2.X < speedX - 1.0)
66383 {
66384 val2.X = speedX - 1.0;
66385 }
66386 if (val.X < (double)(-num2) || val.Y < (double)(-num2) || val.X > (double)(Main.maxTilesX + num2) || val.Y > (double)(Main.maxTilesY + num2))
66387 {
66388 flag2 = false;
66389 }
66390 }
66391 }
static double Abs(double value)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static bool crimson
Definition WorldGen.cs:932
static void SquareTileFrame(int i, int j, bool resetFrame=true)

References System.Math.Abs(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.tile, ReLogic.Utilities.Vector2D.X, and ReLogic.Utilities.Vector2D.Y.