Tile changes

This commit is contained in:
dingo
2026-01-01 17:15:07 -05:00
parent 07b599e8d1
commit bcb130cb69
11 changed files with 3657 additions and 604 deletions
File diff suppressed because it is too large Load Diff
+1 -14
View File
@@ -172,17 +172,4 @@ public class DungeonLayoutV2 : DungeonLayout
}
}
/// <summary>
/// Tilemap sheet info for client
/// </summary>
public class TileMapSheetInfo
{
public int Id { get; set; }
public string CdnPath { get; set; } = "";
public int TileWidth { get; set; }
public int TileHeight { get; set; }
public int SheetWidth { get; set; }
public int SheetHeight { get; set; }
public int Columns { get; set; }
public int Rows { get; set; }
}
+48
View File
@@ -0,0 +1,48 @@
using DataServer.Data.Entities;
using Server.Game.Dungeon;
namespace Server.Game.Dungeon
{
/// <summary>
/// Extended room with template info
/// </summary>
public class DungeonRoomV2 : DungeonRoom
{
public int? TemplateId { get; set; }
public string? TemplateName { get; set; }
public HashSet<string> TemplateTags { get; set; } = new(StringComparer.OrdinalIgnoreCase);
public new RoomType Type { get; set; } = RoomType.Normal;
/// <summary>Connection points parsed from template</summary>
public List<ConnectionPoint> ConnectionPoints { get; set; } = new();
public DungeonRoomV2(int x, int y, int width, int height) : base(x, y, width, height) { }
/// <summary>Get the best connection point for a given direction</summary>
public ConnectionPoint? GetConnectionPoint(string direction)
{
// First try exact match
var exact = ConnectionPoints.FirstOrDefault(c => c.Direction.Equals(direction, StringComparison.OrdinalIgnoreCase));
if (exact != null) return exact;
// No exact match - create a default one for this direction rather than using wrong direction
// This ensures the connection point is actually on the correct edge
return direction.ToLower() switch
{
"north" => new ConnectionPoint { X = Width / 2, Y = 0, Direction = "north", Width = 3 },
"south" => new ConnectionPoint { X = Width / 2, Y = Height - 1, Direction = "south", Width = 3 },
"east" => new ConnectionPoint { X = Width - 1, Y = Height / 2, Direction = "east", Width = 3 },
"west" => new ConnectionPoint { X = 0, Y = Height / 2, Direction = "west", Width = 3 },
_ => ConnectionPoints.FirstOrDefault() // Last resort fallback
};
}
/// <summary>Get world position of a connection point</summary>
public (int X, int Y) GetConnectionWorldPos(ConnectionPoint cp)
{
return (X + cp.X, Y + cp.Y);
}
}
}
+18
View File
@@ -0,0 +1,18 @@
namespace Server.Game.Dungeon
{
/// <summary>
/// Placed tile with details
/// </summary>
public class PlacedTile
{
public int X { get; set; }
public int Y { get; set; }
public int TileDefinitionId { get; set; }
public int SheetId { get; set; } // For client rendering
public int FrameIndex { get; set; } // Frame in the sheet
public int Layer { get; set; }
public int Rotation { get; set; }
public bool FlipX { get; set; }
public bool FlipY { get; set; }
}
}
+17
View File
@@ -0,0 +1,17 @@
namespace Server.Game.Dungeon
{
/// <summary>
/// Tilemap sheet info for client
/// </summary>
public class TileMapSheetInfo
{
public int Id { get; set; }
public string CdnPath { get; set; } = "";
public int TileWidth { get; set; }
public int TileHeight { get; set; }
public int SheetWidth { get; set; }
public int SheetHeight { get; set; }
public int Columns { get; set; }
public int Rows { get; set; }
}
}