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

◆ GenerateWorld()

static void Terraria.WorldGen.GenerateWorld ( int seed,
GenerationProgress customProgressObject = null )
inlinestatic

Definition at line 7813 of file WorldGen.cs.

7814 {
7815 Stopwatch generationStopwatch = Stopwatch.StartNew();
7818 drunkWorldGen = false;
7819 drunkWorldGenText = false;
7820 Main.afterPartyOfDoom = false;
7821 if (seed == 5162020 || everythingWorldGen)
7822 {
7823 drunkWorldGen = true;
7824 drunkWorldGenText = true;
7825 Main.drunkWorld = true;
7826 Main.rand = new UnifiedRandom();
7827 seed = Main.rand.Next(999999999);
7828 if (!Main.dayTime)
7829 {
7830 Main.time = 0.0;
7831 }
7832 }
7833 else if (seed == 5162021 || seed == 5162011)
7834 {
7836 }
7837 Main.notTheBeesWorld = notTheBees;
7838 if (notTheBees)
7839 {
7840 Main.rand = new UnifiedRandom();
7841 seed = Main.rand.Next(999999999);
7842 }
7843 Main.noTrapsWorld = noTrapsWorldGen;
7844 if (noTrapsWorldGen)
7845 {
7846 Main.rand = new UnifiedRandom();
7847 seed = Main.rand.Next(999999999);
7848 }
7849 if (getGoodWorldGen)
7850 {
7851 Main.getGoodWorld = true;
7852 Main.rand = new UnifiedRandom();
7853 seed = Main.rand.Next(999999999);
7854 }
7855 else
7856 {
7857 Main.getGoodWorld = false;
7858 }
7859 Main.tenthAnniversaryWorld = tenthAnniversaryWorldGen;
7861 {
7862 Main.rand = new UnifiedRandom();
7863 seed = Main.rand.Next(999999999);
7864 }
7865 Main.dontStarveWorld = dontStarveWorldGen;
7867 {
7868 Main.rand = new UnifiedRandom();
7869 seed = Main.rand.Next(999999999);
7870 }
7871 Main.remixWorld = remixWorldGen;
7872 if (remixWorldGen)
7873 {
7874 Main.rand = new UnifiedRandom();
7875 seed = Main.rand.Next(999999999);
7876 }
7877 Main.zenithWorld = everythingWorldGen;
7878 Utils.LogAndConsoleInfoMessageFormat("Creating world - Seed: {0}, Width: {1}, Height: {2}, Evil: {3}, IsExpert: {4}", seed, Main.maxTilesX, Main.maxTilesY, WorldGenParam_Evil, Main.expertMode);
7879 Main.lockMenuBGChange = true;
7880 GenVars.configuration = WorldGenConfiguration.FromEmbeddedPath("Terraria.GameContent.WorldBuilding.Configuration.json");
7881 Hooks.ProcessWorldGenConfig(ref GenVars.configuration);
7882 Logging.Terraria.InfoFormat("Generating World: {0}", (object)Main.ActiveWorldFileData.Name);
7883 _lastSeed = seed;
7886 Main.rand = new UnifiedRandom(seed);
7887 GenVars.structures = new StructureMap();
7888 GenVars.desertHiveHigh = Main.maxTilesY;
7889 GenVars.desertHiveLow = 0;
7890 GenVars.desertHiveLeft = Main.maxTilesX;
7891 GenVars.desertHiveRight = 0;
7892 GenVars.worldSurfaceLow = 0.0;
7893 GenVars.worldSurface = 0.0;
7894 GenVars.worldSurfaceHigh = 0.0;
7895 GenVars.rockLayerLow = 0.0;
7896 GenVars.rockLayer = 0.0;
7897 GenVars.rockLayerHigh = 0.0;
7898 GenVars.copper = 7;
7899 GenVars.iron = 6;
7900 GenVars.silver = 9;
7901 GenVars.gold = 8;
7902 GenVars.dungeonSide = 0;
7903 GenVars.jungleHut = (ushort)genRand.Next(5);
7904 GenVars.shellStartXLeft = 0;
7905 GenVars.shellStartYLeft = 0;
7906 GenVars.shellStartXRight = 0;
7907 GenVars.shellStartYRight = 0;
7908 GenVars.PyrX = null;
7909 GenVars.PyrY = null;
7910 GenVars.numPyr = 0;
7911 GenVars.jungleMinX = -1;
7912 GenVars.jungleMaxX = -1;
7913 GenVars.snowMinX = new int[Main.maxTilesY];
7914 GenVars.snowMaxX = new int[Main.maxTilesY];
7915 GenVars.snowTop = 0;
7916 GenVars.snowBottom = 0;
7917 GenVars.skyLakes = 1;
7918 if (Main.maxTilesX > 8000)
7919 {
7920 GenVars.skyLakes++;
7921 }
7922 if (Main.maxTilesX > 6000)
7923 {
7924 GenVars.skyLakes++;
7925 }
7926 GenVars.beachBordersWidth = 275;
7927 GenVars.beachSandRandomCenter = GenVars.beachBordersWidth + 5 + 40;
7928 GenVars.beachSandRandomWidthRange = 20;
7929 GenVars.beachSandDungeonExtraWidth = 40;
7930 GenVars.beachSandJungleExtraWidth = 20;
7931 GenVars.oceanWaterStartRandomMin = 220;
7932 GenVars.oceanWaterStartRandomMax = GenVars.oceanWaterStartRandomMin + 40;
7933 GenVars.oceanWaterForcedJungleLength = 275;
7934 GenVars.leftBeachEnd = 0;
7935 GenVars.rightBeachStart = 0;
7936 GenVars.evilBiomeBeachAvoidance = GenVars.beachSandRandomCenter + 60;
7937 GenVars.evilBiomeAvoidanceMidFixer = 50;
7938 GenVars.lakesBeachAvoidance = GenVars.beachSandRandomCenter + 20;
7939 GenVars.smallHolesBeachAvoidance = GenVars.beachSandRandomCenter + 20;
7940 GenVars.surfaceCavesBeachAvoidance = GenVars.beachSandRandomCenter + 20;
7941 GenVars.surfaceCavesBeachAvoidance2 = GenVars.beachSandRandomCenter + 20;
7942 GenVars.jungleOriginX = 0;
7943 GenVars.snowOriginLeft = 0;
7944 GenVars.snowOriginRight = 0;
7945 GenVars.logX = -1;
7946 GenVars.logY = -1;
7947 GenVars.dungeonLocation = 0;
7950 {
7951 Main.starGame = true;
7952 }
7955 }
This is where all T:Terraria.ModLoader.ModSystem hooks are gathered and called.
static WorldGenConfiguration configuration
Definition GenVars.cs:10
static WorldGenConfiguration FromEmbeddedPath(string path)
static bool tempRemixWorldGen
Definition WorldGen.cs:1384
static int _lastSeed
Definition WorldGen.cs:1254
static int WorldGenParam_Evil
Definition WorldGen.cs:1330
static bool remixWorldGen
Definition WorldGen.cs:1386
static void AddGenPassesFromLoadTime()
static bool everythingWorldGen
Definition WorldGen.cs:1388
static bool noTrapsWorldGen
Definition WorldGen.cs:1390
static bool tenthAnniversaryWorldGen
Definition WorldGen.cs:1398
static UnifiedRandom genRand
Definition WorldGen.cs:1455
static bool tempTenthAnniversaryWorldGen
Definition WorldGen.cs:1396
static bool dontStarveWorldGen
Definition WorldGen.cs:1400
static bool drunkWorldGenText
Definition WorldGen.cs:1404
static void GenerateWorld_RunTasksAndFinish(int seed, Stopwatch generationStopwatch, GenerationProgress customProgressObject)
static UnifiedRandom _genRand
Definition WorldGen.cs:1249
static WorldGenerator _generator
Definition WorldGen.cs:1378
static bool drunkWorldGen
Definition WorldGen.cs:1392
static bool notTheBees
Definition WorldGen.cs:1402
static bool getGoodWorldGen
Definition WorldGen.cs:1394

