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

◆ Place()

static void Terraria.GameContent.Biomes.Desert.SandMound.Place ( DesertDescription description)
inlinestatic

Definition at line 8 of file SandMound.cs.

9 {
10 Rectangle desert = description.Desert;
11 desert.Height = Math.Min(description.Desert.Height, description.Hive.Height / 2);
12 Rectangle desert2 = description.Desert;
13 desert2.Y = desert.Bottom;
14 desert2.Height = Math.Max(0, description.Desert.Bottom - desert.Bottom);
15 SurfaceMap surface = description.Surface;
16 int num = 0;
17 int num2 = 0;
18 for (int i = -5; i < desert.Width + 5; i++)
19 {
20 double value = Math.Abs((double)(i + 5) / (double)(desert.Width + 10)) * 2.0 - 1.0;
21 value = Utils.Clamp(value, -1.0, 1.0);
22 if (i % 3 == 0)
23 {
24 num += WorldGen.genRand.Next(-1, 2);
25 num = Utils.Clamp(num, -10, 10);
26 }
27 num2 += WorldGen.genRand.Next(-1, 2);
28 num2 = Utils.Clamp(num2, -10, 10);
29 double num3 = Math.Sqrt(1.0 - value * value * value * value);
30 int num4 = desert.Bottom - (int)(num3 * (double)desert.Height) + num;
31 if (Math.Abs(value) < 1.0)
32 {
33 double num5 = Utils.UnclampedSmoothStep(0.5, 0.8, Math.Abs(value));
34 num5 = num5 * num5 * num5;
35 int val = 10 + (int)((double)desert.Top - num5 * 20.0) + num2;
36 val = Math.Min(val, num4);
37 for (int j = surface[i + desert.X] - 1; j < val; j++)
38 {
39 int num6 = i + desert.X;
40 int num7 = j;
41 Main.tile[num6, num7].active(active: false);
42 Main.tile[num6, num7].wall = 0;
43 }
44 }
45 PlaceSandColumn(i + desert.X, num4, desert2.Bottom - num4);
46 }
47 }
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Sqrt(double d)
static double Abs(double value)
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static void PlaceSandColumn(int startX, int startY, int height)
Definition SandMound.cs:49

References System.Math.Abs(), Microsoft.Xna.Framework.Rectangle.Bottom, Terraria.GameContent.Biomes.Desert.DesertDescription.Desert, Terraria.WorldGen.genRand, Microsoft.Xna.Framework.Rectangle.Height, Terraria.GameContent.Biomes.Desert.DesertDescription.Hive, System.Math.Max(), System.Math.Min(), Terraria.GameContent.Biomes.Desert.SandMound.PlaceSandColumn(), System.Math.Sqrt(), Terraria.GameContent.Biomes.Desert.DesertDescription.Surface, Terraria.Main.tile, Terraria.Utils.UnclampedSmoothStep(), System.value, Microsoft.Xna.Framework.Rectangle.Width, and Microsoft.Xna.Framework.Rectangle.X.

Referenced by Terraria.GameContent.Biomes.DesertBiome.Place().