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

◆ PlacePath()

void Terraria.GameContent.Generation.TrackGenerator.PlacePath ( )
inlineprivate

Definition at line 89 of file TrackGenerator.cs.

90 {
91 bool[] array = new bool[_length];
92 for (int i = 0; i < _length; i++)
93 {
94 if (WorldGen.genRand.Next(7) == 0)
95 {
96 playerHeight = WorldGen.genRand.Next(5, 9);
97 }
98 for (int j = 0; j < playerHeight; j++)
99 {
100 if (Main.tile[_history[i].X, _history[i].Y - j - 1].wall == 244)
101 {
102 Main.tile[_history[i].X, _history[i].Y - j - 1].wall = 0;
103 }
104 if (Main.tile[_history[i].X, _history[i].Y - j].wall == 244)
105 {
106 Main.tile[_history[i].X, _history[i].Y - j].wall = 0;
107 }
108 if (Main.tile[_history[i].X, _history[i].Y - j + 1].wall == 244)
109 {
110 Main.tile[_history[i].X, _history[i].Y - j + 1].wall = 0;
111 }
112 if (Main.tile[_history[i].X, _history[i].Y - j].type == 135)
113 {
114 array[i] = true;
115 }
116 WorldGen.KillTile(_history[i].X, _history[i].Y - j, fail: false, effectOnly: false, noItem: true);
117 }
118 }
119 for (int k = 0; k < _length; k++)
120 {
121 if (WorldGen.genRand.Next(7) == 0)
122 {
123 playerHeight = WorldGen.genRand.Next(5, 9);
124 }
125 TrackHistory trackHistory = _history[k];
126 Tile.SmoothSlope(trackHistory.X, trackHistory.Y + 1);
127 Tile.SmoothSlope(trackHistory.X, trackHistory.Y - playerHeight);
128 bool wire = Main.tile[trackHistory.X, trackHistory.Y].wire();
129 if (array[k] && k < _length && k > 0 && _history[k - 1].Y == trackHistory.Y && _history[k + 1].Y == trackHistory.Y)
130 {
131 Main.tile[trackHistory.X, trackHistory.Y].ClearEverything();
132 WorldGen.PlaceTile(trackHistory.X, trackHistory.Y, 314, mute: false, forced: true, -1, 1);
133 }
134 else
135 {
136 Main.tile[trackHistory.X, trackHistory.Y].ResetToType(314);
137 }
138 Main.tile[trackHistory.X, trackHistory.Y].wire(wire);
139 if (k == 0)
140 {
141 continue;
142 }
143 for (int l = 0; l < 8; l++)
144 {
145 WorldUtils.TileFrame(_history[k - 1].X, _history[k - 1].Y - l, frameNeighbors: true);
146 }
147 if (k == _length - 1)
148 {
149 for (int m = 0; m < playerHeight; m++)
150 {
151 WorldUtils.TileFrame(trackHistory.X, trackHistory.Y - m, frameNeighbors: true);
152 }
153 }
154 }
155 }
static void TileFrame(int x, int y, bool frameNeighbors=false)
Definition WorldUtils.cs:61

References Terraria.GameContent.Generation.TrackGenerator._history, Terraria.GameContent.Generation.TrackGenerator._length, System.array, Terraria.WorldGen.genRand, Terraria.WorldGen.KillTile(), Terraria.WorldGen.PlaceTile(), Terraria.GameContent.Generation.TrackGenerator.playerHeight, Terraria.Tile.SmoothSlope(), Terraria.Main.tile, Terraria.WorldBuilding.WorldUtils.TileFrame(), System.X, Terraria.GameContent.Generation.TrackGenerator.TrackHistory.X, System.Y, and Terraria.GameContent.Generation.TrackGenerator.TrackHistory.Y.

Referenced by Terraria.GameContent.Generation.TrackGenerator.Place().