Keep mob corpses persistent and enforce death animation state

- Stop automatic corpse removal after loot is emptied; corpses now remain in world

- On all mob death paths, set dead state plus death animation (death_[dir]) and clear combat/cast targeting

- Include dead mobs in spatial state feed so corpses do not disappear from clients

- Add mob currentAnimation/hasLoot in payload and reject loot interaction when corpse has no loot
This commit is contained in:
dingo
2026-02-09 09:24:14 -05:00
parent d8e4e7430b
commit 5d3de08037
5 changed files with 40 additions and 25 deletions
+6 -1
View File
@@ -412,7 +412,7 @@ public sealed partial class DungeonHandler
x = p.X,
y = p.Y
}),
mobs = instance.Simulation.Mobs.Values.Where(m => m.IsAlive).Select(m => new
mobs = instance.Simulation.Mobs.Values.Select(m => new
{
id = m.Id,
definitionId = m.DefinitionId,
@@ -422,8 +422,10 @@ public sealed partial class DungeonHandler
rotation = m.Rotation,
health = m.Health,
maxHealth = m.MaxHealth,
hasLoot = m.HasDeathLoot,
isAlive = m.IsAlive,
state = m.State.ToString().ToLower(),
currentAnimation = m.CurrentAnimation,
spriteConfig = DeserializeSpriteConfigSafe(m.SpriteConfigJson),
tintColor = m.TintColor,
scale = m.Scale
@@ -547,6 +549,7 @@ public sealed partial class DungeonHandler
killedBoss.IsAlive = false;
killedBoss.Health = 0;
killedBoss.State = MobState.Dead;
killedBoss.CurrentAnimation = killedBoss.GetDirectionalAnimation("death");
}
else
{
@@ -574,6 +577,7 @@ public sealed partial class DungeonHandler
boss.IsAlive = false;
boss.Health = 0;
boss.State = MobState.Dead;
boss.CurrentAnimation = boss.GetDirectionalAnimation("death");
}
}
}
@@ -640,6 +644,7 @@ public sealed partial class DungeonHandler
mob.Value.IsAlive = false;
mob.Value.Health = 0;
mob.Value.State = MobState.Dead;
mob.Value.CurrentAnimation = mob.Value.GetDirectionalAnimation("death");
}
instance.Simulation.Mobs.TryAdd(mob.Key, mob.Value);