Builder changes

This commit is contained in:
dingo
2026-02-11 10:06:58 -05:00
parent e5ee966451
commit 5da9cbedac
11 changed files with 740 additions and 209 deletions
+5 -4
View File
@@ -472,7 +472,10 @@ public sealed partial class DungeonHandler
{
try
{
var layout = DungeonGenerator.Generate(persisted.Seed, persisted.Tier);
using var scope = _scopeFactory.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<GameDbContext>();
var vnext = new DungeonGeneratorVNext(db, persisted.Seed, persisted.Tier);
var layout = await vnext.GenerateAsync();
var simulation = new DungeonSimulation(layout, persisted.Tier, _mobDefinitions, persisted.LevelBracketMin, _abilityDefinitions, _mobSpriteConfigs, _abilityAnimationMappings);
var mobStatePayload = DeserializePersistedMobPayload(persisted.MobStateJson);
var persistedMobStates = mobStatePayload?.Mobs;
@@ -618,9 +621,7 @@ public sealed partial class DungeonHandler
_log.LogInformation("Preserving {Count} mobs with carried player loot during respawn", mobsWithLoot.Count);
}
// IMPORTANT: Reuse the existing layout to preserve mob spawn positions!
// Using DungeonGenerator.Generate() would create a V1 layout which has different
// room geometry than V2/V3, causing mobs to spawn in wrong positions.
// IMPORTANT: Reuse the existing layout to preserve mob spawn positions.
var layout = instance.Simulation.Layout;
var freshSimulation = new DungeonSimulation(layout, instance.Tier, _mobDefinitions, instance.LevelBracketMin, _abilityDefinitions, _mobSpriteConfigs, _abilityAnimationMappings);