References Terraria.WorldGen._generator, Terraria.WorldGen._genRand, Terraria.WorldGen._lastSeed, Terraria.Main.ActiveWorldFileData, Terraria.WorldGen.AddGenPassesFromLoadTime(), Terraria.WorldBuilding.GenVars.configuration, Terraria.Main.dayTime, Terraria.WorldGen.dontStarveWorldGen, Terraria.WorldGen.drunkWorldGen, Terraria.WorldGen.drunkWorldGenText, Terraria.WorldGen.everythingWorldGen, Terraria.Main.expertMode, Terraria.WorldBuilding.WorldGenConfiguration.FromEmbeddedPath(), Terraria.WorldGen.GenerateWorld_RunTasksAndFinish(), Terraria.WorldGen.genRand, Terraria.WorldGen.getGoodWorldGen, Terraria.Utils.LogAndConsoleInfoMessageFormat(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.WorldGen.noTrapsWorldGen, Terraria.WorldGen.notTheBees, Terraria.ModLoader.SystemLoader.PreWorldGen(), Terraria.WorldGen.Hooks.ProcessWorldGenConfig(), Terraria.Main.rand, Terraria.WorldGen.remixWorldGen, Terraria.WorldBuilding.GenVars.skyLakes, Terraria.WorldGen.tempRemixWorldGen, Terraria.WorldGen.tempTenthAnniversaryWorldGen, Terraria.WorldGen.tenthAnniversaryWorldGen, Terraria.ModLoader.Logging.Terraria, and Terraria.WorldGen.WorldGenParam_Evil.

Referenced by Terraria.WorldBuilding.WorldUtils.DebugRegen(), Terraria.WorldGen.do_worldGenCallBack(), Terraria.Main.Initialize_AlmostEverything(), and Terraria.IO.WorldFile.LoadWorld().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: