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

◆ ShroomPatch()

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

Definition at line 70012 of file WorldGen.cs.

70013 {
70014 //IL_00f6: Unknown result type (might be due to invalid IL or missing references)
70015 //IL_010b: Unknown result type (might be due to invalid IL or missing references)
70016 //IL_0121: Unknown result type (might be due to invalid IL or missing references)
70017 //IL_0136: Unknown result type (might be due to invalid IL or missing references)
70018 //IL_032c: Unknown result type (might be due to invalid IL or missing references)
70019 //IL_032d: Unknown result type (might be due to invalid IL or missing references)
70020 //IL_032e: Unknown result type (might be due to invalid IL or missing references)
70021 //IL_0333: Unknown result type (might be due to invalid IL or missing references)
70022 //IL_033d: Unknown result type (might be due to invalid IL or missing references)
70023 //IL_038b: Unknown result type (might be due to invalid IL or missing references)
70024 //IL_03e0: Unknown result type (might be due to invalid IL or missing references)
70025 //IL_039c: Unknown result type (might be due to invalid IL or missing references)
70026 //IL_01a9: Unknown result type (might be due to invalid IL or missing references)
70027 //IL_01b8: Unknown result type (might be due to invalid IL or missing references)
70028 //IL_0401: Unknown result type (might be due to invalid IL or missing references)
70029 //IL_03ad: Unknown result type (might be due to invalid IL or missing references)
70030 //IL_0422: Unknown result type (might be due to invalid IL or missing references)
70031 //IL_022b: Unknown result type (might be due to invalid IL or missing references)
70032 //IL_0443: Unknown result type (might be due to invalid IL or missing references)
70033 //IL_02c7: Unknown result type (might be due to invalid IL or missing references)
70034 //IL_046c: Unknown result type (might be due to invalid IL or missing references)
70035 //IL_0484: Unknown result type (might be due to invalid IL or missing references)
70036 //IL_049d: Unknown result type (might be due to invalid IL or missing references)
70037 //IL_04b5: Unknown result type (might be due to invalid IL or missing references)
70038 double num = genRand.Next(80, 100);
70039 double num2 = genRand.Next(20, 26);
70040 double num3 = (double)Main.maxTilesX / 4200.0;
70041 if (getGoodWorldGen && !Main.remixWorld)
70042 {
70043 num3 *= 1.5;
70044 }
70045 num *= num3;
70046 num2 *= num3;
70047 double num4 = num2 - 1.0;
70048 double num5 = num;
70049 Vector2D val = default(Vector2D);
70050 val.X = i;
70051 val.Y = (double)j - num2 * 0.3;
70052 Vector2D val2 = default(Vector2D);
70053 val2.X = (double)genRand.Next(-100, 101) * 0.005;
70054 val2.Y = (double)genRand.Next(-200, -100) * 0.005;
70055 while (num > 0.0 && num2 > 0.0)
70056 {
70057 num -= (double)genRand.Next(3);
70058 num2 -= 1.0;
70059 int num6 = (int)(val.X - num * 0.5);
70060 int num7 = (int)(val.X + num * 0.5);
70061 int num8 = (int)(val.Y - num * 0.5);
70062 int num9 = (int)(val.Y + num * 0.5);
70063 if (num6 < 0)
70064 {
70065 num6 = 0;
70066 }
70067 if (num7 > Main.maxTilesX)
70068 {
70069 num7 = Main.maxTilesX;
70070 }
70071 if (num8 < 0)
70072 {
70073 num8 = 0;
70074 }
70075 if (num9 > Main.maxTilesY)
70076 {
70077 num9 = Main.maxTilesY;
70078 }
70079 num5 = num * (double)genRand.Next(80, 120) * 0.01;
70080 for (int k = num6; k < num7; k++)
70081 {
70082 for (int l = num8; l < num9; l++)
70083 {
70084 double num10 = Math.Abs((double)k - val.X);
70085 double num11 = Math.Abs(((double)l - val.Y) * 2.3);
70086 double num12 = Math.Sqrt(num10 * num10 + num11 * num11);
70087 if (num12 < num5 * 0.8 && Main.tile[k, l].lava())
70088 {
70089 Main.tile[k, l].liquid = 0;
70090 }
70091 if (num12 < num5 * 0.2 && (double)l < val.Y)
70092 {
70093 Main.tile[k, l].active(active: false);
70094 if (Main.tile[k, l].wall > 0)
70095 {
70096 Main.tile[k, l].wall = 80;
70097 }
70098 }
70099 else if (num12 < num5 * 0.4 * (0.95 + genRand.NextDouble() * 0.1))
70100 {
70101 Main.tile[k, l].type = 59;
70102 if (num2 == num4 && (double)l > val.Y)
70103 {
70104 Main.tile[k, l].active(active: true);
70105 }
70106 if (Main.tile[k, l].wall > 0)
70107 {
70108 Main.tile[k, l].wall = 80;
70109 }
70110 }
70111 }
70112 }
70113 val += val2;
70114 val.X += val2.X;
70115 val2.X += (double)genRand.Next(-100, 110) * 0.005;
70116 val2.Y -= (double)genRand.Next(110) * 0.005;
70117 if (val2.X > -0.5 && val2.X < 0.5)
70118 {
70119 if (val2.X < 0.0)
70120 {
70121 val2.X = -0.5;
70122 }
70123 else
70124 {
70125 val2.X = 0.5;
70126 }
70127 }
70128 if (val2.X > 0.5)
70129 {
70130 val2.X = 0.5;
70131 }
70132 if (val2.X < -0.5)
70133 {
70134 val2.X = -0.5;
70135 }
70136 if (val2.Y > 0.5)
70137 {
70138 val2.Y = 0.5;
70139 }
70140 if (val2.Y < -0.5)
70141 {
70142 val2.Y = -0.5;
70143 }
70144 for (int m = 0; m < 2; m++)
70145 {
70146 int num13 = (int)val.X + genRand.Next(-20, 20);
70147 int num14 = (int)val.Y + genRand.Next(0, 20);
70148 while (!Main.tile[num13, num14].active() && Main.tile[num13, num14].type != 59)
70149 {
70150 num13 = (int)val.X + genRand.Next(-20, 20);
70151 num14 = (int)val.Y + genRand.Next(0, 20);
70152 }
70153 int num15 = genRand.Next(10, 20);
70154 int steps = genRand.Next(10, 20);
70155 TileRunner(num13, num14, num15, steps, 59, addTile: false, 0.0, 2.0, noYChange: true);
70156 }
70157 }
70158 }
static double Sqrt(double d)
static double Abs(double value)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void TileRunner(int i, int j, double strength, int steps, int type, bool addTile=false, double speedX=0.0, double speedY=0.0, bool noYChange=false, bool overRide=true, int ignoreTileType=-1)
static bool getGoodWorldGen
Definition WorldGen.cs:1156

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

Referenced by Terraria.WorldGen.GenerateWorld().