Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CaveOpenater()

static void Terraria.WorldGen.CaveOpenater ( int i,
int j )
inlinestatic

Definition at line 70255 of file WorldGen.cs.

70256 {
70257 //IL_0081: Unknown result type (might be due to invalid IL or missing references)
70258 //IL_0088: Unknown result type (might be due to invalid IL or missing references)
70259 //IL_00c0: Unknown result type (might be due to invalid IL or missing references)
70260 //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
70261 //IL_00eb: Unknown result type (might be due to invalid IL or missing references)
70262 //IL_0100: Unknown result type (might be due to invalid IL or missing references)
70263 //IL_01f2: Unknown result type (might be due to invalid IL or missing references)
70264 //IL_01f3: Unknown result type (might be due to invalid IL or missing references)
70265 //IL_01f4: Unknown result type (might be due to invalid IL or missing references)
70266 //IL_01f9: Unknown result type (might be due to invalid IL or missing references)
70267 //IL_0242: Unknown result type (might be due to invalid IL or missing references)
70268 //IL_026b: Unknown result type (might be due to invalid IL or missing references)
70269 //IL_0170: Unknown result type (might be due to invalid IL or missing references)
70270 //IL_017f: Unknown result type (might be due to invalid IL or missing references)
70271 //IL_0294: Unknown result type (might be due to invalid IL or missing references)
70272 //IL_02b5: Unknown result type (might be due to invalid IL or missing references)
70273 double num = genRand.Next(7, 12);
70274 double num2 = num;
70275 int num3 = 1;
70276 if (genRand.Next(2) == 0)
70277 {
70278 num3 = -1;
70279 }
70280 if (genRand.Next(10) != 0)
70281 {
70282 num3 = ((i < Main.maxTilesX / 2) ? 1 : (-1));
70283 }
70284 Vector2D val = default(Vector2D);
70285 val.X = i;
70286 val.Y = j;
70287 int num4 = 100;
70288 Vector2D val2 = default(Vector2D);
70289 val2.Y = 0.0;
70290 val2.X = num3;
70291 while (num4 > 0)
70292 {
70293 Tile tile = Main.tile[(int)val.X, (int)val.Y];
70294 if (tile.wall == 0 || (tile.active() && !TileID.Sets.CanBeClearedDuringGeneration[tile.type]))
70295 {
70296 num4 = 0;
70297 }
70298 num4--;
70299 int num5 = (int)(val.X - num * 0.5);
70300 int num6 = (int)(val.X + num * 0.5);
70301 int num7 = (int)(val.Y - num * 0.5);
70302 int num8 = (int)(val.Y + num * 0.5);
70303 if (num5 < 0)
70304 {
70305 num5 = 0;
70306 }
70307 if (num6 > Main.maxTilesX)
70308 {
70309 num6 = Main.maxTilesX;
70310 }
70311 if (num7 < 0)
70312 {
70313 num7 = 0;
70314 }
70315 if (num8 > Main.maxTilesY)
70316 {
70317 num8 = Main.maxTilesY;
70318 }
70319 num2 = num * (double)genRand.Next(80, 120) * 0.01;
70320 for (int k = num5; k < num6; k++)
70321 {
70322 for (int l = num7; l < num8; l++)
70323 {
70324 double num9 = Math.Abs((double)k - val.X);
70325 double num10 = Math.Abs((double)l - val.Y);
70326 if (Math.Sqrt(num9 * num9 + num10 * num10) < num2 * 0.4 && TileID.Sets.CanBeClearedDuringGeneration[Main.tile[k, l].type])
70327 {
70328 Main.tile[k, l].active(active: false);
70329 }
70330 }
70331 }
70332 val += val2;
70333 val2.X += (double)genRand.Next(-10, 11) * 0.05;
70334 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
70335 if (val2.X > (double)num3 + 0.5)
70336 {
70337 val2.X = (double)num3 + 0.5;
70338 }
70339 if (val2.X < (double)num3 - 0.5)
70340 {
70341 val2.X = (double)num3 - 0.5;
70342 }
70343 if (val2.Y > 0.0)
70344 {
70345 val2.Y = 0.0;
70346 }
70347 if (val2.Y < -0.5)
70348 {
70349 val2.Y = -0.5;
70350 }
70351 }
70352 }
static double Sqrt(double d)
static double Abs(double value)
static bool[] CanBeClearedDuringGeneration
Definition TileID.cs:229
static UnifiedRandom genRand
Definition WorldGen.cs:1215

References System.Math.Abs(), Terraria.Tile.active(), Terraria.ID.TileID.Sets.CanBeClearedDuringGeneration, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, System.Math.Sqrt(), Terraria.Main.tile, Terraria.Tile.type, Terraria.Tile.wall, ReLogic.Utilities.Vector2D.X, and ReLogic.Utilities.Vector2D.Y.

Referenced by Terraria.WorldGen.GenerateWorld().