Terraria 1.4.0.5 Source Code
This commit is contained in:
commit
05205f009e
1059 changed files with 563450 additions and 0 deletions
75
GameContent/Biomes/Desert/AnthillEntrance.cs
Normal file
75
GameContent/Biomes/Desert/AnthillEntrance.cs
Normal file
|
@ -0,0 +1,75 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.Desert.AnthillEntrance
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.WorldBuilding;
|
||||
|
||||
namespace Terraria.GameContent.Biomes.Desert
|
||||
{
|
||||
public static class AnthillEntrance
|
||||
{
|
||||
public static void Place(DesertDescription description)
|
||||
{
|
||||
int num1 = WorldGen.genRand.Next(2, 4);
|
||||
for (int index = 0; index < num1; ++index)
|
||||
{
|
||||
int holeRadius = WorldGen.genRand.Next(15, 18);
|
||||
int num2 = (int) ((double) (index + 1) / (double) (num1 + 1) * (double) description.Surface.Width) + description.Desert.Left;
|
||||
int y = (int) description.Surface[num2];
|
||||
AnthillEntrance.PlaceAt(description, new Point(num2, y), holeRadius);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PlaceAt(DesertDescription description, Point position, int holeRadius)
|
||||
{
|
||||
ShapeData data = new ShapeData();
|
||||
Point origin = new Point(position.X, position.Y + 6);
|
||||
WorldUtils.Gen(origin, (GenShape) new Shapes.Tail((float) (holeRadius * 2), new Vector2(0.0f, (float) -holeRadius * 1.5f)), Actions.Chain(new Actions.SetTile((ushort) 53).Output(data)));
|
||||
GenShapeActionPair pair1 = new GenShapeActionPair((GenShape) new Shapes.Rectangle(1, 1), Actions.Chain((GenAction) new Modifiers.Blotches(), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Clear(), (GenAction) new Actions.PlaceWall((ushort) 187)));
|
||||
GenShapeActionPair genShapeActionPair = new GenShapeActionPair((GenShape) new Shapes.Rectangle(1, 1), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Clear(), (GenAction) new Actions.PlaceWall((ushort) 187)));
|
||||
GenShapeActionPair pair2 = new GenShapeActionPair((GenShape) new Shapes.Circle(2, 3), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.SetTile((ushort) 397), (GenAction) new Actions.PlaceWall((ushort) 187)));
|
||||
GenShapeActionPair pair3 = new GenShapeActionPair((GenShape) new Shapes.Circle(holeRadius, 3), Actions.Chain((GenAction) new Modifiers.SkipWalls(new ushort[1]
|
||||
{
|
||||
(ushort) 187
|
||||
}), (GenAction) new Actions.SetTile((ushort) 53)));
|
||||
GenShapeActionPair pair4 = new GenShapeActionPair((GenShape) new Shapes.Circle(holeRadius - 2, 3), Actions.Chain((GenAction) new Actions.PlaceWall((ushort) 187)));
|
||||
int x = position.X;
|
||||
int y1 = position.Y - holeRadius - 3;
|
||||
while (true)
|
||||
{
|
||||
int num1 = y1;
|
||||
Microsoft.Xna.Framework.Rectangle rectangle = description.Hive;
|
||||
int top1 = rectangle.Top;
|
||||
int y2 = position.Y;
|
||||
rectangle = description.Desert;
|
||||
int top2 = rectangle.Top;
|
||||
int num2 = (y2 - top2) * 2;
|
||||
int num3 = top1 + num2 + 12;
|
||||
if (num1 < num3)
|
||||
{
|
||||
WorldUtils.Gen(new Point(x, y1), y1 < position.Y ? genShapeActionPair : pair1);
|
||||
WorldUtils.Gen(new Point(x, y1), pair2);
|
||||
if (y1 % 3 == 0 && y1 >= position.Y)
|
||||
{
|
||||
x += WorldGen.genRand.Next(-1, 2);
|
||||
WorldUtils.Gen(new Point(x, y1), pair1);
|
||||
if (y1 >= position.Y + 5)
|
||||
{
|
||||
WorldUtils.Gen(new Point(x, y1), pair3);
|
||||
WorldUtils.Gen(new Point(x, y1), pair4);
|
||||
}
|
||||
WorldUtils.Gen(new Point(x, y1), pair2);
|
||||
}
|
||||
++y1;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
WorldUtils.Gen(new Point(origin.X, origin.Y - (int) ((double) holeRadius * 1.5) + 3), (GenShape) new Shapes.Circle(holeRadius / 2, holeRadius / 3), Actions.Chain(Actions.Chain((GenAction) new Actions.ClearTile(), (GenAction) new Modifiers.Expand(1), (GenAction) new Actions.PlaceWall((ushort) 0))));
|
||||
WorldUtils.Gen(origin, (GenShape) new ModShapes.All(data), (GenAction) new Actions.Smooth());
|
||||
}
|
||||
}
|
||||
}
|
85
GameContent/Biomes/Desert/ChambersEntrance.cs
Normal file
85
GameContent/Biomes/Desert/ChambersEntrance.cs
Normal file
|
@ -0,0 +1,85 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.Desert.ChambersEntrance
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.Utilities;
|
||||
using Terraria.WorldBuilding;
|
||||
|
||||
namespace Terraria.GameContent.Biomes.Desert
|
||||
{
|
||||
public static class ChambersEntrance
|
||||
{
|
||||
public static void Place(DesertDescription description)
|
||||
{
|
||||
int num = description.Desert.Center.X + WorldGen.genRand.Next(-40, 41);
|
||||
Point position = new Point(num, (int) description.Surface[num]);
|
||||
ChambersEntrance.PlaceAt(description, position);
|
||||
}
|
||||
|
||||
private static void PlaceAt(DesertDescription description, Point position)
|
||||
{
|
||||
ShapeData shapeData = new ShapeData();
|
||||
Point origin = new Point(position.X, position.Y + 2);
|
||||
WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(24, 12), Actions.Chain((GenAction) new Modifiers.Blotches(), new Actions.SetTile((ushort) 53).Output(shapeData)));
|
||||
UnifiedRandom genRand = WorldGen.genRand;
|
||||
ShapeData data = new ShapeData();
|
||||
int num1 = description.Hive.Top - position.Y;
|
||||
int direction = genRand.Next(2) == 0 ? -1 : 1;
|
||||
List<ChambersEntrance.PathConnection> pathConnectionList = new List<ChambersEntrance.PathConnection>()
|
||||
{
|
||||
new ChambersEntrance.PathConnection(new Point(position.X + -direction * 26, position.Y - 8), direction)
|
||||
};
|
||||
int num2 = genRand.Next(2, 4);
|
||||
for (int index = 0; index < num2; ++index)
|
||||
{
|
||||
int y = (int) ((double) (index + 1) / (double) num2 * (double) num1) + genRand.Next(-8, 9);
|
||||
int x = direction * genRand.Next(20, 41);
|
||||
int num3 = genRand.Next(18, 29);
|
||||
WorldUtils.Gen(position, (GenShape) new Shapes.Circle(num3 / 2, 3), Actions.Chain((GenAction) new Modifiers.Offset(x, y), (GenAction) new Modifiers.Blotches(), new Actions.Clear().Output(data), (GenAction) new Actions.PlaceWall((ushort) 187)));
|
||||
pathConnectionList.Add(new ChambersEntrance.PathConnection(new Point(x + num3 / 2 * -direction + position.X, y + position.Y), -direction));
|
||||
direction *= -1;
|
||||
}
|
||||
WorldUtils.Gen(position, (GenShape) new ModShapes.OuterOutline(data), Actions.Chain((GenAction) new Modifiers.Expand(1), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 53
|
||||
}), (GenAction) new Actions.SetTile((ushort) 397), (GenAction) new Actions.PlaceWall((ushort) 187)));
|
||||
GenShapeActionPair pair = new GenShapeActionPair((GenShape) new Shapes.Rectangle(2, 4), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Modifiers.Blotches(), (GenAction) new Actions.Clear(), (GenAction) new Modifiers.Expand(1), (GenAction) new Actions.PlaceWall((ushort) 187), (GenAction) new Modifiers.OnlyTiles(new ushort[1]
|
||||
{
|
||||
(ushort) 53
|
||||
}), (GenAction) new Actions.SetTile((ushort) 397)));
|
||||
for (int index = 1; index < pathConnectionList.Count; ++index)
|
||||
{
|
||||
ChambersEntrance.PathConnection pathConnection1 = pathConnectionList[index - 1];
|
||||
ChambersEntrance.PathConnection pathConnection2 = pathConnectionList[index];
|
||||
float num4 = Math.Abs(pathConnection2.Position.X - pathConnection1.Position.X) * 1.5f;
|
||||
for (float amount = 0.0f; (double) amount <= 1.0; amount += 0.02f)
|
||||
{
|
||||
Vector2 vector2_1 = new Vector2(pathConnection1.Position.X + pathConnection1.Direction * num4 * amount, pathConnection1.Position.Y);
|
||||
Vector2 vector2_2 = new Vector2(pathConnection2.Position.X + (float) ((double) pathConnection2.Direction * (double) num4 * (1.0 - (double) amount)), pathConnection2.Position.Y);
|
||||
Vector2 vector2_3 = Vector2.Lerp(pathConnection1.Position, pathConnection2.Position, amount);
|
||||
Vector2 vector2_4 = vector2_3;
|
||||
double num5 = (double) amount;
|
||||
WorldUtils.Gen(Vector2.Lerp(Vector2.Lerp(vector2_1, vector2_4, (float) num5), Vector2.Lerp(vector2_3, vector2_2, amount), amount).ToPoint(), pair);
|
||||
}
|
||||
}
|
||||
WorldUtils.Gen(origin, (GenShape) new Shapes.Rectangle(new Microsoft.Xna.Framework.Rectangle(-29, -12, 58, 12)), Actions.Chain((GenAction) new Modifiers.NotInShape(shapeData), (GenAction) new Modifiers.Expand(1), (GenAction) new Actions.PlaceWall((ushort) 0)));
|
||||
}
|
||||
|
||||
private struct PathConnection
|
||||
{
|
||||
public readonly Vector2 Position;
|
||||
public readonly float Direction;
|
||||
|
||||
public PathConnection(Point position, int direction)
|
||||
{
|
||||
this.Position = new Vector2((float) position.X, (float) position.Y);
|
||||
this.Direction = (float) direction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
90
GameContent/Biomes/Desert/DesertDescription.cs
Normal file
90
GameContent/Biomes/Desert/DesertDescription.cs
Normal file
|
@ -0,0 +1,90 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.Desert.DesertDescription
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Terraria.GameContent.Biomes.Desert
|
||||
{
|
||||
public class DesertDescription
|
||||
{
|
||||
public static readonly DesertDescription Invalid = new DesertDescription()
|
||||
{
|
||||
IsValid = false
|
||||
};
|
||||
private static readonly Vector2 DefaultBlockScale = new Vector2(4f, 2f);
|
||||
private const int SCAN_PADDING = 5;
|
||||
|
||||
public Rectangle CombinedArea { get; private set; }
|
||||
|
||||
public Rectangle Desert { get; private set; }
|
||||
|
||||
public Rectangle Hive { get; private set; }
|
||||
|
||||
public Vector2 BlockScale { get; private set; }
|
||||
|
||||
public int BlockColumnCount { get; private set; }
|
||||
|
||||
public int BlockRowCount { get; private set; }
|
||||
|
||||
public bool IsValid { get; private set; }
|
||||
|
||||
public SurfaceMap Surface { get; private set; }
|
||||
|
||||
private DesertDescription()
|
||||
{
|
||||
}
|
||||
|
||||
public void UpdateSurfaceMap() => this.Surface = SurfaceMap.FromArea(this.CombinedArea.Left - 5, this.CombinedArea.Width + 10);
|
||||
|
||||
public static DesertDescription CreateFromPlacement(Point origin)
|
||||
{
|
||||
Vector2 defaultBlockScale = DesertDescription.DefaultBlockScale;
|
||||
float num1 = (float) Main.maxTilesX / 4200f;
|
||||
int num2 = (int) (80.0 * (double) num1);
|
||||
int num3 = (int) (((double) WorldGen.genRand.NextFloat() + 1.0) * 170.0 * (double) num1);
|
||||
int width = (int) ((double) defaultBlockScale.X * (double) num2);
|
||||
int height = (int) ((double) defaultBlockScale.Y * (double) num3);
|
||||
origin.X -= width / 2;
|
||||
SurfaceMap surfaceMap = SurfaceMap.FromArea(origin.X - 5, width + 10);
|
||||
if (DesertDescription.RowHasInvalidTiles(origin.X, surfaceMap.Bottom, width))
|
||||
return DesertDescription.Invalid;
|
||||
int y = (int) ((double) surfaceMap.Average + (double) surfaceMap.Bottom) / 2;
|
||||
origin.Y = y + WorldGen.genRand.Next(40, 60);
|
||||
return new DesertDescription()
|
||||
{
|
||||
CombinedArea = new Rectangle(origin.X, y, width, origin.Y + height - y),
|
||||
Hive = new Rectangle(origin.X, origin.Y, width, height),
|
||||
Desert = new Rectangle(origin.X, y, width, origin.Y + height / 2 - y),
|
||||
BlockScale = defaultBlockScale,
|
||||
BlockColumnCount = num2,
|
||||
BlockRowCount = num3,
|
||||
Surface = surfaceMap,
|
||||
IsValid = true
|
||||
};
|
||||
}
|
||||
|
||||
private static bool RowHasInvalidTiles(int startX, int startY, int width)
|
||||
{
|
||||
if (WorldGen.skipDesertTileCheck)
|
||||
return false;
|
||||
for (int index = startX; index < startX + width; ++index)
|
||||
{
|
||||
switch (Main.tile[index, startY].type)
|
||||
{
|
||||
case 59:
|
||||
case 60:
|
||||
return true;
|
||||
case 147:
|
||||
case 161:
|
||||
return true;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
366
GameContent/Biomes/Desert/DesertHive.cs
Normal file
366
GameContent/Biomes/Desert/DesertHive.cs
Normal file
|
@ -0,0 +1,366 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.Desert.DesertHive
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.Utilities;
|
||||
|
||||
namespace Terraria.GameContent.Biomes.Desert
|
||||
{
|
||||
public static class DesertHive
|
||||
{
|
||||
public static void Place(DesertDescription description)
|
||||
{
|
||||
DesertHive.ClusterGroup clusters = DesertHive.ClusterGroup.FromDescription(description);
|
||||
DesertHive.PlaceClusters(description, clusters);
|
||||
DesertHive.AddTileVariance(description);
|
||||
}
|
||||
|
||||
private static void PlaceClusters(
|
||||
DesertDescription description,
|
||||
DesertHive.ClusterGroup clusters)
|
||||
{
|
||||
Rectangle hive = description.Hive;
|
||||
hive.Inflate(20, 20);
|
||||
DesertHive.PostPlacementEffect[,] postEffectMap = new DesertHive.PostPlacementEffect[hive.Width, hive.Height];
|
||||
DesertHive.PlaceClustersArea(description, clusters, hive, postEffectMap, Point.Zero);
|
||||
for (int left = hive.Left; left < hive.Right; ++left)
|
||||
{
|
||||
for (int top = hive.Top; top < hive.Bottom; ++top)
|
||||
{
|
||||
if (postEffectMap[left - hive.Left, top - hive.Top].HasFlag((Enum) DesertHive.PostPlacementEffect.Smooth))
|
||||
Tile.SmoothSlope(left, top, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void PlaceClustersArea(
|
||||
DesertDescription description,
|
||||
DesertHive.ClusterGroup clusters,
|
||||
Rectangle area,
|
||||
DesertHive.PostPlacementEffect[,] postEffectMap,
|
||||
Point postEffectMapOffset)
|
||||
{
|
||||
FastRandom fastRandom1 = new FastRandom(Main.ActiveWorldFileData.Seed).WithModifier(57005UL);
|
||||
Vector2 vector2_1 = new Vector2((float) description.Hive.Width, (float) description.Hive.Height);
|
||||
Vector2 vector2_2 = new Vector2((float) clusters.Width, (float) clusters.Height);
|
||||
Vector2 vector2_3 = description.BlockScale / 2f;
|
||||
for (int left = area.Left; left < area.Right; ++left)
|
||||
{
|
||||
for (int top = area.Top; top < area.Bottom; ++top)
|
||||
{
|
||||
if (WorldGen.InWorld(left, top, 1))
|
||||
{
|
||||
float num1 = 0.0f;
|
||||
int num2 = -1;
|
||||
float num3 = 0.0f;
|
||||
ushort type = 53;
|
||||
if (fastRandom1.Next(3) == 0)
|
||||
type = (ushort) 397;
|
||||
int x = left - description.Hive.X;
|
||||
int y = top - description.Hive.Y;
|
||||
Vector2 vector2_4 = (new Vector2((float) x, (float) y) - vector2_3) / vector2_1 * vector2_2;
|
||||
for (int index = 0; index < clusters.Count; ++index)
|
||||
{
|
||||
DesertHive.Cluster cluster = clusters[index];
|
||||
if ((double) Math.Abs(cluster[0].Position.X - vector2_4.X) <= 10.0 && (double) Math.Abs(cluster[0].Position.Y - vector2_4.Y) <= 10.0)
|
||||
{
|
||||
float num4 = 0.0f;
|
||||
foreach (DesertHive.Block block in (List<DesertHive.Block>) cluster)
|
||||
num4 += 1f / Vector2.DistanceSquared(block.Position, vector2_4);
|
||||
if ((double) num4 > (double) num1)
|
||||
{
|
||||
if ((double) num1 > (double) num3)
|
||||
num3 = num1;
|
||||
num1 = num4;
|
||||
num2 = index;
|
||||
}
|
||||
else if ((double) num4 > (double) num3)
|
||||
num3 = num4;
|
||||
}
|
||||
}
|
||||
float num5 = num1 + num3;
|
||||
Tile tile = Main.tile[left, top];
|
||||
bool flag = (double) ((new Vector2((float) x, (float) y) - vector2_3) / vector2_1 * 2f - Vector2.One).Length() >= 0.800000011920929;
|
||||
DesertHive.PostPlacementEffect postPlacementEffect = DesertHive.PostPlacementEffect.None;
|
||||
if ((double) num5 > 3.5)
|
||||
{
|
||||
postPlacementEffect = DesertHive.PostPlacementEffect.Smooth;
|
||||
tile.ClearEverything();
|
||||
tile.wall = (ushort) 187;
|
||||
if (num2 % 15 == 2)
|
||||
tile.ResetToType((ushort) 404);
|
||||
}
|
||||
else if ((double) num5 > 1.79999995231628)
|
||||
{
|
||||
tile.wall = (ushort) 187;
|
||||
if ((double) top < Main.worldSurface)
|
||||
tile.liquid = (byte) 0;
|
||||
else
|
||||
tile.lava(true);
|
||||
if (!flag || tile.active())
|
||||
{
|
||||
tile.ResetToType((ushort) 396);
|
||||
postPlacementEffect = DesertHive.PostPlacementEffect.Smooth;
|
||||
}
|
||||
}
|
||||
else if ((double) num5 > 0.699999988079071 || !flag)
|
||||
{
|
||||
tile.wall = (ushort) 216;
|
||||
tile.liquid = (byte) 0;
|
||||
if (!flag || tile.active())
|
||||
{
|
||||
tile.ResetToType(type);
|
||||
postPlacementEffect = DesertHive.PostPlacementEffect.Smooth;
|
||||
}
|
||||
}
|
||||
else if ((double) num5 > 0.25)
|
||||
{
|
||||
FastRandom fastRandom2 = fastRandom1.WithModifier(x, y);
|
||||
float num6 = (float) (((double) num5 - 0.25) / 0.449999988079071);
|
||||
if ((double) fastRandom2.NextFloat() < (double) num6)
|
||||
{
|
||||
tile.wall = (ushort) 187;
|
||||
if ((double) top < Main.worldSurface)
|
||||
tile.liquid = (byte) 0;
|
||||
else
|
||||
tile.lava(true);
|
||||
if (tile.active())
|
||||
{
|
||||
tile.ResetToType(type);
|
||||
postPlacementEffect = DesertHive.PostPlacementEffect.Smooth;
|
||||
}
|
||||
}
|
||||
}
|
||||
postEffectMap[left - area.X + postEffectMapOffset.X, top - area.Y + postEffectMapOffset.Y] = postPlacementEffect;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddTileVariance(DesertDescription description)
|
||||
{
|
||||
for (int index1 = -20; index1 < description.Hive.Width + 20; ++index1)
|
||||
{
|
||||
for (int index2 = -20; index2 < description.Hive.Height + 20; ++index2)
|
||||
{
|
||||
int x = index1 + description.Hive.X;
|
||||
int y = index2 + description.Hive.Y;
|
||||
if (WorldGen.InWorld(x, y, 1))
|
||||
{
|
||||
Tile tile = Main.tile[x, y];
|
||||
Tile testTile1 = Main.tile[x, y + 1];
|
||||
Tile testTile2 = Main.tile[x, y + 2];
|
||||
if (tile.type == (ushort) 53 && (!WorldGen.SolidTile(testTile1) || !WorldGen.SolidTile(testTile2)))
|
||||
tile.type = (ushort) 397;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int index3 = -20; index3 < description.Hive.Width + 20; ++index3)
|
||||
{
|
||||
for (int index4 = -20; index4 < description.Hive.Height + 20; ++index4)
|
||||
{
|
||||
int index5 = index3 + description.Hive.X;
|
||||
int y = index4 + description.Hive.Y;
|
||||
if (WorldGen.InWorld(index5, y, 1))
|
||||
{
|
||||
Tile tile = Main.tile[index5, y];
|
||||
if (tile.active() && tile.type == (ushort) 396)
|
||||
{
|
||||
bool flag1 = true;
|
||||
for (int index6 = -1; index6 >= -3; --index6)
|
||||
{
|
||||
if (Main.tile[index5, y + index6].active())
|
||||
{
|
||||
flag1 = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool flag2 = true;
|
||||
for (int index7 = 1; index7 <= 3; ++index7)
|
||||
{
|
||||
if (Main.tile[index5, y + index7].active())
|
||||
{
|
||||
flag2 = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag1 && WorldGen.genRand.Next(5) == 0)
|
||||
WorldGen.PlaceTile(index5, y - 1, 485, true, true, style: WorldGen.genRand.Next(4));
|
||||
else if (flag1 && WorldGen.genRand.Next(5) == 0)
|
||||
WorldGen.PlaceTile(index5, y - 1, 484, true, true);
|
||||
else if (flag1 ^ flag2 && WorldGen.genRand.Next(5) == 0)
|
||||
WorldGen.PlaceTile(index5, y + (flag1 ? -1 : 1), 165, true, true);
|
||||
else if (flag1 && WorldGen.genRand.Next(5) == 0)
|
||||
WorldGen.PlaceTile(index5, y - 1, 187, true, true, style: (29 + WorldGen.genRand.Next(6)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct Block
|
||||
{
|
||||
public Vector2 Position;
|
||||
|
||||
public Block(float x, float y) => this.Position = new Vector2(x, y);
|
||||
}
|
||||
|
||||
private class Cluster : List<DesertHive.Block>
|
||||
{
|
||||
}
|
||||
|
||||
private class ClusterGroup : List<DesertHive.Cluster>
|
||||
{
|
||||
public readonly int Width;
|
||||
public readonly int Height;
|
||||
|
||||
private ClusterGroup(int width, int height)
|
||||
{
|
||||
this.Width = width;
|
||||
this.Height = height;
|
||||
this.Generate();
|
||||
}
|
||||
|
||||
public static DesertHive.ClusterGroup FromDescription(DesertDescription description) => new DesertHive.ClusterGroup(description.BlockColumnCount, description.BlockRowCount);
|
||||
|
||||
private static void SearchForCluster(
|
||||
bool[,] blockMap,
|
||||
List<Point> pointCluster,
|
||||
int x,
|
||||
int y,
|
||||
int level = 2)
|
||||
{
|
||||
pointCluster.Add(new Point(x, y));
|
||||
blockMap[x, y] = false;
|
||||
--level;
|
||||
if (level == -1)
|
||||
return;
|
||||
if (x > 0 && blockMap[x - 1, y])
|
||||
DesertHive.ClusterGroup.SearchForCluster(blockMap, pointCluster, x - 1, y, level);
|
||||
if (x < blockMap.GetLength(0) - 1 && blockMap[x + 1, y])
|
||||
DesertHive.ClusterGroup.SearchForCluster(blockMap, pointCluster, x + 1, y, level);
|
||||
if (y > 0 && blockMap[x, y - 1])
|
||||
DesertHive.ClusterGroup.SearchForCluster(blockMap, pointCluster, x, y - 1, level);
|
||||
if (y >= blockMap.GetLength(1) - 1 || !blockMap[x, y + 1])
|
||||
return;
|
||||
DesertHive.ClusterGroup.SearchForCluster(blockMap, pointCluster, x, y + 1, level);
|
||||
}
|
||||
|
||||
private static void AttemptClaim(
|
||||
int x,
|
||||
int y,
|
||||
int[,] clusterIndexMap,
|
||||
List<List<Point>> pointClusters,
|
||||
int index)
|
||||
{
|
||||
int clusterIndex = clusterIndexMap[x, y];
|
||||
if (clusterIndex == -1 || clusterIndex == index)
|
||||
return;
|
||||
int num = WorldGen.genRand.Next(2) == 0 ? -1 : index;
|
||||
foreach (Point point in pointClusters[clusterIndex])
|
||||
clusterIndexMap[point.X, point.Y] = num;
|
||||
}
|
||||
|
||||
private void Generate()
|
||||
{
|
||||
this.Clear();
|
||||
bool[,] blockMap = new bool[this.Width, this.Height];
|
||||
int num1 = this.Width / 2 - 1;
|
||||
int y1 = this.Height / 2 - 1;
|
||||
int num2 = (num1 + 1) * (num1 + 1);
|
||||
Point point1 = new Point(num1, y1);
|
||||
for (int index1 = point1.Y - y1; index1 <= point1.Y + y1; ++index1)
|
||||
{
|
||||
float num3 = (float) num1 / (float) y1 * (float) (index1 - point1.Y);
|
||||
int num4 = Math.Min(num1, (int) Math.Sqrt((double) num2 - (double) num3 * (double) num3));
|
||||
for (int index2 = point1.X - num4; index2 <= point1.X + num4; ++index2)
|
||||
blockMap[index2, index1] = WorldGen.genRand.Next(2) == 0;
|
||||
}
|
||||
List<List<Point>> pointClusters = new List<List<Point>>();
|
||||
for (int x = 0; x < blockMap.GetLength(0); ++x)
|
||||
{
|
||||
for (int y2 = 0; y2 < blockMap.GetLength(1); ++y2)
|
||||
{
|
||||
if (blockMap[x, y2] && WorldGen.genRand.Next(2) == 0)
|
||||
{
|
||||
List<Point> pointCluster = new List<Point>();
|
||||
DesertHive.ClusterGroup.SearchForCluster(blockMap, pointCluster, x, y2);
|
||||
if (pointCluster.Count > 2)
|
||||
pointClusters.Add(pointCluster);
|
||||
}
|
||||
}
|
||||
}
|
||||
int[,] clusterIndexMap = new int[blockMap.GetLength(0), blockMap.GetLength(1)];
|
||||
for (int index3 = 0; index3 < clusterIndexMap.GetLength(0); ++index3)
|
||||
{
|
||||
for (int index4 = 0; index4 < clusterIndexMap.GetLength(1); ++index4)
|
||||
clusterIndexMap[index3, index4] = -1;
|
||||
}
|
||||
for (int index = 0; index < pointClusters.Count; ++index)
|
||||
{
|
||||
foreach (Point point2 in pointClusters[index])
|
||||
clusterIndexMap[point2.X, point2.Y] = index;
|
||||
}
|
||||
for (int index5 = 0; index5 < pointClusters.Count; ++index5)
|
||||
{
|
||||
foreach (Point point3 in pointClusters[index5])
|
||||
{
|
||||
int x = point3.X;
|
||||
int y3 = point3.Y;
|
||||
if (clusterIndexMap[x, y3] != -1)
|
||||
{
|
||||
int index6 = clusterIndexMap[x, y3];
|
||||
if (x > 0)
|
||||
DesertHive.ClusterGroup.AttemptClaim(x - 1, y3, clusterIndexMap, pointClusters, index6);
|
||||
if (x < clusterIndexMap.GetLength(0) - 1)
|
||||
DesertHive.ClusterGroup.AttemptClaim(x + 1, y3, clusterIndexMap, pointClusters, index6);
|
||||
if (y3 > 0)
|
||||
DesertHive.ClusterGroup.AttemptClaim(x, y3 - 1, clusterIndexMap, pointClusters, index6);
|
||||
if (y3 < clusterIndexMap.GetLength(1) - 1)
|
||||
DesertHive.ClusterGroup.AttemptClaim(x, y3 + 1, clusterIndexMap, pointClusters, index6);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (List<Point> pointList in pointClusters)
|
||||
pointList.Clear();
|
||||
for (int x = 0; x < clusterIndexMap.GetLength(0); ++x)
|
||||
{
|
||||
for (int y4 = 0; y4 < clusterIndexMap.GetLength(1); ++y4)
|
||||
{
|
||||
if (clusterIndexMap[x, y4] != -1)
|
||||
pointClusters[clusterIndexMap[x, y4]].Add(new Point(x, y4));
|
||||
}
|
||||
}
|
||||
foreach (List<Point> pointList in pointClusters)
|
||||
{
|
||||
if (pointList.Count < 4)
|
||||
pointList.Clear();
|
||||
}
|
||||
foreach (List<Point> pointList in pointClusters)
|
||||
{
|
||||
DesertHive.Cluster cluster = new DesertHive.Cluster();
|
||||
if (pointList.Count > 0)
|
||||
{
|
||||
foreach (Point point4 in pointList)
|
||||
cluster.Add(new DesertHive.Block((float) point4.X + (float) (((double) WorldGen.genRand.NextFloat() - 0.5) * 0.5), (float) point4.Y + (float) (((double) WorldGen.genRand.NextFloat() - 0.5) * 0.5)));
|
||||
this.Add(cluster);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum PostPlacementEffect : byte
|
||||
{
|
||||
None = 0,
|
||||
Smooth = 1,
|
||||
}
|
||||
}
|
||||
}
|
64
GameContent/Biomes/Desert/LarvaHoleEntrance.cs
Normal file
64
GameContent/Biomes/Desert/LarvaHoleEntrance.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.Desert.LarvaHoleEntrance
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.WorldBuilding;
|
||||
|
||||
namespace Terraria.GameContent.Biomes.Desert
|
||||
{
|
||||
public static class LarvaHoleEntrance
|
||||
{
|
||||
public static void Place(DesertDescription description)
|
||||
{
|
||||
int num1 = WorldGen.genRand.Next(2, 4);
|
||||
for (int index = 0; index < num1; ++index)
|
||||
{
|
||||
int holeRadius = WorldGen.genRand.Next(13, 16);
|
||||
int num2 = (int) ((double) (index + 1) / (double) (num1 + 1) * (double) description.Surface.Width) + description.Desert.Left;
|
||||
int y = (int) description.Surface[num2];
|
||||
LarvaHoleEntrance.PlaceAt(description, new Point(num2, y), holeRadius);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PlaceAt(DesertDescription description, Point position, int holeRadius)
|
||||
{
|
||||
ShapeData data = new ShapeData();
|
||||
WorldUtils.Gen(position, (GenShape) new Shapes.Rectangle(new Microsoft.Xna.Framework.Rectangle(-holeRadius, -holeRadius * 2, holeRadius * 2, holeRadius * 2)), new Actions.Clear().Output(data));
|
||||
WorldUtils.Gen(position, (GenShape) new Shapes.Tail((float) (holeRadius * 2), new Vector2(0.0f, (float) holeRadius * 1.5f)), Actions.Chain(new Actions.Clear().Output(data)));
|
||||
WorldUtils.Gen(position, (GenShape) new ModShapes.All(data), Actions.Chain((GenAction) new Modifiers.Offset(0, 1), (GenAction) new Modifiers.Expand(1), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Smooth(true)));
|
||||
GenShapeActionPair pair1 = new GenShapeActionPair((GenShape) new Shapes.Rectangle(1, 1), Actions.Chain((GenAction) new Modifiers.Blotches(), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Clear(), (GenAction) new Actions.PlaceWall((ushort) 187)));
|
||||
GenShapeActionPair pair2 = new GenShapeActionPair((GenShape) new Shapes.Circle(2, 3), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.SetTile((ushort) 397), (GenAction) new Actions.PlaceWall((ushort) 187)));
|
||||
int x = position.X;
|
||||
int y1 = position.Y + (int) ((double) holeRadius * 1.5);
|
||||
while (true)
|
||||
{
|
||||
int num1 = y1;
|
||||
Microsoft.Xna.Framework.Rectangle rectangle = description.Hive;
|
||||
int top1 = rectangle.Top;
|
||||
int y2 = position.Y;
|
||||
rectangle = description.Desert;
|
||||
int top2 = rectangle.Top;
|
||||
int num2 = (y2 - top2) * 2;
|
||||
int num3 = top1 + num2 + 12;
|
||||
if (num1 < num3)
|
||||
{
|
||||
WorldUtils.Gen(new Point(x, y1), pair1);
|
||||
WorldUtils.Gen(new Point(x, y1), pair2);
|
||||
if (y1 % 3 == 0)
|
||||
{
|
||||
x += WorldGen.genRand.Next(-1, 2);
|
||||
WorldUtils.Gen(new Point(x, y1), pair1);
|
||||
WorldUtils.Gen(new Point(x, y1), pair2);
|
||||
}
|
||||
++y1;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
WorldUtils.Gen(new Point(position.X, position.Y + 2), (GenShape) new ModShapes.All(data), (GenAction) new Actions.PlaceWall((ushort) 0));
|
||||
}
|
||||
}
|
||||
}
|
78
GameContent/Biomes/Desert/PitEntrance.cs
Normal file
78
GameContent/Biomes/Desert/PitEntrance.cs
Normal file
|
@ -0,0 +1,78 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.Desert.PitEntrance
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace Terraria.GameContent.Biomes.Desert
|
||||
{
|
||||
public static class PitEntrance
|
||||
{
|
||||
public static void Place(DesertDescription description)
|
||||
{
|
||||
int holeRadius = WorldGen.genRand.Next(6, 9);
|
||||
Point center = description.CombinedArea.Center;
|
||||
center.Y = (int) description.Surface[center.X];
|
||||
PitEntrance.PlaceAt(description, center, holeRadius);
|
||||
}
|
||||
|
||||
private static void PlaceAt(DesertDescription description, Point position, int holeRadius)
|
||||
{
|
||||
for (int index = -holeRadius - 3; index < holeRadius + 3; ++index)
|
||||
{
|
||||
int j = (int) description.Surface[index + position.X];
|
||||
while (true)
|
||||
{
|
||||
int num1 = j;
|
||||
Rectangle rectangle = description.Hive;
|
||||
int num2 = rectangle.Top + 10;
|
||||
if (num1 <= num2)
|
||||
{
|
||||
double num3 = (double) (j - (int) description.Surface[index + position.X]);
|
||||
rectangle = description.Hive;
|
||||
int top1 = rectangle.Top;
|
||||
rectangle = description.Desert;
|
||||
int top2 = rectangle.Top;
|
||||
double num4 = (double) (top1 - top2);
|
||||
float yProgress = MathHelper.Clamp((float) (num3 / num4), 0.0f, 1f);
|
||||
int num5 = (int) ((double) PitEntrance.GetHoleRadiusScaleAt(yProgress) * (double) holeRadius);
|
||||
if (Math.Abs(index) < num5)
|
||||
Main.tile[index + position.X, j].ClearEverything();
|
||||
else if (Math.Abs(index) < num5 + 3 && (double) yProgress > 0.349999994039536)
|
||||
Main.tile[index + position.X, j].ResetToType((ushort) 397);
|
||||
float num6 = Math.Abs((float) index / (float) holeRadius);
|
||||
float num7 = num6 * num6;
|
||||
if (Math.Abs(index) < num5 + 3 && (double) (j - position.Y) > 15.0 - 3.0 * (double) num7)
|
||||
{
|
||||
Main.tile[index + position.X, j].wall = (ushort) 187;
|
||||
WorldGen.SquareWallFrame(index + position.X, j - 1);
|
||||
WorldGen.SquareWallFrame(index + position.X, j);
|
||||
}
|
||||
++j;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
holeRadius += 4;
|
||||
for (int index1 = -holeRadius; index1 < holeRadius; ++index1)
|
||||
{
|
||||
int num8 = holeRadius - Math.Abs(index1);
|
||||
int num9 = Math.Min(10, num8 * num8);
|
||||
for (int index2 = 0; index2 < num9; ++index2)
|
||||
Main.tile[index1 + position.X, index2 + (int) description.Surface[index1 + position.X]].ClearEverything();
|
||||
}
|
||||
}
|
||||
|
||||
private static float GetHoleRadiusScaleAt(float yProgress) => (double) yProgress < 0.600000023841858 ? 1f : (float) ((1.0 - (double) PitEntrance.SmootherStep((float) (((double) yProgress - 0.600000023841858) / 0.400000005960464))) * 0.5 + 0.5);
|
||||
|
||||
private static float SmootherStep(float delta)
|
||||
{
|
||||
delta = MathHelper.Clamp(delta, 0.0f, 1f);
|
||||
return (float) (1.0 - Math.Cos((double) delta * 3.14159274101257) * 0.5 - 0.5);
|
||||
}
|
||||
}
|
||||
}
|
69
GameContent/Biomes/Desert/SandMound.cs
Normal file
69
GameContent/Biomes/Desert/SandMound.cs
Normal file
|
@ -0,0 +1,69 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.Desert.SandMound
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace Terraria.GameContent.Biomes.Desert
|
||||
{
|
||||
public static class SandMound
|
||||
{
|
||||
public static void Place(DesertDescription description)
|
||||
{
|
||||
Rectangle desert1 = description.Desert;
|
||||
desert1.Height = Math.Min(description.Desert.Height, description.Hive.Height / 2);
|
||||
Rectangle desert2 = description.Desert;
|
||||
desert2.Y = desert1.Bottom;
|
||||
desert2.Height = Math.Max(0, description.Desert.Bottom - desert1.Bottom);
|
||||
SurfaceMap surface = description.Surface;
|
||||
int num1 = 0;
|
||||
int num2 = 0;
|
||||
for (int index1 = -5; index1 < desert1.Width + 5; ++index1)
|
||||
{
|
||||
float num3 = MathHelper.Clamp((float) ((double) Math.Abs((float) (index1 + 5) / (float) (desert1.Width + 10)) * 2.0 - 1.0), -1f, 1f);
|
||||
if (index1 % 3 == 0)
|
||||
num1 = Utils.Clamp<int>(num1 + WorldGen.genRand.Next(-1, 2), -10, 10);
|
||||
num2 = Utils.Clamp<int>(num2 + WorldGen.genRand.Next(-1, 2), -10, 10);
|
||||
float num4 = (float) Math.Sqrt(1.0 - (double) num3 * (double) num3 * (double) num3 * (double) num3);
|
||||
int num5 = desert1.Bottom - (int) ((double) num4 * (double) desert1.Height) + num1;
|
||||
if ((double) Math.Abs(num3) < 1.0)
|
||||
{
|
||||
float num6 = Utils.UnclampedSmoothStep(0.5f, 0.8f, Math.Abs(num3));
|
||||
float num7 = num6 * num6 * num6;
|
||||
int num8 = Math.Min(10 + (int) ((double) desert1.Top - (double) num7 * 20.0) + num2, num5);
|
||||
for (int index2 = (int) surface[index1 + desert1.X] - 1; index2 < num8; ++index2)
|
||||
{
|
||||
int index3 = index1 + desert1.X;
|
||||
int index4 = index2;
|
||||
Main.tile[index3, index4].active(false);
|
||||
Main.tile[index3, index4].wall = (ushort) 0;
|
||||
}
|
||||
}
|
||||
SandMound.PlaceSandColumn(index1 + desert1.X, num5, desert2.Bottom - num5);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PlaceSandColumn(int startX, int startY, int height)
|
||||
{
|
||||
for (int index = startY + height - 1; index >= startY; --index)
|
||||
{
|
||||
int i = startX;
|
||||
int j = index;
|
||||
Tile tile1 = Main.tile[i, j];
|
||||
tile1.liquid = (byte) 0;
|
||||
Tile tile2 = Main.tile[i, j + 1];
|
||||
Tile tile3 = Main.tile[i, j + 2];
|
||||
tile1.type = (ushort) 53;
|
||||
tile1.slope((byte) 0);
|
||||
tile1.halfBrick(false);
|
||||
tile1.active(true);
|
||||
if (index < startY)
|
||||
tile1.active(false);
|
||||
WorldGen.SquareWallFrame(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
71
GameContent/Biomes/Desert/SurfaceMap.cs
Normal file
71
GameContent/Biomes/Desert/SurfaceMap.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Biomes.Desert.SurfaceMap
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System;
|
||||
|
||||
namespace Terraria.GameContent.Biomes.Desert
|
||||
{
|
||||
public class SurfaceMap
|
||||
{
|
||||
public readonly float Average;
|
||||
public readonly int Bottom;
|
||||
public readonly int Top;
|
||||
public readonly int X;
|
||||
private readonly short[] _heights;
|
||||
|
||||
public int Width => this._heights.Length;
|
||||
|
||||
private SurfaceMap(short[] heights, int x)
|
||||
{
|
||||
this._heights = heights;
|
||||
this.X = x;
|
||||
int val1_1 = 0;
|
||||
int val1_2 = int.MaxValue;
|
||||
int num = 0;
|
||||
for (int index = 0; index < heights.Length; ++index)
|
||||
{
|
||||
num += (int) heights[index];
|
||||
val1_1 = Math.Max(val1_1, (int) heights[index]);
|
||||
val1_2 = Math.Min(val1_2, (int) heights[index]);
|
||||
}
|
||||
if ((double) val1_1 > Main.worldSurface - 10.0)
|
||||
val1_1 = (int) Main.worldSurface - 10;
|
||||
this.Bottom = val1_1;
|
||||
this.Top = val1_2;
|
||||
this.Average = (float) num / (float) this._heights.Length;
|
||||
}
|
||||
|
||||
public short this[int absoluteX] => this._heights[absoluteX - this.X];
|
||||
|
||||
public static SurfaceMap FromArea(int startX, int width)
|
||||
{
|
||||
int num1 = Main.maxTilesY / 2;
|
||||
short[] heights = new short[width];
|
||||
for (int index1 = startX; index1 < startX + width; ++index1)
|
||||
{
|
||||
bool flag = false;
|
||||
int num2 = 0;
|
||||
for (int index2 = 50; index2 < 50 + num1; ++index2)
|
||||
{
|
||||
if (Main.tile[index1, index2].active())
|
||||
{
|
||||
if (Main.tile[index1, index2].type == (ushort) 189 || Main.tile[index1, index2].type == (ushort) 196 || Main.tile[index1, index2].type == (ushort) 460)
|
||||
flag = false;
|
||||
else if (!flag)
|
||||
{
|
||||
num2 = index2;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
num2 = num1 + 50;
|
||||
}
|
||||
heights[index1 - startX] = (short) num2;
|
||||
}
|
||||
return new SurfaceMap(heights, startX);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue