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

◆ smCallBack()

static void Terraria.WorldGen.smCallBack ( object threadContext)
inlinestatic

Definition at line 23420 of file WorldGen.cs.

23421 {
23422 IsGeneratingHardMode = true;
23424 if (Main.rand == null)
23425 {
23426 Main.rand = new UnifiedRandom((int)DateTime.Now.Ticks);
23427 }
23428 double num = (double)genRand.Next(300, 400) * 0.001;
23429 double num2 = (double)genRand.Next(200, 300) * 0.001;
23430 int num3 = (int)((double)Main.maxTilesX * num);
23431 int num4 = (int)((double)Main.maxTilesX * (1.0 - num));
23432 int num5 = 1;
23433 if (genRand.Next(2) == 0)
23434 {
23435 num4 = (int)((double)Main.maxTilesX * num);
23436 num3 = (int)((double)Main.maxTilesX * (1.0 - num));
23437 num5 = -1;
23438 }
23439 int num6 = 1;
23440 if (GenVars.dungeonX < Main.maxTilesX / 2)
23441 {
23442 num6 = -1;
23443 }
23444 if (num6 < 0)
23445 {
23446 if (num4 < num3)
23447 {
23448 num4 = (int)((double)Main.maxTilesX * num2);
23449 }
23450 else
23451 {
23452 num3 = (int)((double)Main.maxTilesX * num2);
23453 }
23454 }
23455 else if (num4 > num3)
23456 {
23457 num4 = (int)((double)Main.maxTilesX * (1.0 - num2));
23458 }
23459 else
23460 {
23461 num3 = (int)((double)Main.maxTilesX * (1.0 - num2));
23462 }
23463 if (Main.remixWorld)
23464 {
23465 int num7 = Main.maxTilesX / 7;
23466 int num8 = Main.maxTilesX / 14;
23467 if (Main.dungeonX < Main.maxTilesX / 2)
23468 {
23469 for (int i = Main.maxTilesX - num7 - num8; i < Main.maxTilesX; i++)
23470 {
23471 for (int j = (int)Main.worldSurface + genRand.Next(-1, 2); j < Main.maxTilesY - 10; j++)
23472 {
23473 if (i > Main.maxTilesX - num7)
23474 {
23475 Convert(i, j, 2, 1);
23476 }
23477 else if (TileID.Sets.Crimson[Main.tile[i, j].type] || TileID.Sets.Corrupt[Main.tile[i, j].type])
23478 {
23479 Convert(i, j, 2, 1);
23480 }
23481 }
23482 }
23483 }
23484 else
23485 {
23486 for (int k = 0; k < num7 + num8; k++)
23487 {
23488 for (int l = (int)Main.worldSurface + genRand.Next(-1, 2); l < Main.maxTilesY - 10; l++)
23489 {
23490 if (k < num7)
23491 {
23492 Convert(k, l, 2, 1);
23493 }
23494 else if (TileID.Sets.Crimson[Main.tile[k, l].type] || TileID.Sets.Corrupt[Main.tile[k, l].type])
23495 {
23496 Convert(k, l, 2, 1);
23497 }
23498 }
23499 }
23500 }
23501 }
23502 else
23503 {
23504 GERunner(num3, 0, 3 * num5, 5.0);
23505 GERunner(num4, 0, 3 * -num5, 5.0, good: false);
23506 }
23507 double num9 = (double)Main.maxTilesX / 4200.0;
23508 int num10 = (int)(25.0 * num9);
23510 int num11 = 0;
23511 while (num10 > 0)
23512 {
23513 if (++num11 % 15000 == 0)
23514 {
23515 num10--;
23516 }
23517 Point point = RandomWorldPoint((int)Main.worldSurface - 100, 1, 190, 1);
23518 Tile tile = Main.tile[point.X, point.Y];
23519 Tile tile2 = Main.tile[point.X, point.Y - 1];
23520 ushort num12 = 0;
23521 if (TileID.Sets.Crimson[tile.type])
23522 {
23523 num12 = (ushort)(192 + genRand.Next(4));
23524 }
23525 else if (TileID.Sets.Corrupt[tile.type])
23526 {
23527 num12 = (ushort)(188 + genRand.Next(4));
23528 }
23529 else if (TileID.Sets.Hallow[tile.type])
23530 {
23531 num12 = (ushort)(200 + genRand.Next(4));
23532 }
23533 if (tile.active() && num12 != 0 && !tile2.active())
23534 {
23535 bool flag = WorldUtils.Gen(new Point(point.X, point.Y - 1), new ShapeFloodFill(1000), Actions.Chain(new Modifiers.IsNotSolid(), new Modifiers.OnlyWalls(0, 54, 55, 56, 57, 58, 59, 61, 185, 212, 213, 214, 215, 2, 196, 197, 198, 199, 15, 40, 71, 64, 204, 205, 206, 207, 208, 209, 210, 211, 71), new Actions.Blank().Output(shapeData)));
23536 if (shapeData.Count > 50 && flag)
23537 {
23539 num10--;
23540 }
23541 shapeData.Clear();
23542 }
23543 }
23544 if (Main.netMode == 0)
23545 {
23546 Main.NewText(Lang.misc[15].Value, 50, byte.MaxValue, 130);
23547 }
23548 else if (Main.netMode == 2)
23549 {
23550 ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[15].Key), new Color(50, 255, 130));
23551 }
23553 if (Main.netMode == 2)
23554 {
23555 Netplay.ResetSections();
23556 }
23558 IsGeneratingHardMode = false;
23559 }
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:46
static bool[] Crimson
Definition TileID.cs:249
static bool[] Corrupt
Definition TileID.cs:235
static bool[] Hallow
Definition TileID.cs:241
static NetworkText FromKey(string key, params object[] substitutions)
static GenAction Chain(params GenAction[] actions)
Definition Actions.cs:470
GenAction Output(ShapeData data)
Definition GenAction.cs:39
static bool Gen(Point origin, GenShape shape, GenAction action)
Definition WorldUtils.cs:17
static void TryProtectingSpawnedItems()
static void UndoSpawnedItemProtection()
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void GERunner(int i, int j, double speedX=0.0, double speedY=0.0, bool good=true)
static void Convert(int i, int j, int conversionType, int size=4)
static void PlaceWall(int i, int j, int type, bool mute=false)
static Point RandomWorldPoint(int padding)
static bool IsGeneratingHardMode
Definition WorldGen.cs:964
static DateTime Now
Definition DateTime.cs:103

References Terraria.Tile.active(), Terraria.Chat.ChatHelper.BroadcastChatMessage(), Terraria.WorldBuilding.Actions.Chain(), System.Collections.Generic.Dictionary< TKey, TValue >.Clear(), Terraria.ID.TileID.Sets.Corrupt, System.Collections.Generic.Dictionary< TKey, TValue >.Count, Terraria.ID.TileID.Sets.Crimson, Terraria.WorldBuilding.GenVars.dungeonX, Terraria.Main.dungeonX, Terraria.Localization.NetworkText.FromKey(), Terraria.WorldBuilding.WorldUtils.Gen(), Terraria.ID.TileID.Sets.Hallow, Terraria.Main.maxTilesX, Terraria.Lang.misc, Terraria.Main.netMode, Terraria.Main.NewText(), Terraria.GameContent.Achievements.AchievementsHelper.NotifyProgressionEvent(), System.DateTime.Now, Terraria.WorldBuilding.GenAction.Output(), Terraria.Main.rand, Terraria.Main.remixWorld, Terraria.Netplay.ResetSections(), Terraria.Main.tile, Terraria.Tile.type, Terraria.Main.worldSurface, Microsoft.Xna.Framework.Point.X, and Microsoft.Xna.Framework.Point.Y.