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

◆ Cavinator()

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

Definition at line 70160 of file WorldGen.cs.

70161 {
70162 //IL_007e: Unknown result type (might be due to invalid IL or missing references)
70163 //IL_0093: Unknown result type (might be due to invalid IL or missing references)
70164 //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
70165 //IL_00be: Unknown result type (might be due to invalid IL or missing references)
70166 //IL_02bd: Unknown result type (might be due to invalid IL or missing references)
70167 //IL_02d6: Unknown result type (might be due to invalid IL or missing references)
70168 //IL_02dd: Unknown result type (might be due to invalid IL or missing references)
70169 //IL_01cd: Unknown result type (might be due to invalid IL or missing references)
70170 //IL_01ce: Unknown result type (might be due to invalid IL or missing references)
70171 //IL_01cf: Unknown result type (might be due to invalid IL or missing references)
70172 //IL_01d4: Unknown result type (might be due to invalid IL or missing references)
70173 //IL_021d: Unknown result type (might be due to invalid IL or missing references)
70174 //IL_0246: Unknown result type (might be due to invalid IL or missing references)
70175 //IL_0131: Unknown result type (might be due to invalid IL or missing references)
70176 //IL_0140: Unknown result type (might be due to invalid IL or missing references)
70177 //IL_026f: Unknown result type (might be due to invalid IL or missing references)
70178 //IL_0290: Unknown result type (might be due to invalid IL or missing references)
70179 double num = genRand.Next(7, 15);
70180 double num2 = num;
70181 int num3 = 1;
70182 if (genRand.Next(2) == 0)
70183 {
70184 num3 = -1;
70185 }
70186 Vector2D val = default(Vector2D);
70187 val.X = i;
70188 val.Y = j;
70189 int num4 = genRand.Next(20, 40);
70190 Vector2D val2 = default(Vector2D);
70191 val2.Y = (double)genRand.Next(10, 20) * 0.01;
70192 val2.X = num3;
70193 while (num4 > 0)
70194 {
70195 num4--;
70196 int num5 = (int)(val.X - num * 0.5);
70197 int num6 = (int)(val.X + num * 0.5);
70198 int num7 = (int)(val.Y - num * 0.5);
70199 int num8 = (int)(val.Y + num * 0.5);
70200 if (num5 < 0)
70201 {
70202 num5 = 0;
70203 }
70204 if (num6 > Main.maxTilesX)
70205 {
70206 num6 = Main.maxTilesX;
70207 }
70208 if (num7 < 0)
70209 {
70210 num7 = 0;
70211 }
70212 if (num8 > Main.maxTilesY)
70213 {
70214 num8 = Main.maxTilesY;
70215 }
70216 num2 = num * (double)genRand.Next(80, 120) * 0.01;
70217 for (int k = num5; k < num6; k++)
70218 {
70219 for (int l = num7; l < num8; l++)
70220 {
70221 double num9 = Math.Abs((double)k - val.X);
70222 double num10 = Math.Abs((double)l - val.Y);
70223 if (Math.Sqrt(num9 * num9 + num10 * num10) < num2 * 0.4 && TileID.Sets.CanBeClearedDuringGeneration[Main.tile[k, l].type] && Main.tile[k, l].type != 53)
70224 {
70225 Main.tile[k, l].active(active: false);
70226 }
70227 }
70228 }
70229 val += val2;
70230 val2.X += (double)genRand.Next(-10, 11) * 0.05;
70231 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
70232 if (val2.X > (double)num3 + 0.5)
70233 {
70234 val2.X = (double)num3 + 0.5;
70235 }
70236 if (val2.X < (double)num3 - 0.5)
70237 {
70238 val2.X = (double)num3 - 0.5;
70239 }
70240 if (val2.Y > 2.0)
70241 {
70242 val2.Y = 2.0;
70243 }
70244 if (val2.Y < 0.0)
70245 {
70246 val2.Y = 0.0;
70247 }
70248 }
70249 if (steps > 0 && (double)(int)val.Y < Main.rockLayer + 50.0)
70250 {
70251 Cavinator((int)val.X, (int)val.Y, steps - 1);
70252 }
70253 }
static double Sqrt(double d)
static double Abs(double value)
static bool[] CanBeClearedDuringGeneration
Definition TileID.cs:229
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void Cavinator(int i, int j, int steps)

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

Referenced by Terraria.WorldGen.GenerateWorld().