-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCelebriumSoulsGENWORLD.cs
39 lines (35 loc) · 1.43 KB
/
CelebriumSoulsGENWORLD.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
using System.Collections.Generic;
using Terraria;
using Terraria.GameContent.Generation;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.World.Generation;
using static Terraria.ModLoader.ModContent;
namespace CelebriumSouls
{
public class CelebriumSoulsGENWORLD : ModWorld
{
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
{
int shiniesIndex = tasks.FindIndex(x => x.Name.Equals("Shinies"));
if (shiniesIndex != -1)
{
tasks.Insert(shiniesIndex + 1, new PassLegacy("CelebriumSouls Ore Generation", OreGeneration));
}
}
private void OreGeneration(GenerationProgress progress)
{
progress.Message = "CelebriumSouls Создаёт руды!";
for (int i = 0; i < (int)((Main.maxTilesX * Main.maxTilesY) * 7E-04); i++)
{
int x = WorldGen.genRand.Next(0, Main.maxTilesX);
int y = WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY);
Tile tile = Framing.GetTileSafely(x, y);
if (tile.active() && (tile.type == TileID.Granite || tile.type == TileID.Marble || tile.type == TileID.Ash))
{
WorldGen.TileRunner(x, y, WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(1, 5), TileType<Tiles.CelebriumOre>());
}
}
}
}
}