Giant Hive Walls
This commit is contained in:
1 parent
5adc19dee3
commit
3c3f108252
3 files changed
+104
-9
No files matched your search
@@ -0,0 +1,30 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Walls
|
||||
{
|
||||
public class GiantHiveWall : MultiVariantModWall
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.wallHouse[Type] = false;
|
||||
|
||||
AddMapEntry(new Color(155, 85, 15));
|
||||
}
|
||||
|
||||
public override bool CreateDust(int i, int j, ref int type)
|
||||
{
|
||||
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Hive, 0f, 0f, 1, new Color(255, 255, 255), 1f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
|
||||
|
||||
public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset)
|
||||
{
|
||||
frameXOffset = (i % 4) * 468;
|
||||
frameYOffset = (j % 4) * 180;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
+74
-9
@@ -87,7 +87,7 @@ namespace CalamityMod.World
|
||||
//place living mahogany leaves at the end of each branch
|
||||
foreach (Point item in list)
|
||||
{
|
||||
WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)),
|
||||
WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(3, 5)),
|
||||
new Modifiers.SkipTiles(383, 21, 467, 226, 237), new Modifiers.SkipWalls(78, 87), new Actions.SetTile(TileID.LivingMahoganyLeaves), new Actions.SetFrames(frameNeighbors: true)));
|
||||
}
|
||||
}
|
||||
@@ -375,13 +375,13 @@ namespace CalamityMod.World
|
||||
{
|
||||
Tile tTile = Main.tile[tileX, tileY];
|
||||
tTile.HasTile = false;
|
||||
tTile.WallType = WallID.HiveUnsafe;
|
||||
tTile.WallType = (ushort)ModContent.WallType<GiantHiveWall>();
|
||||
tTile.LiquidAmount = 0;
|
||||
|
||||
WorldGen.SquareWallFrame(tileX, tileY);
|
||||
|
||||
// Optional: Add honey with low chance
|
||||
if (WorldGen.genRand.NextBool(20))
|
||||
if (WorldGen.genRand.NextBool(10))
|
||||
{
|
||||
tTile.LiquidAmount = 100;
|
||||
tTile.LiquidType = LiquidID.Honey;
|
||||
@@ -425,6 +425,38 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void CreateGiantHiveHexagon(int centerX, int centerY, int hexagonSize, int tileType, bool doWalls = false)
|
||||
{
|
||||
int halfHexagonSize = hexagonSize / 2;
|
||||
|
||||
for (int x = -halfHexagonSize; x <= halfHexagonSize; x++)
|
||||
{
|
||||
int y1 = Math.Abs(x) / 2;
|
||||
int y2 = hexagonSize - Math.Abs(x) / 2;
|
||||
|
||||
for (int y = y1; y < y2; y++)
|
||||
{
|
||||
int tileX = centerX + x;
|
||||
int tileY = centerY + y;
|
||||
|
||||
if (WorldGen.InWorld(tileX, tileY))
|
||||
{
|
||||
Tile tTile = Main.tile[tileX, tileY];
|
||||
if (!doWalls)
|
||||
{
|
||||
tTile.HasTile = true;
|
||||
tTile.TileType = (ushort)tileType;
|
||||
WorldGen.SquareTileFrame(tileX, tileY);
|
||||
}
|
||||
else
|
||||
{
|
||||
tTile.WallType = (ushort)ModContent.WallType<GiantHiveWall>();
|
||||
WorldGen.SquareWallFrame(tileX, tileY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void ClearHexagon(int centerX, int centerY, int hexagonSize)
|
||||
{
|
||||
int halfHexagonSize = hexagonSize / 2;
|
||||
@@ -456,11 +488,42 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void GiantHiveWallHexagon(int centerX, int centerY, int hexagonSize)
|
||||
{
|
||||
int halfHexagonSize = hexagonSize / 2;
|
||||
|
||||
for (int x = -halfHexagonSize; x <= halfHexagonSize; x++)
|
||||
{
|
||||
int y1 = Math.Abs(x) / 2;
|
||||
int y2 = hexagonSize - Math.Abs(x) / 2;
|
||||
|
||||
for (int y = y1; y < y2; y++)
|
||||
{
|
||||
int tileX = centerX + x;
|
||||
int tileY = centerY + y;
|
||||
|
||||
if (WorldGen.InWorld(tileX, tileY))
|
||||
{
|
||||
Tile tTile = Main.tile[tileX, tileY];
|
||||
tTile.HasTile = false;
|
||||
tTile.WallType = (ushort)ModContent.WallType<GiantHiveWall>();
|
||||
tTile.LiquidAmount = 0;
|
||||
WorldGen.SquareWallFrame(tileX, tileY);
|
||||
if (WorldGen.genRand.NextBool(15))
|
||||
{
|
||||
tTile.LiquidAmount = 100;
|
||||
tTile.LiquidType = LiquidID.Honey;
|
||||
WorldGen.SquareTileFrame(tileX, tileY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static Vector2 MakeCell(int x, int y, UnifiedRandom random)
|
||||
{
|
||||
CreateHexagon(x, y - 30, 110, TileID.Hive);
|
||||
CreateHexagon(x, y - 30, 108, TileID.Hive, true);
|
||||
ClearHexagon(x, y - 22, 90);
|
||||
CreateGiantHiveHexagon(x, y - 30, 108, TileID.Hive, true);
|
||||
GiantHiveWallHexagon(x, y - 22, 90);
|
||||
|
||||
|
||||
|
||||
@@ -535,11 +598,12 @@ namespace CalamityMod.World
|
||||
if (!overlaps)
|
||||
{
|
||||
int hexRadius = WorldGen.genRand.Next(30, 45);
|
||||
CreateHexagon(newX, newY - 15, hexRadius - 1, TileID.Hive, true);
|
||||
CreateGiantHiveHexagon(newX, newY - 15, hexRadius - 1, TileID.Hive, true);
|
||||
CreateHexagon(newX, newY - 15, hexRadius, TileID.Hive);
|
||||
ClearTunnel(x, y + 30, newX, newY, 5);
|
||||
CreateTunnel(x, y + 30, newX, newY);
|
||||
ClearTunnel(x, y + 30, newX, newY);
|
||||
ClearHexagon(newX, newY - 10, WorldGen.genRand.Next(19, 26));
|
||||
ClearTunnel(x, y + 30, newX, newY, 3);
|
||||
GiantHiveWallHexagon(newX, newY - 10, WorldGen.genRand.Next(19, 26));
|
||||
|
||||
// Place honey chest in this cell with a small chance
|
||||
if (chestsPlaced < chestMax)
|
||||
@@ -554,7 +618,8 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
|
||||
ClearHexagon(x, y - 22, 90);
|
||||
GiantHiveWallHexagon(x, y - 22, 90);
|
||||
ClearHexagon(x, y - 18, 80);
|
||||
|
||||
return new Vector2(x, y);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user