Tile changes
This commit is contained in:
+381
-454
File diff suppressed because it is too large
Load Diff
@@ -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; }
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+2580
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,110 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace SystemRevivalServer.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class TileChanges : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "SocketE",
|
||||||
|
table: "tile_definitions",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "SocketECustom",
|
||||||
|
table: "tile_definitions",
|
||||||
|
type: "varchar(32)",
|
||||||
|
maxLength: 32,
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "SocketN",
|
||||||
|
table: "tile_definitions",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "SocketNCustom",
|
||||||
|
table: "tile_definitions",
|
||||||
|
type: "varchar(32)",
|
||||||
|
maxLength: 32,
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "SocketS",
|
||||||
|
table: "tile_definitions",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "SocketSCustom",
|
||||||
|
table: "tile_definitions",
|
||||||
|
type: "varchar(32)",
|
||||||
|
maxLength: 32,
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "SocketW",
|
||||||
|
table: "tile_definitions",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "SocketWCustom",
|
||||||
|
table: "tile_definitions",
|
||||||
|
type: "varchar(32)",
|
||||||
|
maxLength: 32,
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SocketE",
|
||||||
|
table: "tile_definitions");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SocketECustom",
|
||||||
|
table: "tile_definitions");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SocketN",
|
||||||
|
table: "tile_definitions");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SocketNCustom",
|
||||||
|
table: "tile_definitions");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SocketS",
|
||||||
|
table: "tile_definitions");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SocketSCustom",
|
||||||
|
table: "tile_definitions");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SocketW",
|
||||||
|
table: "tile_definitions");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SocketWCustom",
|
||||||
|
table: "tile_definitions");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1960,6 +1960,34 @@ namespace SystemRevivalServer.Migrations
|
|||||||
b.Property<int>("RenderLayer")
|
b.Property<int>("RenderLayer")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SocketE")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("SocketECustom")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("varchar(32)");
|
||||||
|
|
||||||
|
b.Property<int>("SocketN")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("SocketNCustom")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("varchar(32)");
|
||||||
|
|
||||||
|
b.Property<int>("SocketS")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("SocketSCustom")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("varchar(32)");
|
||||||
|
|
||||||
|
b.Property<int>("SocketW")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("SocketWCustom")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("varchar(32)");
|
||||||
|
|
||||||
b.Property<string>("Tags")
|
b.Property<string>("Tags")
|
||||||
.HasMaxLength(256)
|
.HasMaxLength(256)
|
||||||
.HasColumnType("varchar(256)");
|
.HasColumnType("varchar(256)");
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["Title"] = Model.Sheet.Id == 0 ? "New TileMap Sheet" : $"Edit: {Model.Sheet.Name}";
|
ViewData["Title"] = Model.Sheet.Id == 0 ? "New TileMap Sheet" : $"Edit: {Model.Sheet.Name}";
|
||||||
var tileTypes = Enum.GetValues<TileType>();
|
var tileTypes = Enum.GetValues<TileType>();
|
||||||
|
var socketTypes = Enum.GetValues<SocketType>();
|
||||||
// Build image URL - handle both with and without /downloads/ path
|
// Build image URL - handle both with and without /downloads/ path
|
||||||
var imageUrl = Model.Sheet.CdnPath;
|
var imageUrl = Model.Sheet.CdnPath;
|
||||||
if (!string.IsNullOrEmpty(imageUrl))
|
if (!string.IsNullOrEmpty(imageUrl))
|
||||||
@@ -131,7 +132,7 @@
|
|||||||
<div class="card p-4 md:p-6 mt-4 md:mt-6">
|
<div class="card p-4 md:p-6 mt-4 md:mt-6">
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4">
|
||||||
<h2 class="text-lg md:text-xl font-semibold text-white">Tile Definitions</h2>
|
<h2 class="text-lg md:text-xl font-semibold text-white">Tile Definitions</h2>
|
||||||
<div class="flex gap-2">
|
<div class="flex flex-wrap gap-2">
|
||||||
<form method="post" asp-page-handler="AutoGenerate" class="flex gap-2">
|
<form method="post" asp-page-handler="AutoGenerate" class="flex gap-2">
|
||||||
<input type="hidden" name="sheetId" value="@Model.Sheet.Id" />
|
<input type="hidden" name="sheetId" value="@Model.Sheet.Id" />
|
||||||
<select name="defaultType" class="input text-sm py-1">
|
<select name="defaultType" class="input text-sm py-1">
|
||||||
@@ -140,6 +141,12 @@
|
|||||||
</select>
|
</select>
|
||||||
<button type="submit" class="btn btn-secondary text-sm py-1">Auto-Generate</button>
|
<button type="submit" class="btn btn-secondary text-sm py-1">Auto-Generate</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<!-- Socket bulk actions -->
|
||||||
|
<form method="post" asp-page-handler="AutoConfigureSockets" class="inline">
|
||||||
|
<input type="hidden" name="sheetId" value="@Model.Sheet.Id" />
|
||||||
|
<button type="submit" class="btn btn-secondary text-sm py-1" title="Set sockets based on tile type">Auto Sockets</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -197,14 +204,14 @@
|
|||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<h3 class="text-base md:text-lg font-semibold text-white mb-3">Defined Tiles (@Model.TileDefinitions.Count)</h3>
|
<h3 class="text-base md:text-lg font-semibold text-white mb-3">Defined Tiles (@Model.TileDefinitions.Count)</h3>
|
||||||
<div class="overflow-x-auto -mx-4 md:mx-0">
|
<div class="overflow-x-auto -mx-4 md:mx-0">
|
||||||
<table class="w-full text-xs md:text-sm min-w-[600px]">
|
<table class="w-full text-xs md:text-sm min-w-[700px]">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="text-left text-gray-400 border-b border-gray-700">
|
<tr class="text-left text-gray-400 border-b border-gray-700">
|
||||||
<th class="p-2">#</th>
|
<th class="p-2">#</th>
|
||||||
<th class="p-2">Preview</th>
|
<th class="p-2">Preview</th>
|
||||||
<th class="p-2">Name</th>
|
<th class="p-2">Name</th>
|
||||||
<th class="p-2">Type</th>
|
<th class="p-2">Type</th>
|
||||||
<th class="p-2">Tags</th>
|
<th class="p-2">Sockets</th>
|
||||||
<th class="p-2">Props</th>
|
<th class="p-2">Props</th>
|
||||||
<th class="p-2">Actions</th>
|
<th class="p-2">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -226,11 +233,16 @@
|
|||||||
<td class="p-2">
|
<td class="p-2">
|
||||||
<span class="px-1.5 py-0.5 text-xs rounded" style="background-color: @GetTileTypeColor(tile.Type);">@tile.Type</span>
|
<span class="px-1.5 py-0.5 text-xs rounded" style="background-color: @GetTileTypeColor(tile.Type);">@tile.Type</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="p-2 text-gray-400 text-xs max-w-[80px] truncate">@(tile.Tags ?? "-")</td>
|
|
||||||
<td class="p-2 text-xs">
|
<td class="p-2 text-xs">
|
||||||
@if (tile.IsWalkable) { <span class="text-green-400">W</span> }
|
<span class="@GetSocketBadgeClass(tile.SocketN)" title="North">N</span>
|
||||||
@if (tile.BlocksProjectiles) { <span class="text-red-400">P</span> }
|
<span class="@GetSocketBadgeClass(tile.SocketE)" title="East">E</span>
|
||||||
@if (tile.BlocksLineOfSight) { <span class="text-yellow-400">L</span> }
|
<span class="@GetSocketBadgeClass(tile.SocketS)" title="South">S</span>
|
||||||
|
<span class="@GetSocketBadgeClass(tile.SocketW)" title="West">W</span>
|
||||||
|
</td>
|
||||||
|
<td class="p-2 text-xs">
|
||||||
|
@if (tile.IsWalkable) { <span class="text-green-400" title="Walkable">W</span> }
|
||||||
|
@if (tile.BlocksProjectiles) { <span class="text-red-400" title="Blocks Projectiles">P</span> }
|
||||||
|
@if (tile.BlocksLineOfSight) { <span class="text-yellow-400" title="Blocks LOS">L</span> }
|
||||||
</td>
|
</td>
|
||||||
<td class="p-2">
|
<td class="p-2">
|
||||||
<button onclick="openTileEditor(@tile.FrameIndex, @tile.Id)" class="text-blue-400 hover:text-blue-300 mr-1">Edit</button>
|
<button onclick="openTileEditor(@tile.FrameIndex, @tile.Id)" class="text-blue-400 hover:text-blue-300 mr-1">Edit</button>
|
||||||
@@ -256,7 +268,7 @@
|
|||||||
|
|
||||||
<!-- Tile Editor Modal -->
|
<!-- Tile Editor Modal -->
|
||||||
<div id="tileEditorModal" class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center p-4">
|
<div id="tileEditorModal" class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center p-4">
|
||||||
<div class="bg-gray-900 rounded-xl shadow-xl p-4 md:p-6 w-full max-w-md border border-gray-700 max-h-[90vh] overflow-y-auto">
|
<div class="bg-gray-900 rounded-xl shadow-xl p-4 md:p-6 w-full max-w-lg border border-gray-700 max-h-[90vh] overflow-y-auto">
|
||||||
<h3 class="text-lg font-semibold text-white mb-4">Edit Tile <span id="modalFrameIndex"></span></h3>
|
<h3 class="text-lg font-semibold text-white mb-4">Edit Tile <span id="modalFrameIndex"></span></h3>
|
||||||
|
|
||||||
<form method="post" asp-page-handler="SaveTile">
|
<form method="post" asp-page-handler="SaveTile">
|
||||||
@@ -275,14 +287,25 @@
|
|||||||
<input type="text" name="name" id="editName" class="input w-full text-sm" placeholder="Stone Floor A" />
|
<input type="text" name="name" id="editName" class="input w-full text-sm" placeholder="Stone Floor A" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="grid grid-cols-2 gap-3">
|
||||||
<label class="block text-sm font-medium text-gray-300 mb-1">Type</label>
|
<div>
|
||||||
<select name="type" id="editType" class="input w-full text-sm">
|
<label class="block text-sm font-medium text-gray-300 mb-1">Type</label>
|
||||||
@foreach (var t in tileTypes)
|
<select name="type" id="editType" class="input w-full text-sm" onchange="onTypeChange()">
|
||||||
{
|
@foreach (var t in tileTypes)
|
||||||
<option value="@((int)t)">@t</option>
|
{
|
||||||
}
|
<option value="@((int)t)">@t</option>
|
||||||
</select>
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-medium text-gray-300 mb-1">Render Layer</label>
|
||||||
|
<select name="renderLayer" id="editRenderLayer" class="input w-full text-sm">
|
||||||
|
<option value="0">0 - Ground</option>
|
||||||
|
<option value="1">1 - Floor Decor</option>
|
||||||
|
<option value="2">2 - Walls</option>
|
||||||
|
<option value="3">3 - Ceiling</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -290,14 +313,69 @@
|
|||||||
<input type="text" name="tags" id="editTags" class="input w-full text-sm" placeholder="stone, cracked" />
|
<input type="text" name="tags" id="editTags" class="input w-full text-sm" placeholder="stone, cracked" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<!-- Socket Configuration -->
|
||||||
<label class="block text-sm font-medium text-gray-300 mb-1">Render Layer</label>
|
<div class="border border-gray-700 rounded-lg p-3">
|
||||||
<select name="renderLayer" id="editRenderLayer" class="input w-full text-sm">
|
<div class="flex items-center justify-between mb-2">
|
||||||
<option value="0">0 - Ground</option>
|
<label class="text-sm font-medium text-gray-300">Sockets</label>
|
||||||
<option value="1">1 - Floor Decor</option>
|
<div class="flex gap-1">
|
||||||
<option value="2">2 - Walls</option>
|
<button type="button" onclick="setAllSockets(1)" class="text-xs px-2 py-0.5 bg-green-900/50 text-green-400 rounded hover:bg-green-900">All Open</button>
|
||||||
<option value="3">3 - Ceiling</option>
|
<button type="button" onclick="setAllSockets(0)" class="text-xs px-2 py-0.5 bg-red-900/50 text-red-400 rounded hover:bg-red-900">All Closed</button>
|
||||||
</select>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-3 gap-2 text-center">
|
||||||
|
<!-- North -->
|
||||||
|
<div></div>
|
||||||
|
<div>
|
||||||
|
<label class="text-xs text-gray-400 block">North</label>
|
||||||
|
<select name="socketN" id="editSocketN" class="input w-full text-xs py-1" onchange="updateSocketCustom('N')">
|
||||||
|
<option value="0">Closed</option>
|
||||||
|
<option value="1">Open</option>
|
||||||
|
<option value="2">Custom</option>
|
||||||
|
</select>
|
||||||
|
<input type="text" name="socketNCustom" id="editSocketNCustom" class="input w-full text-xs py-1 mt-1 hidden" placeholder="Custom type" />
|
||||||
|
</div>
|
||||||
|
<div></div>
|
||||||
|
|
||||||
|
<!-- West / Center / East -->
|
||||||
|
<div>
|
||||||
|
<label class="text-xs text-gray-400 block">West</label>
|
||||||
|
<select name="socketW" id="editSocketW" class="input w-full text-xs py-1" onchange="updateSocketCustom('W')">
|
||||||
|
<option value="0">Closed</option>
|
||||||
|
<option value="1">Open</option>
|
||||||
|
<option value="2">Custom</option>
|
||||||
|
</select>
|
||||||
|
<input type="text" name="socketWCustom" id="editSocketWCustom" class="input w-full text-xs py-1 mt-1 hidden" placeholder="Custom type" />
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center justify-center">
|
||||||
|
<div class="w-8 h-8 bg-gray-700 rounded flex items-center justify-center text-gray-500">
|
||||||
|
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"><rect x="2" y="2" width="16" height="16" rx="2"/></svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="text-xs text-gray-400 block">East</label>
|
||||||
|
<select name="socketE" id="editSocketE" class="input w-full text-xs py-1" onchange="updateSocketCustom('E')">
|
||||||
|
<option value="0">Closed</option>
|
||||||
|
<option value="1">Open</option>
|
||||||
|
<option value="2">Custom</option>
|
||||||
|
</select>
|
||||||
|
<input type="text" name="socketECustom" id="editSocketECustom" class="input w-full text-xs py-1 mt-1 hidden" placeholder="Custom type" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- South -->
|
||||||
|
<div></div>
|
||||||
|
<div>
|
||||||
|
<label class="text-xs text-gray-400 block">South</label>
|
||||||
|
<select name="socketS" id="editSocketS" class="input w-full text-xs py-1" onchange="updateSocketCustom('S')">
|
||||||
|
<option value="0">Closed</option>
|
||||||
|
<option value="1">Open</option>
|
||||||
|
<option value="2">Custom</option>
|
||||||
|
</select>
|
||||||
|
<input type="text" name="socketSCustom" id="editSocketSCustom" class="input w-full text-xs py-1 mt-1 hidden" placeholder="Custom type" />
|
||||||
|
</div>
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-gray-500 mt-2">Open↔Open, Closed↔Closed. Custom must match exactly.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-3 gap-2 text-sm">
|
<div class="grid grid-cols-3 gap-2 text-sm">
|
||||||
@@ -353,7 +431,11 @@
|
|||||||
|
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
<script>
|
<script>
|
||||||
const tileDefinitions = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(Model.TileDefinitions.ToDictionary(t => t.FrameIndex, t => new { t.Id, t.FrameIndex, t.Name, t.Type, t.Tags, t.IsWalkable, t.BlocksProjectiles, t.BlocksLineOfSight, t.RenderLayer })));
|
const tileDefinitions = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(Model.TileDefinitions.ToDictionary(t => t.FrameIndex, t => new {
|
||||||
|
t.Id, t.FrameIndex, t.Name, t.Type, t.Tags, t.IsWalkable, t.BlocksProjectiles, t.BlocksLineOfSight, t.RenderLayer,
|
||||||
|
SocketN = (int)t.SocketN, SocketE = (int)t.SocketE, SocketS = (int)t.SocketS, SocketW = (int)t.SocketW,
|
||||||
|
t.SocketNCustom, t.SocketECustom, t.SocketSCustom, t.SocketWCustom
|
||||||
|
})));
|
||||||
const sheetWidth = @Model.Sheet.SheetWidth;
|
const sheetWidth = @Model.Sheet.SheetWidth;
|
||||||
const sheetHeight = @Model.Sheet.SheetHeight;
|
const sheetHeight = @Model.Sheet.SheetHeight;
|
||||||
const tileWidth = @Model.Sheet.TileWidth;
|
const tileWidth = @Model.Sheet.TileWidth;
|
||||||
@@ -387,6 +469,15 @@
|
|||||||
document.getElementById('editWalkable').checked = existing.IsWalkable;
|
document.getElementById('editWalkable').checked = existing.IsWalkable;
|
||||||
document.getElementById('editBlocksProj').checked = existing.BlocksProjectiles;
|
document.getElementById('editBlocksProj').checked = existing.BlocksProjectiles;
|
||||||
document.getElementById('editBlocksLOS').checked = existing.BlocksLineOfSight;
|
document.getElementById('editBlocksLOS').checked = existing.BlocksLineOfSight;
|
||||||
|
// Sockets
|
||||||
|
document.getElementById('editSocketN').value = existing.SocketN;
|
||||||
|
document.getElementById('editSocketE').value = existing.SocketE;
|
||||||
|
document.getElementById('editSocketS').value = existing.SocketS;
|
||||||
|
document.getElementById('editSocketW').value = existing.SocketW;
|
||||||
|
document.getElementById('editSocketNCustom').value = existing.SocketNCustom || '';
|
||||||
|
document.getElementById('editSocketECustom').value = existing.SocketECustom || '';
|
||||||
|
document.getElementById('editSocketSCustom').value = existing.SocketSCustom || '';
|
||||||
|
document.getElementById('editSocketWCustom').value = existing.SocketWCustom || '';
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('editName').value = '';
|
document.getElementById('editName').value = '';
|
||||||
document.getElementById('editType').value = '0';
|
document.getElementById('editType').value = '0';
|
||||||
@@ -395,8 +486,20 @@
|
|||||||
document.getElementById('editWalkable').checked = true;
|
document.getElementById('editWalkable').checked = true;
|
||||||
document.getElementById('editBlocksProj').checked = false;
|
document.getElementById('editBlocksProj').checked = false;
|
||||||
document.getElementById('editBlocksLOS').checked = false;
|
document.getElementById('editBlocksLOS').checked = false;
|
||||||
|
// Default sockets for new tile
|
||||||
|
document.getElementById('editSocketN').value = '1'; // Open
|
||||||
|
document.getElementById('editSocketE').value = '1';
|
||||||
|
document.getElementById('editSocketS').value = '1';
|
||||||
|
document.getElementById('editSocketW').value = '1';
|
||||||
|
document.getElementById('editSocketNCustom').value = '';
|
||||||
|
document.getElementById('editSocketECustom').value = '';
|
||||||
|
document.getElementById('editSocketSCustom').value = '';
|
||||||
|
document.getElementById('editSocketWCustom').value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update custom field visibility
|
||||||
|
['N', 'E', 'S', 'W'].forEach(updateSocketCustom);
|
||||||
|
|
||||||
document.getElementById('tileEditorModal').classList.remove('hidden');
|
document.getElementById('tileEditorModal').classList.remove('hidden');
|
||||||
document.getElementById('tileEditorModal').classList.add('flex');
|
document.getElementById('tileEditorModal').classList.add('flex');
|
||||||
}
|
}
|
||||||
@@ -406,6 +509,33 @@
|
|||||||
document.getElementById('tileEditorModal').classList.remove('flex');
|
document.getElementById('tileEditorModal').classList.remove('flex');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateSocketCustom(dir) {
|
||||||
|
const select = document.getElementById('editSocket' + dir);
|
||||||
|
const custom = document.getElementById('editSocket' + dir + 'Custom');
|
||||||
|
custom.classList.toggle('hidden', select.value !== '2');
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAllSockets(value) {
|
||||||
|
['N', 'E', 'S', 'W'].forEach(dir => {
|
||||||
|
document.getElementById('editSocket' + dir).value = value;
|
||||||
|
updateSocketCustom(dir);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTypeChange() {
|
||||||
|
const type = parseInt(document.getElementById('editType').value);
|
||||||
|
// Auto-set sockets based on type
|
||||||
|
if (type === 0 || type === 30) { // Floor, FloorDecor
|
||||||
|
setAllSockets(1); // Open
|
||||||
|
document.getElementById('editWalkable').checked = true;
|
||||||
|
} else if (type === 1 || type === 31) { // Wall, WallDecor
|
||||||
|
setAllSockets(0); // Closed
|
||||||
|
document.getElementById('editWalkable').checked = false;
|
||||||
|
document.getElementById('editBlocksProj').checked = true;
|
||||||
|
document.getElementById('editBlocksLOS').checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function showCdnBrowser() {
|
function showCdnBrowser() {
|
||||||
document.getElementById('cdnBrowserModal').classList.remove('hidden');
|
document.getElementById('cdnBrowserModal').classList.remove('hidden');
|
||||||
document.getElementById('cdnBrowserModal').classList.add('flex');
|
document.getElementById('cdnBrowserModal').classList.add('flex');
|
||||||
@@ -490,4 +620,15 @@
|
|||||||
_ => "transparent"
|
_ => "transparent"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string GetSocketBadgeClass(SocketType socket)
|
||||||
|
{
|
||||||
|
return socket switch
|
||||||
|
{
|
||||||
|
SocketType.Open => "text-green-400",
|
||||||
|
SocketType.Closed => "text-red-400",
|
||||||
|
SocketType.Custom => "text-yellow-400",
|
||||||
|
_ => "text-gray-400"
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public class EditModel : AdminPageModel
|
|||||||
|
|
||||||
public async Task OnGetAsync(int? id)
|
public async Task OnGetAsync(int? id)
|
||||||
{
|
{
|
||||||
//CdnBaseUrl = _config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com";
|
|
||||||
CdnBaseUrl = NormalizeCdnBaseUrl(_config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com");
|
CdnBaseUrl = NormalizeCdnBaseUrl(_config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com");
|
||||||
CdnImages = await _db.ClientAssets
|
CdnImages = await _db.ClientAssets
|
||||||
.Where(a => a.AssetType == ClientAssetType.Texture && a.IsEnabled)
|
.Where(a => a.AssetType == ClientAssetType.Texture && a.IsEnabled)
|
||||||
@@ -70,7 +69,6 @@ public class EditModel : AdminPageModel
|
|||||||
|
|
||||||
public async Task<IActionResult> OnPostAsync()
|
public async Task<IActionResult> OnPostAsync()
|
||||||
{
|
{
|
||||||
//CdnBaseUrl = _config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com";
|
|
||||||
CdnBaseUrl = NormalizeCdnBaseUrl(_config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com");
|
CdnBaseUrl = NormalizeCdnBaseUrl(_config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -127,7 +125,25 @@ public class EditModel : AdminPageModel
|
|||||||
return Page();
|
return Page();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPostSaveTileAsync(int sheetId, int frameIndex, string? name, int type, string? tags, bool isWalkable, bool blocksProjectiles, bool blocksLineOfSight, int renderLayer)
|
public async Task<IActionResult> OnPostSaveTileAsync(
|
||||||
|
int sheetId,
|
||||||
|
int frameIndex,
|
||||||
|
string? name,
|
||||||
|
int type,
|
||||||
|
string? tags,
|
||||||
|
bool isWalkable,
|
||||||
|
bool blocksProjectiles,
|
||||||
|
bool blocksLineOfSight,
|
||||||
|
int renderLayer,
|
||||||
|
// Socket fields
|
||||||
|
int socketN,
|
||||||
|
int socketE,
|
||||||
|
int socketS,
|
||||||
|
int socketW,
|
||||||
|
string? socketNCustom,
|
||||||
|
string? socketECustom,
|
||||||
|
string? socketSCustom,
|
||||||
|
string? socketWCustom)
|
||||||
{
|
{
|
||||||
var existing = await _db.TileDefinitions
|
var existing = await _db.TileDefinitions
|
||||||
.FirstOrDefaultAsync(t => t.TileMapSheetId == sheetId && t.FrameIndex == frameIndex);
|
.FirstOrDefaultAsync(t => t.TileMapSheetId == sheetId && t.FrameIndex == frameIndex);
|
||||||
@@ -141,6 +157,15 @@ public class EditModel : AdminPageModel
|
|||||||
existing.BlocksProjectiles = blocksProjectiles;
|
existing.BlocksProjectiles = blocksProjectiles;
|
||||||
existing.BlocksLineOfSight = blocksLineOfSight;
|
existing.BlocksLineOfSight = blocksLineOfSight;
|
||||||
existing.RenderLayer = renderLayer;
|
existing.RenderLayer = renderLayer;
|
||||||
|
// Socket fields
|
||||||
|
existing.SocketN = (SocketType)socketN;
|
||||||
|
existing.SocketE = (SocketType)socketE;
|
||||||
|
existing.SocketS = (SocketType)socketS;
|
||||||
|
existing.SocketW = (SocketType)socketW;
|
||||||
|
existing.SocketNCustom = socketN == 2 ? socketNCustom : null;
|
||||||
|
existing.SocketECustom = socketE == 2 ? socketECustom : null;
|
||||||
|
existing.SocketSCustom = socketS == 2 ? socketSCustom : null;
|
||||||
|
existing.SocketWCustom = socketW == 2 ? socketWCustom : null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -155,7 +180,16 @@ public class EditModel : AdminPageModel
|
|||||||
BlocksProjectiles = blocksProjectiles,
|
BlocksProjectiles = blocksProjectiles,
|
||||||
BlocksLineOfSight = blocksLineOfSight,
|
BlocksLineOfSight = blocksLineOfSight,
|
||||||
RenderLayer = renderLayer,
|
RenderLayer = renderLayer,
|
||||||
IsEnabled = true
|
IsEnabled = true,
|
||||||
|
// Socket fields
|
||||||
|
SocketN = (SocketType)socketN,
|
||||||
|
SocketE = (SocketType)socketE,
|
||||||
|
SocketS = (SocketType)socketS,
|
||||||
|
SocketW = (SocketType)socketW,
|
||||||
|
SocketNCustom = socketN == 2 ? socketNCustom : null,
|
||||||
|
SocketECustom = socketE == 2 ? socketECustom : null,
|
||||||
|
SocketSCustom = socketS == 2 ? socketSCustom : null,
|
||||||
|
SocketWCustom = socketW == 2 ? socketWCustom : null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,20 +224,65 @@ public class EditModel : AdminPageModel
|
|||||||
{
|
{
|
||||||
if (!existingFrames.Contains(i))
|
if (!existingFrames.Contains(i))
|
||||||
{
|
{
|
||||||
_db.TileDefinitions.Add(new TileDefinition
|
var tile = new TileDefinition
|
||||||
{
|
{
|
||||||
TileMapSheetId = sheetId,
|
TileMapSheetId = sheetId,
|
||||||
FrameIndex = i,
|
FrameIndex = i,
|
||||||
Type = (TileType)defaultType,
|
Type = (TileType)defaultType,
|
||||||
IsWalkable = defaultType == 0, // Floor is walkable
|
IsWalkable = defaultType == 0, // Floor is walkable
|
||||||
IsEnabled = true
|
IsEnabled = true
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// Auto-configure sockets based on type
|
||||||
|
tile.AutoConfigureSockets();
|
||||||
|
|
||||||
|
_db.TileDefinitions.Add(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.SaveChangesAsync();
|
await _db.SaveChangesAsync();
|
||||||
return RedirectToPage(new { id = sheetId });
|
return RedirectToPage(new { id = sheetId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Auto-configure sockets for all tiles based on their type
|
||||||
|
/// </summary>
|
||||||
|
public async Task<IActionResult> OnPostAutoConfigureSocketsAsync(int sheetId)
|
||||||
|
{
|
||||||
|
var tiles = await _db.TileDefinitions
|
||||||
|
.Where(t => t.TileMapSheetId == sheetId)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (var tile in tiles)
|
||||||
|
{
|
||||||
|
tile.AutoConfigureSockets();
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.SaveChangesAsync();
|
||||||
|
Message = $"Auto-configured sockets for {tiles.Count} tiles.";
|
||||||
|
return RedirectToPage(new { id = sheetId });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bulk set all tile sockets to a specific type
|
||||||
|
/// </summary>
|
||||||
|
public async Task<IActionResult> OnPostBulkSetSocketsAsync(int sheetId, int socketType)
|
||||||
|
{
|
||||||
|
var tiles = await _db.TileDefinitions
|
||||||
|
.Where(t => t.TileMapSheetId == sheetId)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var type = (SocketType)socketType;
|
||||||
|
foreach (var tile in tiles)
|
||||||
|
{
|
||||||
|
tile.SetAllSockets(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.SaveChangesAsync();
|
||||||
|
Message = $"Set all sockets to {type} for {tiles.Count} tiles.";
|
||||||
|
return RedirectToPage(new { id = sheetId });
|
||||||
|
}
|
||||||
|
|
||||||
private string NormalizeCdnBaseUrl(string? baseUrl)
|
private string NormalizeCdnBaseUrl(string? baseUrl)
|
||||||
{
|
{
|
||||||
baseUrl = string.IsNullOrWhiteSpace(baseUrl)
|
baseUrl = string.IsNullOrWhiteSpace(baseUrl)
|
||||||
|
|||||||
+223
-105
@@ -11,51 +11,66 @@ public class TileMapSheet
|
|||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>Friendly name (e.g., "Dungeon Stone Set", "Cave Tiles")</summary>
|
/// <summary>Friendly name (e.g., "Dungeon Stone Set", "Cave Tiles")</summary>
|
||||||
[Required, MaxLength(64)]
|
[Required, MaxLength(64)]
|
||||||
public string Name { get; set; } = "";
|
public string Name { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>CDN path (e.g., "textures/tilemaps/dungeon_stone.png")</summary>
|
/// <summary>CDN path (e.g., "textures/tilemaps/dungeon_stone.png")</summary>
|
||||||
[Required, MaxLength(256)]
|
[Required, MaxLength(256)]
|
||||||
public string CdnPath { get; set; } = "";
|
public string CdnPath { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>Tags for categorization (e.g., "dungeon,stone,dark")</summary>
|
/// <summary>Tags for categorization (e.g., "dungeon,stone,dark")</summary>
|
||||||
[MaxLength(256)]
|
[MaxLength(256)]
|
||||||
public string? Tags { get; set; }
|
public string? Tags { get; set; }
|
||||||
|
|
||||||
/// <summary>Total width of sprite sheet in pixels</summary>
|
/// <summary>Total width of sprite sheet in pixels</summary>
|
||||||
public int SheetWidth { get; set; } = 512;
|
public int SheetWidth { get; set; } = 512;
|
||||||
|
|
||||||
/// <summary>Total height of sprite sheet in pixels</summary>
|
/// <summary>Total height of sprite sheet in pixels</summary>
|
||||||
public int SheetHeight { get; set; } = 512;
|
public int SheetHeight { get; set; } = 512;
|
||||||
|
|
||||||
/// <summary>Width of each tile in pixels</summary>
|
/// <summary>Width of each tile in pixels</summary>
|
||||||
public int TileWidth { get; set; } = 32;
|
public int TileWidth { get; set; } = 32;
|
||||||
|
|
||||||
/// <summary>Height of each tile in pixels (for isometric, often 16 or TileWidth/2)</summary>
|
/// <summary>Height of each tile in pixels (for isometric, often 16 or TileWidth/2)</summary>
|
||||||
public int TileHeight { get; set; } = 32;
|
public int TileHeight { get; set; } = 32;
|
||||||
|
|
||||||
/// <summary>Number of columns in sheet</summary>
|
/// <summary>Number of columns in sheet</summary>
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public int Columns => TileWidth > 0 ? SheetWidth / TileWidth : 1;
|
public int Columns => TileWidth > 0 ? SheetWidth / TileWidth : 1;
|
||||||
|
|
||||||
/// <summary>Number of rows in sheet</summary>
|
/// <summary>Number of rows in sheet</summary>
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public int Rows => TileHeight > 0 ? SheetHeight / TileHeight : 1;
|
public int Rows => TileHeight > 0 ? SheetHeight / TileHeight : 1;
|
||||||
|
|
||||||
/// <summary>Total tile count</summary>
|
/// <summary>Total tile count</summary>
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public int TotalTiles => Columns * Rows;
|
public int TotalTiles => Columns * Rows;
|
||||||
|
|
||||||
public bool IsEnabled { get; set; } = true;
|
public bool IsEnabled { get; set; } = true;
|
||||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
public ICollection<TileDefinition>? Tiles { get; set; }
|
public ICollection<TileDefinition>? Tiles { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Socket type for tile edge connections
|
||||||
|
/// </summary>
|
||||||
|
public enum SocketType
|
||||||
|
{
|
||||||
|
/// <summary>Closed edge - only connects to other Closed edges (walls, void borders)</summary>
|
||||||
|
Closed = 0,
|
||||||
|
|
||||||
|
/// <summary>Open edge - only connects to other Open edges (interior floors)</summary>
|
||||||
|
Open = 1,
|
||||||
|
|
||||||
|
/// <summary>Custom type - must match exact custom string in SocketCustom field</summary>
|
||||||
|
Custom = 2
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Definition of a single tile within a tilemap sheet
|
/// Definition of a single tile within a tilemap sheet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -64,55 +79,158 @@ public class TileDefinition
|
|||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public int TileMapSheetId { get; set; }
|
public int TileMapSheetId { get; set; }
|
||||||
|
|
||||||
[ForeignKey(nameof(TileMapSheetId))]
|
[ForeignKey(nameof(TileMapSheetId))]
|
||||||
public TileMapSheet? TileMapSheet { get; set; }
|
public TileMapSheet? TileMapSheet { get; set; }
|
||||||
|
|
||||||
/// <summary>Frame index in the sheet (0-based, left-to-right, top-to-bottom)</summary>
|
/// <summary>Frame index in the sheet (0-based, left-to-right, top-to-bottom)</summary>
|
||||||
public int FrameIndex { get; set; }
|
public int FrameIndex { get; set; }
|
||||||
|
|
||||||
/// <summary>Optional name for this specific tile</summary>
|
/// <summary>Optional name for this specific tile</summary>
|
||||||
[MaxLength(64)]
|
[MaxLength(64)]
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
/// <summary>Tile type for game logic</summary>
|
/// <summary>Tile type for game logic</summary>
|
||||||
public TileType Type { get; set; } = TileType.Floor;
|
public TileType Type { get; set; } = TileType.Floor;
|
||||||
|
|
||||||
/// <summary>Tags for filtering/selection (e.g., "stone,cracked,corner_nw,biome:cave")</summary>
|
/// <summary>Tags for filtering/selection (e.g., "stone,cracked,biome:cave")</summary>
|
||||||
[MaxLength(256)]
|
[MaxLength(256)]
|
||||||
public string? Tags { get; set; }
|
public string? Tags { get; set; }
|
||||||
|
|
||||||
/// <summary>Whether entities can walk on this tile</summary>
|
/// <summary>Whether entities can walk on this tile</summary>
|
||||||
public bool IsWalkable { get; set; } = true;
|
public bool IsWalkable { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>Whether projectiles can pass through</summary>
|
/// <summary>Whether projectiles can pass through</summary>
|
||||||
public bool BlocksProjectiles { get; set; } = false;
|
public bool BlocksProjectiles { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Whether this blocks line of sight</summary>
|
/// <summary>Whether this blocks line of sight</summary>
|
||||||
public bool BlocksLineOfSight { get; set; } = false;
|
public bool BlocksLineOfSight { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Layer for rendering order (0=ground, 1=floor decor, 2=walls, 3=ceiling)</summary>
|
/// <summary>Layer for rendering order (0=ground, 1=floor decor, 2=walls, 3=ceiling)</summary>
|
||||||
public int RenderLayer { get; set; } = 0;
|
public int RenderLayer { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>Z-index within the layer</summary>
|
/// <summary>Z-index within the layer</summary>
|
||||||
public int ZIndex { get; set; } = 0;
|
public int ZIndex { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>Whether this tile is animated</summary>
|
/// <summary>Whether this tile is animated</summary>
|
||||||
public bool IsAnimated { get; set; } = false;
|
public bool IsAnimated { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Number of animation frames (consecutive frames starting at FrameIndex)</summary>
|
/// <summary>Number of animation frames (consecutive frames starting at FrameIndex)</summary>
|
||||||
public int AnimationFrameCount { get; set; } = 1;
|
public int AnimationFrameCount { get; set; } = 1;
|
||||||
|
|
||||||
/// <summary>Animation speed in frames per second</summary>
|
/// <summary>Animation speed in frames per second</summary>
|
||||||
public float AnimationFps { get; set; } = 8.0f;
|
public float AnimationFps { get; set; } = 8.0f;
|
||||||
|
|
||||||
/// <summary>Biome this tile belongs to (e.g., "cave", "dungeon", "forest")</summary>
|
/// <summary>Biome this tile belongs to (e.g., "cave", "dungeon", "forest")</summary>
|
||||||
[MaxLength(32)]
|
[MaxLength(32)]
|
||||||
public string? Biome { get; set; }
|
public string? Biome { get; set; }
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// SOCKET SYSTEM - Controls how tiles connect to neighbors
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
/// <summary>North edge socket type</summary>
|
||||||
|
public SocketType SocketN { get; set; } = SocketType.Closed;
|
||||||
|
|
||||||
|
/// <summary>East edge socket type</summary>
|
||||||
|
public SocketType SocketE { get; set; } = SocketType.Closed;
|
||||||
|
|
||||||
|
/// <summary>South edge socket type</summary>
|
||||||
|
public SocketType SocketS { get; set; } = SocketType.Closed;
|
||||||
|
|
||||||
|
/// <summary>West edge socket type</summary>
|
||||||
|
public SocketType SocketW { get; set; } = SocketType.Closed;
|
||||||
|
|
||||||
|
/// <summary>Custom socket type name for North (only used when SocketN = Custom)</summary>
|
||||||
|
[MaxLength(32)]
|
||||||
|
public string? SocketNCustom { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Custom socket type name for East (only used when SocketE = Custom)</summary>
|
||||||
|
[MaxLength(32)]
|
||||||
|
public string? SocketECustom { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Custom socket type name for South (only used when SocketS = Custom)</summary>
|
||||||
|
[MaxLength(32)]
|
||||||
|
public string? SocketSCustom { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Custom socket type name for West (only used when SocketW = Custom)</summary>
|
||||||
|
[MaxLength(32)]
|
||||||
|
public string? SocketWCustom { get; set; }
|
||||||
|
|
||||||
public bool IsEnabled { get; set; } = true;
|
public bool IsEnabled { get; set; } = true;
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// HELPER METHODS
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
/// <summary>Get the effective socket identifier for a direction</summary>
|
||||||
|
public string GetSocketId(string direction)
|
||||||
|
{
|
||||||
|
return direction.ToUpperInvariant() switch
|
||||||
|
{
|
||||||
|
"N" or "NORTH" => SocketN == SocketType.Custom ? $"Custom:{SocketNCustom}" : SocketN.ToString(),
|
||||||
|
"E" or "EAST" => SocketE == SocketType.Custom ? $"Custom:{SocketECustom}" : SocketE.ToString(),
|
||||||
|
"S" or "SOUTH" => SocketS == SocketType.Custom ? $"Custom:{SocketSCustom}" : SocketS.ToString(),
|
||||||
|
"W" or "WEST" => SocketW == SocketType.Custom ? $"Custom:{SocketWCustom}" : SocketW.ToString(),
|
||||||
|
_ => "Closed"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Check if this tile's edge is compatible with another tile's edge</summary>
|
||||||
|
public bool IsEdgeCompatible(string thisEdge, TileDefinition other, string otherEdge)
|
||||||
|
{
|
||||||
|
var thisSocket = GetSocketId(thisEdge);
|
||||||
|
var otherSocket = other.GetSocketId(otherEdge);
|
||||||
|
|
||||||
|
// Exact match required
|
||||||
|
return thisSocket.Equals(otherSocket, StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Set all sockets to a given type (useful for bulk operations)</summary>
|
||||||
|
public void SetAllSockets(SocketType type, string? customName = null)
|
||||||
|
{
|
||||||
|
SocketN = SocketE = SocketS = SocketW = type;
|
||||||
|
if (type == SocketType.Custom)
|
||||||
|
{
|
||||||
|
SocketNCustom = SocketECustom = SocketSCustom = SocketWCustom = customName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SocketNCustom = SocketECustom = SocketSCustom = SocketWCustom = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Auto-configure sockets based on tile type</summary>
|
||||||
|
public void AutoConfigureSockets()
|
||||||
|
{
|
||||||
|
switch (Type)
|
||||||
|
{
|
||||||
|
case TileType.Floor:
|
||||||
|
case TileType.FloorDecor:
|
||||||
|
SetAllSockets(SocketType.Open);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TileType.Wall:
|
||||||
|
case TileType.WallDecor:
|
||||||
|
SetAllSockets(SocketType.Closed);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TileType.Door:
|
||||||
|
// Doors typically open on two sides
|
||||||
|
// Default to vertical door (open N/S, closed E/W)
|
||||||
|
SocketN = SocketType.Open;
|
||||||
|
SocketS = SocketType.Open;
|
||||||
|
SocketE = SocketType.Closed;
|
||||||
|
SocketW = SocketType.Closed;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
SetAllSockets(SocketType.Closed);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -127,19 +245,19 @@ public enum TileType
|
|||||||
Lava = 4,
|
Lava = 4,
|
||||||
Pit = 5,
|
Pit = 5,
|
||||||
Stairs = 6,
|
Stairs = 6,
|
||||||
|
|
||||||
// Spawn points
|
// Spawn points
|
||||||
PlayerSpawn = 10,
|
PlayerSpawn = 10,
|
||||||
MobSpawn = 11,
|
MobSpawn = 11,
|
||||||
BossSpawn = 12,
|
BossSpawn = 12,
|
||||||
ChestSpawn = 13,
|
ChestSpawn = 13,
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
Trigger = 20,
|
Trigger = 20,
|
||||||
Transition = 21,
|
Transition = 21,
|
||||||
Secret = 22,
|
Secret = 22,
|
||||||
Trap = 23,
|
Trap = 23,
|
||||||
|
|
||||||
// Decorative (walkable but with visual interest)
|
// Decorative (walkable but with visual interest)
|
||||||
FloorDecor = 30,
|
FloorDecor = 30,
|
||||||
WallDecor = 31
|
WallDecor = 31
|
||||||
@@ -153,49 +271,49 @@ public class RoomTemplate
|
|||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>Name of this room template</summary>
|
/// <summary>Name of this room template</summary>
|
||||||
[Required, MaxLength(64)]
|
[Required, MaxLength(64)]
|
||||||
public string Name { get; set; } = "";
|
public string Name { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>Description of the room</summary>
|
/// <summary>Description of the room</summary>
|
||||||
[MaxLength(512)]
|
[MaxLength(512)]
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
|
||||||
/// <summary>Tags for categorization (e.g., "entrance,large,treasure")</summary>
|
/// <summary>Tags for categorization (e.g., "entrance,large,treasure")</summary>
|
||||||
[MaxLength(256)]
|
[MaxLength(256)]
|
||||||
public string? Tags { get; set; }
|
public string? Tags { get; set; }
|
||||||
|
|
||||||
/// <summary>Room type for generation logic</summary>
|
/// <summary>Room type for generation logic</summary>
|
||||||
public RoomType Type { get; set; } = RoomType.Normal;
|
public RoomType Type { get; set; } = RoomType.Normal;
|
||||||
|
|
||||||
/// <summary>Width in tiles</summary>
|
/// <summary>Width in tiles</summary>
|
||||||
public int Width { get; set; } = 10;
|
public int Width { get; set; } = 10;
|
||||||
|
|
||||||
/// <summary>Height in tiles</summary>
|
/// <summary>Height in tiles</summary>
|
||||||
public int Height { get; set; } = 10;
|
public int Height { get; set; } = 10;
|
||||||
|
|
||||||
/// <summary>Minimum dungeon tier this room can appear in</summary>
|
/// <summary>Minimum dungeon tier this room can appear in</summary>
|
||||||
public int MinTier { get; set; } = 1;
|
public int MinTier { get; set; } = 1;
|
||||||
|
|
||||||
/// <summary>Maximum dungeon tier (0 = no max)</summary>
|
/// <summary>Maximum dungeon tier (0 = no max)</summary>
|
||||||
public int MaxTier { get; set; } = 0;
|
public int MaxTier { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>Spawn weight for random selection (higher = more common)</summary>
|
/// <summary>Spawn weight for random selection (higher = more common)</summary>
|
||||||
public int Weight { get; set; } = 100;
|
public int Weight { get; set; } = 100;
|
||||||
|
|
||||||
/// <summary>JSON data containing tile placements</summary>
|
/// <summary>JSON data containing tile placements</summary>
|
||||||
[Column(TypeName = "json")]
|
[Column(TypeName = "json")]
|
||||||
public string? TileDataJson { get; set; }
|
public string? TileDataJson { get; set; }
|
||||||
|
|
||||||
/// <summary>JSON data containing spawn points</summary>
|
/// <summary>JSON data containing spawn points</summary>
|
||||||
[Column(TypeName = "json")]
|
[Column(TypeName = "json")]
|
||||||
public string? SpawnPointsJson { get; set; }
|
public string? SpawnPointsJson { get; set; }
|
||||||
|
|
||||||
/// <summary>JSON data for connection points (where hallways can attach)</summary>
|
/// <summary>JSON data for connection points (where hallways can attach)</summary>
|
||||||
[Column(TypeName = "json")]
|
[Column(TypeName = "json")]
|
||||||
public string? ConnectionPointsJson { get; set; }
|
public string? ConnectionPointsJson { get; set; }
|
||||||
|
|
||||||
public bool IsEnabled { get; set; } = true;
|
public bool IsEnabled { get; set; } = true;
|
||||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||||
@@ -227,49 +345,49 @@ public class DungeonTemplate
|
|||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>Name of this dungeon</summary>
|
/// <summary>Name of this dungeon</summary>
|
||||||
[Required, MaxLength(64)]
|
[Required, MaxLength(64)]
|
||||||
public string Name { get; set; } = "";
|
public string Name { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>Description</summary>
|
/// <summary>Description</summary>
|
||||||
[MaxLength(512)]
|
[MaxLength(512)]
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
|
||||||
/// <summary>Tags for categorization</summary>
|
/// <summary>Tags for categorization</summary>
|
||||||
[MaxLength(256)]
|
[MaxLength(256)]
|
||||||
public string? Tags { get; set; }
|
public string? Tags { get; set; }
|
||||||
|
|
||||||
/// <summary>Dungeon tier (difficulty)</summary>
|
/// <summary>Dungeon tier (difficulty)</summary>
|
||||||
public int Tier { get; set; } = 1;
|
public int Tier { get; set; } = 1;
|
||||||
|
|
||||||
/// <summary>Total width in tiles</summary>
|
/// <summary>Total width in tiles</summary>
|
||||||
public int Width { get; set; } = 100;
|
public int Width { get; set; } = 100;
|
||||||
|
|
||||||
/// <summary>Total height in tiles</summary>
|
/// <summary>Total height in tiles</summary>
|
||||||
public int Height { get; set; } = 100;
|
public int Height { get; set; } = 100;
|
||||||
|
|
||||||
/// <summary>If true, this is a complete hand-crafted dungeon. If false, it's generation parameters.</summary>
|
/// <summary>If true, this is a complete hand-crafted dungeon. If false, it's generation parameters.</summary>
|
||||||
public bool IsHandCrafted { get; set; } = false;
|
public bool IsHandCrafted { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>JSON containing full tile data (for hand-crafted)</summary>
|
/// <summary>JSON containing full tile data (for hand-crafted)</summary>
|
||||||
[Column(TypeName = "json")]
|
[Column(TypeName = "json")]
|
||||||
public string? TileDataJson { get; set; }
|
public string? TileDataJson { get; set; }
|
||||||
|
|
||||||
/// <summary>JSON containing room placements (for hand-crafted or as hints for generation)</summary>
|
/// <summary>JSON containing room placements (for hand-crafted or as hints for generation)</summary>
|
||||||
[Column(TypeName = "json")]
|
[Column(TypeName = "json")]
|
||||||
public string? RoomPlacementsJson { get; set; }
|
public string? RoomPlacementsJson { get; set; }
|
||||||
|
|
||||||
/// <summary>JSON containing generation parameters (room counts, weights, etc.)</summary>
|
/// <summary>JSON containing generation parameters (room counts, weights, etc.)</summary>
|
||||||
[Column(TypeName = "json")]
|
[Column(TypeName = "json")]
|
||||||
public string? GenerationParamsJson { get; set; }
|
public string? GenerationParamsJson { get; set; }
|
||||||
|
|
||||||
/// <summary>Default tilemap sheet to use</summary>
|
/// <summary>Default tilemap sheet to use</summary>
|
||||||
public int? DefaultTileMapSheetId { get; set; }
|
public int? DefaultTileMapSheetId { get; set; }
|
||||||
|
|
||||||
[ForeignKey(nameof(DefaultTileMapSheetId))]
|
[ForeignKey(nameof(DefaultTileMapSheetId))]
|
||||||
public TileMapSheet? DefaultTileMapSheet { get; set; }
|
public TileMapSheet? DefaultTileMapSheet { get; set; }
|
||||||
|
|
||||||
public bool IsEnabled { get; set; } = true;
|
public bool IsEnabled { get; set; } = true;
|
||||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||||
@@ -284,13 +402,13 @@ public class TilePlacement
|
|||||||
public int Y { get; set; }
|
public int Y { get; set; }
|
||||||
public int TileDefinitionId { get; set; }
|
public int TileDefinitionId { get; set; }
|
||||||
public int Layer { get; set; } = 0;
|
public int Layer { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>Optional rotation (0, 90, 180, 270)</summary>
|
/// <summary>Optional rotation (0, 90, 180, 270)</summary>
|
||||||
public int Rotation { get; set; } = 0;
|
public int Rotation { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>Optional flip X</summary>
|
/// <summary>Optional flip X</summary>
|
||||||
public bool FlipX { get; set; } = false;
|
public bool FlipX { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Optional flip Y</summary>
|
/// <summary>Optional flip Y</summary>
|
||||||
public bool FlipY { get; set; } = false;
|
public bool FlipY { get; set; } = false;
|
||||||
}
|
}
|
||||||
@@ -303,10 +421,10 @@ public class SpawnPoint
|
|||||||
public int X { get; set; }
|
public int X { get; set; }
|
||||||
public int Y { get; set; }
|
public int Y { get; set; }
|
||||||
public TileType Type { get; set; }
|
public TileType Type { get; set; }
|
||||||
|
|
||||||
/// <summary>Optional specific mob/item ID to spawn</summary>
|
/// <summary>Optional specific mob/item ID to spawn</summary>
|
||||||
public int? EntityId { get; set; }
|
public int? EntityId { get; set; }
|
||||||
|
|
||||||
/// <summary>Tags for filtering what can spawn here</summary>
|
/// <summary>Tags for filtering what can spawn here</summary>
|
||||||
public string? Tags { get; set; }
|
public string? Tags { get; set; }
|
||||||
}
|
}
|
||||||
@@ -318,10 +436,10 @@ public class ConnectionPoint
|
|||||||
{
|
{
|
||||||
public int X { get; set; }
|
public int X { get; set; }
|
||||||
public int Y { get; set; }
|
public int Y { get; set; }
|
||||||
|
|
||||||
/// <summary>Direction this connection faces (north, south, east, west)</summary>
|
/// <summary>Direction this connection faces (north, south, east, west)</summary>
|
||||||
public string Direction { get; set; } = "north";
|
public string Direction { get; set; } = "north";
|
||||||
|
|
||||||
/// <summary>Width of the connection (for wider hallways)</summary>
|
/// <summary>Width of the connection (for wider hallways)</summary>
|
||||||
public int Width { get; set; } = 1;
|
public int Width { get; set; } = 1;
|
||||||
}
|
}
|
||||||
@@ -334,79 +452,79 @@ public class DungeonObjectDefinition
|
|||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>Name of this object</summary>
|
/// <summary>Name of this object</summary>
|
||||||
[Required, MaxLength(64)]
|
[Required, MaxLength(64)]
|
||||||
public string Name { get; set; } = "";
|
public string Name { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>Description</summary>
|
/// <summary>Description</summary>
|
||||||
[MaxLength(512)]
|
[MaxLength(512)]
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
|
||||||
/// <summary>Object type</summary>
|
/// <summary>Object type</summary>
|
||||||
public DungeonObjectType Type { get; set; } = DungeonObjectType.Decoration;
|
public DungeonObjectType Type { get; set; } = DungeonObjectType.Decoration;
|
||||||
|
|
||||||
/// <summary>Sprite path on CDN</summary>
|
/// <summary>Sprite path on CDN</summary>
|
||||||
[MaxLength(256)]
|
[MaxLength(256)]
|
||||||
public string? SpritePath { get; set; }
|
public string? SpritePath { get; set; }
|
||||||
|
|
||||||
/// <summary>Sprite ID for shared sprites</summary>
|
/// <summary>Sprite ID for shared sprites</summary>
|
||||||
public int? SpriteId { get; set; }
|
public int? SpriteId { get; set; }
|
||||||
|
|
||||||
/// <summary>Alternative sprite when interacted (e.g., opened chest)</summary>
|
/// <summary>Alternative sprite when interacted (e.g., opened chest)</summary>
|
||||||
[MaxLength(256)]
|
[MaxLength(256)]
|
||||||
public string? InteractedSpritePath { get; set; }
|
public string? InteractedSpritePath { get; set; }
|
||||||
|
|
||||||
/// <summary>Whether this object blocks movement</summary>
|
/// <summary>Whether this object blocks movement</summary>
|
||||||
public bool BlocksMovement { get; set; } = false;
|
public bool BlocksMovement { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Whether this object blocks projectiles</summary>
|
/// <summary>Whether this object blocks projectiles</summary>
|
||||||
public bool BlocksProjectiles { get; set; } = false;
|
public bool BlocksProjectiles { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Whether this object blocks line of sight</summary>
|
/// <summary>Whether this object blocks line of sight</summary>
|
||||||
public bool BlocksLineOfSight { get; set; } = false;
|
public bool BlocksLineOfSight { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Whether this object can be interacted with</summary>
|
/// <summary>Whether this object can be interacted with</summary>
|
||||||
public bool IsInteractable { get; set; } = false;
|
public bool IsInteractable { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Whether this object can be destroyed</summary>
|
/// <summary>Whether this object can be destroyed</summary>
|
||||||
public bool IsDestructible { get; set; } = false;
|
public bool IsDestructible { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Health if destructible (0 = instant destroy)</summary>
|
/// <summary>Health if destructible (0 = instant destroy)</summary>
|
||||||
public int Health { get; set; } = 0;
|
public int Health { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>Interaction type (what happens when player interacts)</summary>
|
/// <summary>Interaction type (what happens when player interacts)</summary>
|
||||||
public ObjectInteractionType InteractionType { get; set; } = ObjectInteractionType.None;
|
public ObjectInteractionType InteractionType { get; set; } = ObjectInteractionType.None;
|
||||||
|
|
||||||
/// <summary>Loot table ID for containers</summary>
|
/// <summary>Loot table ID for containers</summary>
|
||||||
public int? LootTableId { get; set; }
|
public int? LootTableId { get; set; }
|
||||||
|
|
||||||
/// <summary>Tags for filtering/categorization</summary>
|
/// <summary>Tags for filtering/categorization</summary>
|
||||||
[MaxLength(256)]
|
[MaxLength(256)]
|
||||||
public string? Tags { get; set; }
|
public string? Tags { get; set; }
|
||||||
|
|
||||||
/// <summary>Biome this object belongs to</summary>
|
/// <summary>Biome this object belongs to</summary>
|
||||||
[MaxLength(32)]
|
[MaxLength(32)]
|
||||||
public string? Biome { get; set; }
|
public string? Biome { get; set; }
|
||||||
|
|
||||||
/// <summary>Size in tiles (width)</summary>
|
/// <summary>Size in tiles (width)</summary>
|
||||||
public int Width { get; set; } = 1;
|
public int Width { get; set; } = 1;
|
||||||
|
|
||||||
/// <summary>Size in tiles (height)</summary>
|
/// <summary>Size in tiles (height)</summary>
|
||||||
public int Height { get; set; } = 1;
|
public int Height { get; set; } = 1;
|
||||||
|
|
||||||
/// <summary>Z-index for rendering order</summary>
|
/// <summary>Z-index for rendering order</summary>
|
||||||
public int ZIndex { get; set; } = 0;
|
public int ZIndex { get; set; } = 0;
|
||||||
|
|
||||||
/// <summary>Whether this object is animated</summary>
|
/// <summary>Whether this object is animated</summary>
|
||||||
public bool IsAnimated { get; set; } = false;
|
public bool IsAnimated { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>Animation frame count</summary>
|
/// <summary>Animation frame count</summary>
|
||||||
public int AnimationFrameCount { get; set; } = 1;
|
public int AnimationFrameCount { get; set; } = 1;
|
||||||
|
|
||||||
/// <summary>Animation FPS</summary>
|
/// <summary>Animation FPS</summary>
|
||||||
public float AnimationFps { get; set; } = 8.0f;
|
public float AnimationFps { get; set; } = 8.0f;
|
||||||
|
|
||||||
public bool IsEnabled { get; set; } = true;
|
public bool IsEnabled { get; set; } = true;
|
||||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||||
@@ -417,15 +535,15 @@ public class DungeonObjectDefinition
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum DungeonObjectType
|
public enum DungeonObjectType
|
||||||
{
|
{
|
||||||
Decoration = 0, // Visual only, no collision
|
Decoration = 0,
|
||||||
Obstacle = 1, // Blocks movement
|
Obstacle = 1,
|
||||||
Container = 2, // Can be opened for loot (chest, barrel, etc.)
|
Container = 2,
|
||||||
Interactable = 3, // Triggers an action (lever, button, etc.)
|
Interactable = 3,
|
||||||
Destructible = 4, // Can be destroyed (crate, pot, etc.)
|
Destructible = 4,
|
||||||
Door = 5, // Openable door
|
Door = 5,
|
||||||
Trap = 6, // Damages player
|
Trap = 6,
|
||||||
Shrine = 7, // Gives buff/heals
|
Shrine = 7,
|
||||||
Vendor = 8 // Shop NPC placeholder
|
Vendor = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -434,12 +552,12 @@ public enum DungeonObjectType
|
|||||||
public enum ObjectInteractionType
|
public enum ObjectInteractionType
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
OpenContainer = 1, // Opens loot UI
|
OpenContainer = 1,
|
||||||
Toggle = 2, // Toggle on/off state
|
Toggle = 2,
|
||||||
Trigger = 3, // Triggers an event
|
Trigger = 3,
|
||||||
Teleport = 4, // Teleports player
|
Teleport = 4,
|
||||||
Heal = 5, // Heals player
|
Heal = 5,
|
||||||
Buff = 6, // Gives buff
|
Buff = 6,
|
||||||
Dialogue = 7, // Shows dialogue
|
Dialogue = 7,
|
||||||
Shop = 8 // Opens shop UI
|
Shop = 8
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user