Fix dungeon respawn portal/state regressions after empty-dungeon reset
- Keep exit portals active when dungeons respawn mobs after being empty - Normalize living mob runtime state on respawn reset (idle state, clear target/cast, reset animation) - Expand quick-join enter mob payload to include rotation/state/isAlive to prevent stale dead-animation rendering
This commit is contained in:
@@ -636,6 +636,18 @@ public sealed partial class DungeonHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset runtime combat/animation state for all living mobs after a dungeon reset.
|
||||||
|
foreach (var mob in instance.Simulation.Mobs.Values.Where(m => m.IsAlive))
|
||||||
|
{
|
||||||
|
mob.State = MobState.Idle;
|
||||||
|
mob.StateTime = 0f;
|
||||||
|
mob.StuckTime = 0f;
|
||||||
|
mob.TargetId = null;
|
||||||
|
mob.CastingAbility = null;
|
||||||
|
mob.CastTimeRemaining = 0f;
|
||||||
|
mob.CurrentAnimation = mob.GetDirectionalAnimation("idle");
|
||||||
|
}
|
||||||
|
|
||||||
// Reset chest states (they respawn closed) - but NOT loot chests
|
// Reset chest states (they respawn closed) - but NOT loot chests
|
||||||
foreach (var chest in instance.Simulation.Chests.Values)
|
foreach (var chest in instance.Simulation.Chests.Values)
|
||||||
{
|
{
|
||||||
@@ -648,13 +660,10 @@ public sealed partial class DungeonHandler
|
|||||||
// DON'T clear dropped items - these might be important!
|
// DON'T clear dropped items - these might be important!
|
||||||
// instance.Simulation.DroppedItems.Clear();
|
// instance.Simulation.DroppedItems.Clear();
|
||||||
|
|
||||||
// Reset portals (exit portal should be inactive until boss killed)
|
// Reset portals to default active state.
|
||||||
foreach (var portal in instance.Simulation.Portals.Values)
|
foreach (var portal in instance.Simulation.Portals.Values)
|
||||||
{
|
{
|
||||||
if (portal.Type == PortalType.Exit)
|
portal.IsActive = true;
|
||||||
{
|
|
||||||
portal.IsActive = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.LogDebug("Respawned {MobCount} mobs in dungeon {Id} (preserved {PreservedCount} with loot, bossesRespawn={BossesRespawn})",
|
_log.LogDebug("Respawned {MobCount} mobs in dungeon {Id} (preserved {PreservedCount} with loot, bossesRespawn={BossesRespawn})",
|
||||||
|
|||||||
@@ -843,8 +843,11 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
|||||||
name = m.Name,
|
name = m.Name,
|
||||||
x = m.X,
|
x = m.X,
|
||||||
y = m.Y,
|
y = m.Y,
|
||||||
|
rotation = m.Rotation,
|
||||||
health = m.Health,
|
health = m.Health,
|
||||||
maxHealth = m.MaxHealth,
|
maxHealth = m.MaxHealth,
|
||||||
|
state = m.State.ToString().ToLower(),
|
||||||
|
isAlive = m.IsAlive,
|
||||||
spriteConfig = DeserializeSpriteConfigSafe(m.SpriteConfigJson),
|
spriteConfig = DeserializeSpriteConfigSafe(m.SpriteConfigJson),
|
||||||
tintColor = m.TintColor,
|
tintColor = m.TintColor,
|
||||||
scale = m.Scale
|
scale = m.Scale
|
||||||
|
|||||||
Reference in New Issue
Block a user