Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SandMound.cs
Go to the documentation of this file.
1
using
System
;
2
using
Microsoft.Xna.Framework
;
3
4
namespace
Terraria.GameContent.Biomes.Desert
;
5
6
public
static
class
SandMound
7
{
8
public
static
void
Place
(
DesertDescription
description)
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
}
48
49
private
static
void
PlaceSandColumn
(
int
startX,
int
startY,
int
height)
50
{
51
for
(
int
num = startY + height - 1; num >= startY; num--)
52
{
53
int
num2 = num;
54
Tile
tile =
Main
.
tile
[startX, num2];
55
if
(!
WorldGen
.
remixWorldGen
)
56
{
57
tile.liquid = 0;
58
}
59
_ =
Main
.
tile
[startX, num2 + 1];
60
_ =
Main
.
tile
[startX, num2 + 2];
61
tile.type = 53;
62
tile.
slope
(0);
63
tile.
halfBrick
(halfBrick:
false
);
64
tile.
active
(active:
true
);
65
if
(num < startY)
66
{
67
tile.
active
(active:
false
);
68
}
69
WorldGen
.
SquareWallFrame
(startX, num2);
70
}
71
}
72
}
System.Math.Min
static byte Min(byte val1, byte val2)
Definition
Math.cs:912
System.Math.Sqrt
static double Sqrt(double d)
System.Math.Abs
static double Abs(double value)
System.Math.Max
static byte Max(byte val1, byte val2)
Definition
Math.cs:738
System.Math
Definition
Math.cs:13
Terraria.GameContent.Biomes.Desert.DesertDescription.Hive
Rectangle Hive
Definition
DesertDescription.cs:22
Terraria.GameContent.Biomes.Desert.DesertDescription.Desert
Rectangle Desert
Definition
DesertDescription.cs:20
Terraria.GameContent.Biomes.Desert.DesertDescription.Surface
SurfaceMap Surface
Definition
DesertDescription.cs:32
Terraria.GameContent.Biomes.Desert.DesertDescription
Definition
DesertDescription.cs:8
Terraria.GameContent.Biomes.Desert.SandMound.PlaceSandColumn
static void PlaceSandColumn(int startX, int startY, int height)
Definition
SandMound.cs:49
Terraria.GameContent.Biomes.Desert.SandMound.Place
static void Place(DesertDescription description)
Definition
SandMound.cs:8
Terraria.GameContent.Biomes.Desert.SandMound
Definition
SandMound.cs:7
Terraria.GameContent.Biomes.Desert.SurfaceMap
Definition
SurfaceMap.cs:6
Terraria.Main.tile
static Tile[,] tile
Definition
Main.cs:1675
Terraria.Main
Definition
Main.cs:79
Terraria.Tile.active
bool active()
Definition
Tile.cs:565
Terraria.Tile.slope
byte slope()
Definition
Tile.cs:684
Terraria.Tile.halfBrick
bool halfBrick()
Definition
Tile.cs:650
Terraria.Tile
Definition
Tile.cs:7
Terraria.Utils.UnclampedSmoothStep
static float UnclampedSmoothStep(float min, float max, float x)
Definition
Utils.cs:93
Terraria.Utils
Definition
Utils.cs:29
Terraria.WorldGen.remixWorldGen
static bool remixWorldGen
Definition
WorldGen.cs:1148
Terraria.WorldGen.genRand
static UnifiedRandom genRand
Definition
WorldGen.cs:1215
Terraria.WorldGen.SquareWallFrame
static void SquareWallFrame(int i, int j, bool resetFrame=true)
Definition
WorldGen.cs:70375
Terraria.WorldGen
Definition
WorldGen.cs:32
Microsoft.Xna.Framework
Definition
AlphaTestEffect.cs:1
System.ExceptionArgument.value
@ value
System
Definition
BlockingCollection.cs:8
Terraria.GameContent.Biomes.Desert
Definition
AnthillEntrance.cs:5
Microsoft.Xna.Framework.Rectangle.Height
int Height
Definition
Rectangle.cs:23
Microsoft.Xna.Framework.Rectangle.X
int X
Definition
Rectangle.cs:14
Microsoft.Xna.Framework.Rectangle.Bottom
int Bottom
Definition
Rectangle.cs:33
Microsoft.Xna.Framework.Rectangle.Width
int Width
Definition
Rectangle.cs:20
Microsoft.Xna.Framework.Rectangle
Definition
Rectangle.cs:12
source
Terraria.GameContent.Biomes.Desert
SandMound.cs
Generated by
1.10.0