-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlankWorldGen.cs
69 lines (64 loc) · 2.48 KB
/
BlankWorldGen.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Terraria;
using Terraria.ID;
using Terraria.GameContent.Generation;
using Terraria.IO;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.WorldBuilding;
using Terraria.GameContent;
namespace SkyblockBrutalism
{
public class BlankWorldGen : ModSystem
{
public static LocalizedText MakeSkyblock { get; private set; }
public override void SetStaticDefaults()
{
MakeSkyblock = Language.GetOrRegister(Mod.GetLocalizationKey($"BlankWorldGen.{nameof(MakeSkyblock)}"));
}
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref double totalWeight)
{
if (ModContent.GetInstance<Config>().SkyblockWorldGen)
{
tasks.Clear();
int resetIndex = tasks.FindIndex((GenPass genpass) => genpass.Name.Equals("Reset"));
tasks.Insert(resetIndex + 1, new PassLegacy("Adding Skyblocks", new WorldGenLegacyMethod(this.AddSkyblocksPass), 1.0));
}
}
private void AddSkyblocksPass(GenerationProgress progress, GameConfiguration config)
{
progress.Message = MakeSkyblock.Value;
progress.Set(0.0);
Main.spawnTileX = Main.maxTilesX / 2;
Main.spawnTileY = Main.maxTilesY / 4 - 40;
Main.dungeonX = Main.maxTilesX / 2;
Main.dungeonY = Main.maxTilesY / 4 - 80;
Main.worldSurface = Main.maxTilesY / 4;
if (Main.remixWorld)
{
Main.rockLayer = Main.maxTilesY * 0.6;
}
else
{
Main.rockLayer = Main.maxTilesY / 2.5;
}
int isleSpread = Main.maxTilesX / 6;
for (int i = Main.spawnTileX; i < Main.maxTilesX-10; i += isleSpread)
{
WorldGen.PlaceTile(i, Main.spawnTileY, ModContent.TileType<Tiles.Skyblock>());
}
for (int i = Main.spawnTileX - isleSpread; i > 10; i -= isleSpread)
{
WorldGen.PlaceTile(i, Main.spawnTileY, ModContent.TileType<Tiles.Skyblock>());
}
progress.Set(0.75);
WorldGen.PlaceTile(Main.dungeonX, Main.dungeonY, TileID.CrackedBlueDungeonBrick);
WorldGen.PlaceWall(Main.dungeonX, Main.dungeonY, WallID.BlueDungeonUnsafe);
Thread.Sleep(1000);
progress.Set(1.0);
}
}
}