-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBombusWorld.cs
48 lines (48 loc) · 2.23 KB
/
BombusWorld.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
namespace BombusApisBee
{
public class BombusWorld : ModSystem
{
public override void PostWorldGen()
{
// gold chest gen
int itemsToPlaceInGoldChests = ModContent.ItemType<EnchantedApiary>();
for (int chestIndex = 0; chestIndex < 1000; chestIndex++)
{
Chest chest = Main.chest[chestIndex];
if (chest != null && Main.tile[chest.x, chest.y].TileType == TileID.Containers && (Main.tile[chest.x, chest.y].TileFrameX == 1 * 36 || Main.tile[chest.x, chest.y].TileFrameX == 8 * 36 || Main.tile[chest.x, chest.y].TileFrameX == 32 * 36 || Main.tile[chest.x, chest.y].TileFrameX == 51 * 36 || Main.tile[chest.x, chest.y].TileFrameX == 50 * 36))
{
for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++)
{
if (inventoryIndex == 0)
{
if (chest.item[inventoryIndex].type == ItemID.FlareGun)
{
if (WorldGen.genRand.NextFloat() < 0.25f)
{
chest.item[0].TurnToAir();
chest.item[1].TurnToAir();
chest.item[0].SetDefaults(itemsToPlaceInGoldChests);
chest.item[0].Prefix(-1);
for (int i = 1; i < 39; i++)
{
chest.item[i] = chest.item[i + 1];
}
}
break;
}
else
{
if (WorldGen.genRand.NextFloat() < 0.25f)
{
chest.item[0].SetDefaults(itemsToPlaceInGoldChests);
chest.item[0].Prefix(-1);
}
break;
}
}
}
}
}
}
}
}