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

◆ TileRunner()

static void Terraria.WorldGen.TileRunner ( int i,
int j,
double strength,
int steps,
int type,
bool addTile = false,
double speedX = 0::0,
double speedY = 0::0,
bool noYChange = false,
bool overRide = true,
int ignoreTileType = -1 )
inlinestatic

Definition at line 66759 of file WorldGen.cs.

66760 {
66761 //IL_01f3: Unknown result type (might be due to invalid IL or missing references)
66762 //IL_0239: Unknown result type (might be due to invalid IL or missing references)
66763 //IL_024e: Unknown result type (might be due to invalid IL or missing references)
66764 //IL_0264: Unknown result type (might be due to invalid IL or missing references)
66765 //IL_0279: Unknown result type (might be due to invalid IL or missing references)
66766 //IL_0958: Unknown result type (might be due to invalid IL or missing references)
66767 //IL_0959: Unknown result type (might be due to invalid IL or missing references)
66768 //IL_095a: Unknown result type (might be due to invalid IL or missing references)
66769 //IL_095f: Unknown result type (might be due to invalid IL or missing references)
66770 //IL_0987: Unknown result type (might be due to invalid IL or missing references)
66771 //IL_0988: Unknown result type (might be due to invalid IL or missing references)
66772 //IL_0989: Unknown result type (might be due to invalid IL or missing references)
66773 //IL_098e: Unknown result type (might be due to invalid IL or missing references)
66774 //IL_0eeb: Unknown result type (might be due to invalid IL or missing references)
66775 //IL_09f5: Unknown result type (might be due to invalid IL or missing references)
66776 //IL_09f6: Unknown result type (might be due to invalid IL or missing references)
66777 //IL_09f7: Unknown result type (might be due to invalid IL or missing references)
66778 //IL_09fc: Unknown result type (might be due to invalid IL or missing references)
66779 //IL_0f0c: Unknown result type (might be due to invalid IL or missing references)
66780 //IL_0a63: Unknown result type (might be due to invalid IL or missing references)
66781 //IL_0a64: Unknown result type (might be due to invalid IL or missing references)
66782 //IL_0a65: Unknown result type (might be due to invalid IL or missing references)
66783 //IL_0a6a: Unknown result type (might be due to invalid IL or missing references)
66784 //IL_0ad1: Unknown result type (might be due to invalid IL or missing references)
66785 //IL_0ad2: Unknown result type (might be due to invalid IL or missing references)
66786 //IL_0ad3: Unknown result type (might be due to invalid IL or missing references)
66787 //IL_0ad8: Unknown result type (might be due to invalid IL or missing references)
66788 //IL_034a: Unknown result type (might be due to invalid IL or missing references)
66789 //IL_0359: Unknown result type (might be due to invalid IL or missing references)
66790 //IL_0f55: Unknown result type (might be due to invalid IL or missing references)
66791 //IL_0b3f: Unknown result type (might be due to invalid IL or missing references)
66792 //IL_0b40: Unknown result type (might be due to invalid IL or missing references)
66793 //IL_0b41: Unknown result type (might be due to invalid IL or missing references)
66794 //IL_0b46: Unknown result type (might be due to invalid IL or missing references)
66795 //IL_0f76: Unknown result type (might be due to invalid IL or missing references)
66796 //IL_0bad: Unknown result type (might be due to invalid IL or missing references)
66797 //IL_0bae: Unknown result type (might be due to invalid IL or missing references)
66798 //IL_0baf: Unknown result type (might be due to invalid IL or missing references)
66799 //IL_0bb4: Unknown result type (might be due to invalid IL or missing references)
66800 //IL_0fac: Unknown result type (might be due to invalid IL or missing references)
66801 //IL_0c1b: Unknown result type (might be due to invalid IL or missing references)
66802 //IL_0c1c: Unknown result type (might be due to invalid IL or missing references)
66803 //IL_0c1d: Unknown result type (might be due to invalid IL or missing references)
66804 //IL_0c22: Unknown result type (might be due to invalid IL or missing references)
66805 //IL_0ffe: Unknown result type (might be due to invalid IL or missing references)
66806 //IL_0fcd: Unknown result type (might be due to invalid IL or missing references)
66807 //IL_0c89: Unknown result type (might be due to invalid IL or missing references)
66808 //IL_0c8a: Unknown result type (might be due to invalid IL or missing references)
66809 //IL_0c8b: Unknown result type (might be due to invalid IL or missing references)
66810 //IL_0c90: Unknown result type (might be due to invalid IL or missing references)
66811 //IL_0657: Unknown result type (might be due to invalid IL or missing references)
66812 //IL_0666: Unknown result type (might be due to invalid IL or missing references)
66813 //IL_101f: Unknown result type (might be due to invalid IL or missing references)
66814 //IL_0cf7: Unknown result type (might be due to invalid IL or missing references)
66815 //IL_0cf8: Unknown result type (might be due to invalid IL or missing references)
66816 //IL_0cf9: Unknown result type (might be due to invalid IL or missing references)
66817 //IL_0cfe: Unknown result type (might be due to invalid IL or missing references)
66818 //IL_06ba: Unknown result type (might be due to invalid IL or missing references)
66819 //IL_06c9: Unknown result type (might be due to invalid IL or missing references)
66820 //IL_03ed: Unknown result type (might be due to invalid IL or missing references)
66821 //IL_03fc: Unknown result type (might be due to invalid IL or missing references)
66822 //IL_1040: Unknown result type (might be due to invalid IL or missing references)
66823 //IL_0d65: Unknown result type (might be due to invalid IL or missing references)
66824 //IL_0d66: Unknown result type (might be due to invalid IL or missing references)
66825 //IL_0d67: Unknown result type (might be due to invalid IL or missing references)
66826 //IL_0d6c: Unknown result type (might be due to invalid IL or missing references)
66827 //IL_1067: Unknown result type (might be due to invalid IL or missing references)
66828 //IL_0dd3: Unknown result type (might be due to invalid IL or missing references)
66829 //IL_0dd4: Unknown result type (might be due to invalid IL or missing references)
66830 //IL_0dd5: Unknown result type (might be due to invalid IL or missing references)
66831 //IL_0dda: Unknown result type (might be due to invalid IL or missing references)
66832 //IL_0e3e: Unknown result type (might be due to invalid IL or missing references)
66833 //IL_0e3f: Unknown result type (might be due to invalid IL or missing references)
66834 //IL_0e40: Unknown result type (might be due to invalid IL or missing references)
66835 //IL_0e45: Unknown result type (might be due to invalid IL or missing references)
66836 if (!GenVars.mudWall)
66837 {
66838 if (drunkWorldGen)
66839 {
66840 strength *= 1.0 + (double)genRand.Next(-80, 81) * 0.01;
66841 steps = (int)((double)steps * (1.0 + (double)genRand.Next(-80, 81) * 0.01));
66842 }
66843 else if (remixWorldGen)
66844 {
66845 strength *= 1.0 + (double)genRand.Next(-50, 51) * 0.01;
66846 }
66847 else if (getGoodWorldGen && type != 57)
66848 {
66849 strength *= 1.0 + (double)genRand.Next(-80, 81) * 0.015;
66850 steps += genRand.Next(3);
66851 }
66852 }
66853 double num = strength;
66854 double num2 = steps;
66855 Vector2D val = default(Vector2D);
66856 val.X = i;
66857 val.Y = j;
66858 Vector2D val2 = default(Vector2D);
66859 val2.X = (double)genRand.Next(-10, 11) * 0.1;
66860 val2.Y = (double)genRand.Next(-10, 11) * 0.1;
66861 if (speedX != 0.0 || speedY != 0.0)
66862 {
66863 val2.X = speedX;
66864 val2.Y = speedY;
66865 }
66866 bool flag = type == 368;
66867 bool flag2 = type == 367;
66868 bool lava = false;
66869 if (getGoodWorldGen && genRand.Next(4) == 0)
66870 {
66871 lava = true;
66872 }
66873 while (num > 0.0 && num2 > 0.0)
66874 {
66875 if (drunkWorldGen && genRand.Next(30) == 0)
66876 {
66877 val.X += (double)genRand.Next(-100, 101) * 0.05;
66878 val.Y += (double)genRand.Next(-100, 101) * 0.05;
66879 }
66880 if (val.Y < 0.0 && num2 > 0.0 && type == 59)
66881 {
66882 num2 = 0.0;
66883 }
66884 num = strength * (num2 / (double)steps);
66885 num2 -= 1.0;
66886 int num3 = (int)(val.X - num * 0.5);
66887 int num4 = (int)(val.X + num * 0.5);
66888 int num5 = (int)(val.Y - num * 0.5);
66889 int num6 = (int)(val.Y + num * 0.5);
66890 if (num3 < 1)
66891 {
66892 num3 = 1;
66893 }
66894 if (num4 > Main.maxTilesX - 1)
66895 {
66896 num4 = Main.maxTilesX - 1;
66897 }
66898 if (num5 < 1)
66899 {
66900 num5 = 1;
66901 }
66902 if (num6 > Main.maxTilesY - 1)
66903 {
66904 num6 = Main.maxTilesY - 1;
66905 }
66906 for (int k = num3; k < num4; k++)
66907 {
66908 if (k < beachDistance + 50 || k >= Main.maxTilesX - beachDistance - 50)
66909 {
66910 lava = false;
66911 }
66912 for (int l = num5; l < num6; l++)
66913 {
66914 if ((drunkWorldGen && l < Main.maxTilesY - 300 && type == 57) || (ignoreTileType >= 0 && Main.tile[k, l].active() && Main.tile[k, l].type == ignoreTileType) || !(Math.Abs((double)k - val.X) + Math.Abs((double)l - val.Y) < strength * 0.5 * (1.0 + (double)genRand.Next(-10, 11) * 0.015)))
66915 {
66916 continue;
66917 }
66918 if (GenVars.mudWall && (double)l > Main.worldSurface && Main.tile[k, l - 1].wall != 2 && l < Main.maxTilesY - 210 - genRand.Next(3) && Math.Abs((double)k - val.X) + Math.Abs((double)l - val.Y) < strength * 0.45 * (1.0 + (double)genRand.Next(-10, 11) * 0.01))
66919 {
66920 if (l > GenVars.lavaLine - genRand.Next(0, 4) - 50)
66921 {
66922 if (Main.tile[k, l - 1].wall != 64 && Main.tile[k, l + 1].wall != 64 && Main.tile[k - 1, l].wall != 64 && Main.tile[k + 1, l].wall != 64)
66923 {
66924 PlaceWall(k, l, 15, mute: true);
66925 }
66926 }
66927 else if (Main.tile[k, l - 1].wall != 15 && Main.tile[k, l + 1].wall != 15 && Main.tile[k - 1, l].wall != 15 && Main.tile[k + 1, l].wall != 15)
66928 {
66929 PlaceWall(k, l, 64, mute: true);
66930 }
66931 }
66932 if (type < 0)
66933 {
66934 if (Main.tile[k, l].type == 53)
66935 {
66936 continue;
66937 }
66938 if (type == -2 && Main.tile[k, l].active() && (l < GenVars.waterLine || l > GenVars.lavaLine))
66939 {
66940 Main.tile[k, l].liquid = byte.MaxValue;
66941 Main.tile[k, l].lava(lava);
66942 if (remixWorldGen)
66943 {
66944 if (l > GenVars.lavaLine && ((double)l < Main.rockLayer - 80.0 || l > Main.maxTilesY - 350) && !oceanDepths(k, l))
66945 {
66946 Main.tile[k, l].lava(lava: true);
66947 }
66948 }
66949 else if (l > GenVars.lavaLine)
66950 {
66951 Main.tile[k, l].lava(lava: true);
66952 }
66953 }
66954 Main.tile[k, l].active(active: false);
66955 continue;
66956 }
66957 if (flag && Math.Abs((double)k - val.X) + Math.Abs((double)l - val.Y) < strength * 0.3 * (1.0 + (double)genRand.Next(-10, 11) * 0.01))
66958 {
66959 PlaceWall(k, l, 180, mute: true);
66960 }
66961 if (flag2 && Math.Abs((double)k - val.X) + Math.Abs((double)l - val.Y) < strength * 0.3 * (1.0 + (double)genRand.Next(-10, 11) * 0.01))
66962 {
66963 PlaceWall(k, l, 178, mute: true);
66964 }
66965 if (overRide || !Main.tile[k, l].active())
66966 {
66967 Tile tile = Main.tile[k, l];
66968 bool flag3 = false;
66969 flag3 = Main.tileStone[type] && tile.type != 1;
66971 {
66972 flag3 = true;
66973 }
66974 switch (tile.type)
66975 {
66976 case 53:
66977 if (type == 59 && GenVars.UndergroundDesertLocation.Contains(k, l))
66978 {
66979 flag3 = true;
66980 }
66981 if (type == 40)
66982 {
66983 flag3 = true;
66984 }
66985 if ((double)l < Main.worldSurface && type != 59)
66986 {
66987 flag3 = true;
66988 }
66989 break;
66990 case 45:
66991 case 147:
66992 case 189:
66993 case 190:
66994 case 196:
66995 case 460:
66996 flag3 = true;
66997 break;
66998 case 396:
66999 case 397:
67000 flag3 = !TileID.Sets.Ore[type];
67001 break;
67002 case 1:
67003 if (type == 59 && (double)l < Main.worldSurface + (double)genRand.Next(-50, 50))
67004 {
67005 flag3 = true;
67006 }
67007 break;
67008 case 367:
67009 case 368:
67010 if (type == 59)
67011 {
67012 flag3 = true;
67013 }
67014 break;
67015 }
67016 if (!flag3)
67017 {
67018 tile.type = (ushort)type;
67019 }
67020 }
67021 if (addTile)
67022 {
67023 Main.tile[k, l].active(active: true);
67024 Main.tile[k, l].liquid = 0;
67025 Main.tile[k, l].lava(lava: false);
67026 }
67027 if (noYChange && (double)l < Main.worldSurface && type != 59)
67028 {
67029 Main.tile[k, l].wall = 2;
67030 }
67031 if (type == 59 && l > GenVars.waterLine && Main.tile[k, l].liquid > 0)
67032 {
67033 Main.tile[k, l].lava(lava: false);
67034 Main.tile[k, l].liquid = 0;
67035 }
67036 }
67037 }
67038 val += val2;
67039 if ((!drunkWorldGen || genRand.Next(3) != 0) && num > 50.0)
67040 {
67041 val += val2;
67042 num2 -= 1.0;
67043 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67044 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67045 if (num > 100.0)
67046 {
67047 val += val2;
67048 num2 -= 1.0;
67049 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67050 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67051 if (num > 150.0)
67052 {
67053 val += val2;
67054 num2 -= 1.0;
67055 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67056 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67057 if (num > 200.0)
67058 {
67059 val += val2;
67060 num2 -= 1.0;
67061 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67062 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67063 if (num > 250.0)
67064 {
67065 val += val2;
67066 num2 -= 1.0;
67067 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67068 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67069 if (num > 300.0)
67070 {
67071 val += val2;
67072 num2 -= 1.0;
67073 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67074 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67075 if (num > 400.0)
67076 {
67077 val += val2;
67078 num2 -= 1.0;
67079 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67080 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67081 if (num > 500.0)
67082 {
67083 val += val2;
67084 num2 -= 1.0;
67085 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67086 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67087 if (num > 600.0)
67088 {
67089 val += val2;
67090 num2 -= 1.0;
67091 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67092 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67093 if (num > 700.0)
67094 {
67095 val += val2;
67096 num2 -= 1.0;
67097 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67098 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67099 if (num > 800.0)
67100 {
67101 val += val2;
67102 num2 -= 1.0;
67103 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67104 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67105 if (num > 900.0)
67106 {
67107 val += val2;
67108 num2 -= 1.0;
67109 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67110 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67111 }
67112 }
67113 }
67114 }
67115 }
67116 }
67117 }
67118 }
67119 }
67120 }
67121 }
67122 }
67123 val2.X += (double)genRand.Next(-10, 11) * 0.05;
67124 if (drunkWorldGen)
67125 {
67126 val2.X += (double)genRand.Next(-10, 11) * 0.25;
67127 }
67128 if (val2.X > 1.0)
67129 {
67130 val2.X = 1.0;
67131 }
67132 if (val2.X < -1.0)
67133 {
67134 val2.X = -1.0;
67135 }
67136 if (!noYChange)
67137 {
67138 val2.Y += (double)genRand.Next(-10, 11) * 0.05;
67139 if (val2.Y > 1.0)
67140 {
67141 val2.Y = 1.0;
67142 }
67143 if (val2.Y < -1.0)
67144 {
67145 val2.Y = -1.0;
67146 }
67147 }
67148 else if (type != 59 && num < 3.0)
67149 {
67150 if (val2.Y > 1.0)
67151 {
67152 val2.Y = 1.0;
67153 }
67154 if (val2.Y < -1.0)
67155 {
67156 val2.Y = -1.0;
67157 }
67158 }
67159 if (type == 59 && !noYChange)
67160 {
67161 if (val2.Y > 0.5)
67162 {
67163 val2.Y = 0.5;
67164 }
67165 if (val2.Y < -0.5)
67166 {
67167 val2.Y = -0.5;
67168 }
67169 if (val.Y < Main.rockLayer + 100.0)
67170 {
67171 val2.Y = 1.0;
67172 }
67173 if (val.Y > (double)(Main.maxTilesY - 300))
67174 {
67175 val2.Y = -1.0;
67176 }
67177 }
67178 }
67179 }
static double Abs(double value)
static bool[] Ore
Definition TileID.cs:295
static bool[] CanBeClearedDuringGeneration
Definition TileID.cs:229
static Rectangle UndergroundDesertLocation
Definition GenVars.cs:110
static bool remixWorldGen
Definition WorldGen.cs:1148
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static bool oceanDepths(int x, int y)
Definition WorldGen.cs:7142
static readonly int beachDistance
Definition WorldGen.cs:928
static void PlaceWall(int i, int j, int type, bool mute=false)
static bool drunkWorldGen
Definition WorldGen.cs:1154
static bool getGoodWorldGen
Definition WorldGen.cs:1156

References System.Math.Abs(), Terraria.ID.TileID.Sets.CanBeClearedDuringGeneration, Terraria.WorldBuilding.GenVars.lavaLine, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.WorldBuilding.GenVars.mudWall, Terraria.ID.TileID.Sets.Ore, Terraria.Main.rockLayer, Terraria.Main.tile, Terraria.Main.tileStone, System.type, Terraria.Tile.type, Terraria.WorldBuilding.GenVars.UndergroundDesertLocation, Terraria.WorldBuilding.GenVars.waterLine, ReLogic.Utilities.Vector2D.X, and ReLogic.Utilities.Vector2D.Y.

Referenced by Terraria.GameContent.Biomes.JunglePass.ApplyPass(), Terraria.GameContent.Biomes.JunglePass.GenerateFinishingTouches(), Terraria.GameContent.Biomes.JunglePass.GenerateTunnelToSurface(), Terraria.WorldGen.GenerateWorld(), Terraria.GameContent.Biomes.JunglePass.PlaceFirstPassMud(), and Terraria.GameContent.Biomes.JunglePass.PlaceGemsAt().