Persist player overworld location and add world mob spawn editing/runtime payloads
This commit is contained in:
@@ -129,6 +129,31 @@ public class WorldChunkNpcSpawn
|
||||
public string? MetadataJson { get; set; }
|
||||
}
|
||||
|
||||
[Table("world_chunk_mob_spawns")]
|
||||
public class WorldChunkMobSpawn
|
||||
{
|
||||
[Key]
|
||||
public long Id { get; set; }
|
||||
|
||||
public long WorldChunkId { get; set; }
|
||||
[ForeignKey(nameof(WorldChunkId))]
|
||||
public WorldChunk? Chunk { get; set; }
|
||||
|
||||
public int MobDefinitionId { get; set; }
|
||||
[ForeignKey(nameof(MobDefinitionId))]
|
||||
public DungeonMobDefinition? MobDefinition { get; set; }
|
||||
|
||||
public int TileX { get; set; }
|
||||
public int TileY { get; set; }
|
||||
public int Rotation { get; set; }
|
||||
|
||||
public int SpawnCount { get; set; } = 1;
|
||||
public float RespawnSeconds { get; set; } = 30f;
|
||||
|
||||
[MaxLength(1024)]
|
||||
public string? MetadataJson { get; set; }
|
||||
}
|
||||
|
||||
public sealed class WorldRegionConfig : IEntityTypeConfiguration<WorldRegion>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<WorldRegion> e)
|
||||
@@ -196,3 +221,15 @@ public sealed class WorldChunkNpcSpawnConfig : IEntityTypeConfiguration<WorldChu
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class WorldChunkMobSpawnConfig : IEntityTypeConfiguration<WorldChunkMobSpawn>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<WorldChunkMobSpawn> e)
|
||||
{
|
||||
e.HasIndex(x => new { x.WorldChunkId, x.TileX, x.TileY, x.MobDefinitionId });
|
||||
e.HasOne(x => x.Chunk)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.WorldChunkId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user