Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CaveHouseBiome.cs
Go to the documentation of this file.
2using Newtonsoft.Json;
4using Terraria.ID;
6
8
10{
12
13 [JsonProperty]
14 public double IceChestChance { get; set; }
15
16 [JsonProperty]
17 public double JungleChestChance { get; set; }
18
19 [JsonProperty]
20 public double GoldChestChance { get; set; }
21
22 [JsonProperty]
23 public double GraniteChestChance { get; set; }
24
25 [JsonProperty]
26 public double MarbleChestChance { get; set; }
27
28 [JsonProperty]
29 public double MushroomChestChance { get; set; }
30
31 [JsonProperty]
32 public double DesertChestChance { get; set; }
33
34 public override bool Place(Point origin, StructureMap structures)
35 {
36 if (!WorldGen.InWorld(origin.X, origin.Y, 10))
37 {
38 return false;
39 }
40 int num = 25;
41 for (int i = origin.X - num; i <= origin.X + num; i++)
42 {
43 for (int j = origin.Y - num; j <= origin.Y + num; j++)
44 {
45 if (Main.tile[i, j].wire())
46 {
47 return false;
48 }
49 if (TileID.Sets.BasicChest[Main.tile[i, j].type])
50 {
51 return false;
52 }
53 }
54 }
55 HouseBuilder houseBuilder = HouseUtils.CreateBuilder(origin, structures);
56 if (!houseBuilder.IsValid)
57 {
58 return false;
59 }
60 ApplyConfigurationToBuilder(houseBuilder);
61 houseBuilder.Place(_builderContext, structures);
62 return true;
63 }
64
66 {
67 switch (builder.Type)
68 {
69 case HouseType.Desert:
70 builder.ChestChance = DesertChestChance;
71 break;
72 case HouseType.Granite:
73 builder.ChestChance = GraniteChestChance;
74 break;
75 case HouseType.Ice:
76 builder.ChestChance = IceChestChance;
77 break;
78 case HouseType.Jungle:
79 builder.ChestChance = JungleChestChance;
80 break;
81 case HouseType.Marble:
82 builder.ChestChance = MarbleChestChance;
83 break;
84 case HouseType.Mushroom:
85 builder.ChestChance = MushroomChestChance;
86 break;
87 case HouseType.Wood:
88 builder.ChestChance = GoldChestChance;
89 break;
90 }
91 }
92}
override bool Place(Point origin, StructureMap structures)
void ApplyConfigurationToBuilder(HouseBuilder builder)
readonly HouseBuilderContext _builderContext
virtual void Place(HouseBuilderContext context, StructureMap structures)
static HouseBuilder CreateBuilder(Point origin, StructureMap structures)
Definition HouseUtils.cs:15
static bool[] BasicChest
Definition TileID.cs:223
static Tile[,] tile
Definition Main.cs:1675
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:5816