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

◆ PlaceBoulderTrapSpot()

void Terraria.GameContent.Biomes.DeadMansChestBiome.PlaceBoulderTrapSpot ( Point position,
int yPush )
inlineprivate

Definition at line 236 of file DeadMansChestBiome.cs.

237 {
238 int[] array = new int[TileID.Count];
239 for (int i = position.X; i < position.X + 2; i++)
240 {
241 for (int j = position.Y - 4; j <= position.Y; j++)
242 {
243 Tile tile = Main.tile[i, j];
244 if (tile.active() && !Main.tileFrameImportant[tile.type] && Main.tileSolid[tile.type])
245 {
246 array[tile.type]++;
247 }
248 if ((tile.active() && !TileID.Sets.CanBeClearedDuringGeneration[tile.type]) || (tile.active() && TileID.Sets.IsAContainer[tile.type]))
249 {
250 return;
251 }
252 }
253 }
254 for (int k = position.X - 1; k < position.X + 2 + 1; k++)
255 {
256 for (int l = position.Y - 4 - 1; l <= position.Y - 4 + 2; l++)
257 {
258 Tile tile2 = Main.tile[k, l];
259 if (!tile2.active() || TileID.Sets.IsAContainer[tile2.type])
260 {
261 return;
262 }
263 }
264 }
265 int num = 2;
266 int num2 = position.X - num;
267 int num3 = position.Y - 4 - num;
268 int num4 = position.X + num + 1;
269 int num5 = position.Y - 4 + num + 1;
270 for (int m = num2; m <= num4; m++)
271 {
272 for (int n = num3; n <= num5; n++)
273 {
274 Tile tile3 = Main.tile[m, n];
275 if (tile3.active() && TileID.Sets.IsAContainer[tile3.type])
276 {
277 return;
278 }
279 }
280 }
281 int num6 = -1;
282 for (int num7 = 0; num7 < array.Length; num7++)
283 {
284 if (num6 == -1 || array[num6] < array[num7])
285 {
286 num6 = num7;
287 }
288 }
289 _boulderPlacementSpots.Add(new BoulderPlacementAttempt(position, yPush - 1, 4, num6));
290 }
void Add(TKey key, TValue value)
List< BoulderPlacementAttempt > _boulderPlacementSpots
static bool[] IsAContainer
Definition TileID.cs:297
static bool[] CanBeClearedDuringGeneration
Definition TileID.cs:229
static readonly ushort Count
Definition TileID.cs:1698

References Terraria.GameContent.Biomes.DeadMansChestBiome._boulderPlacementSpots, Terraria.Tile.active(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), Terraria.ID.TileID.Sets.CanBeClearedDuringGeneration, Terraria.ID.TileID.Count, Terraria.ID.TileID.Sets.IsAContainer, Terraria.Main.tile, Terraria.Main.tileFrameImportant, Terraria.Main.tileSolid, Terraria.Tile.type, Microsoft.Xna.Framework.Point.X, and Microsoft.Xna.Framework.Point.Y.

Referenced by Terraria.GameContent.Biomes.DeadMansChestBiome.FindBoulderTrapSpot().