Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DesertBiome.cs
Go to the documentation of this file.
2using Newtonsoft.Json;
5
7
8public class DesertBiome : MicroBiome
9{
10 [JsonProperty("ChanceOfEntrance")]
11 public double ChanceOfEntrance = 0.3333;
12
13 public override bool Place(Point origin, StructureMap structures)
14 {
16 if (!desertDescription.IsValid)
17 {
18 return false;
19 }
20 ExportDescriptionToEngine(desertDescription);
21 SandMound.Place(desertDescription);
22 desertDescription.UpdateSurfaceMap();
24 {
25 switch (GenBase._random.Next(4))
26 {
27 case 0:
28 ChambersEntrance.Place(desertDescription);
29 break;
30 case 1:
31 AnthillEntrance.Place(desertDescription);
32 break;
33 case 2:
34 LarvaHoleEntrance.Place(desertDescription);
35 break;
36 case 3:
37 PitEntrance.Place(desertDescription);
38 break;
39 }
40 }
41 DesertHive.Place(desertDescription);
42 CleanupArea(desertDescription.Hive);
43 Rectangle area = new Rectangle(desertDescription.CombinedArea.X, 50, desertDescription.CombinedArea.Width, desertDescription.CombinedArea.Bottom - 20);
44 structures.AddStructure(area, 10);
45 return true;
46 }
47
48 private static void ExportDescriptionToEngine(DesertDescription description)
49 {
50 GenVars.UndergroundDesertLocation = description.CombinedArea;
51 GenVars.UndergroundDesertLocation.Inflate(10, 10);
52 GenVars.UndergroundDesertHiveLocation = description.Hive;
53 }
54
55 private static void CleanupArea(Rectangle area)
56 {
57 for (int i = -20 + area.Left; i < area.Right + 20; i++)
58 {
59 for (int j = -20 + area.Top; j < area.Bottom + 20; j++)
60 {
61 if (i > 0 && i < Main.maxTilesX - 1 && j > 0 && j < Main.maxTilesY - 1)
62 {
64 WorldUtils.TileFrame(i, j, frameNeighbors: true);
65 }
66 }
67 }
68 }
69}
static void ExportDescriptionToEngine(DesertDescription description)
static void CleanupArea(Rectangle area)
override bool Place(Point origin, StructureMap structures)
static void Place(DesertDescription description)
static void Place(DesertDescription description)
static DesertDescription CreateFromPlacement(Point origin)
static void Place(DesertDescription description)
static void Place(DesertDescription description)
static void Place(DesertDescription description)
Definition PitEntrance.cs:8
static void Place(DesertDescription description)
Definition SandMound.cs:8
static int maxTilesY
Definition Main.cs:1116
static bool tenthAnniversaryWorld
Definition Main.cs:343
static UnifiedRandom _random
Definition GenBase.cs:9
static Rectangle UndergroundDesertLocation
Definition GenVars.cs:110
void AddStructure(Rectangle area, int padding=0)
static void TileFrame(int x, int y, bool frameNeighbors=false)
Definition WorldUtils.cs:61
static void SquareWallFrame(int i, int j, bool resetFrame=true)