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

◆ PlaceGranite()

void Terraria.GameContent.Biomes.GraniteBiome.PlaceGranite ( Point tileOrigin,
Rectangle magmaMapArea )
inlineprivate

Definition at line 219 of file GraniteBiome.cs.

220 {
221 bool flag = ShouldUseLava(tileOrigin);
222 ushort type = 368;
223 ushort wall = 180;
224 if (WorldGen.drunkWorldGen)
225 {
226 type = 367;
227 wall = 178;
228 }
229 for (int i = magmaMapArea.Left; i < magmaMapArea.Right; i++)
230 {
231 for (int j = magmaMapArea.Top; j < magmaMapArea.Bottom; j++)
232 {
233 Magma magma = _sourceMagmaMap[i, j];
234 if (!magma.IsActive)
235 {
236 continue;
237 }
238 Tile tile = GenBase._tiles[tileOrigin.X + i, tileOrigin.Y + j];
239 double num = Math.Sin((double)(tileOrigin.Y + j) * 0.4) * 0.7 + 1.2;
240 double num2 = 0.2 + 0.5 / Math.Sqrt(Math.Max(0.0, magma.Pressure - magma.Resistance));
241 if (Math.Max(1.0 - Math.Max(0.0, num * num2), magma.Pressure / 15.0) > 0.35 + (WorldGen.SolidTile(tileOrigin.X + i, tileOrigin.Y + j) ? 0.0 : 0.5))
242 {
243 if (TileID.Sets.Ore[tile.type])
244 {
245 tile.ResetToType(tile.type);
246 }
247 else
248 {
249 tile.ResetToType(type);
250 }
251 tile.wall = wall;
252 }
253 else if (magma.Resistance < 0.01)
254 {
256 tile.wall = wall;
257 }
258 if (tile.liquid > 0 && flag)
259 {
260 tile.liquidType(1);
261 }
262 }
263 }
264 }
static double Sqrt(double d)
static double Sin(double a)
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static bool[] Ore
Definition TileID.cs:295
static void ClearTile(int x, int y, bool frameNeighbors=false)
Definition WorldUtils.cs:37

References Terraria.GameContent.Biomes.GraniteBiome._sourceMagmaMap, Terraria.WorldBuilding.GenBase._tiles, Terraria.WorldBuilding.WorldUtils.ClearTile(), Terraria.WorldGen.drunkWorldGen, Terraria.Tile.liquid, Terraria.Tile.liquidType(), System.Math.Max(), Terraria.ID.TileID.Sets.Ore, Terraria.Tile.ResetToType(), Terraria.GameContent.Biomes.GraniteBiome.ShouldUseLava(), System.Math.Sin(), Terraria.WorldGen.SolidTile(), System.Math.Sqrt(), System.type, and Terraria.Tile.type.

Referenced by Terraria.GameContent.Biomes.GraniteBiome.Place().