fix: clear spell visual instances on map change/world entry

Active spell visual M2 instances were never cleaned up when the player
teleported to a different map or re-entered the world. Orphaned effects
could linger visually from the previous combat session. Now properly
removes all active spell visual instances in resetCombatVisualState(),
which is called on every world entry.
This commit is contained in:
Kelsi 2026-03-20 07:23:38 -07:00
parent e24c39f4be
commit f101ed7c83

View file

@ -3017,6 +3017,12 @@ void Renderer::resetCombatVisualState() {
targetPosition = nullptr;
meleeSwingTimer = 0.0f;
meleeSwingCooldown = 0.0f;
// Clear lingering spell visual instances from the previous map/combat session.
// Without this, old effects could remain visible after teleport or map change.
for (auto& sv : activeSpellVisuals_) {
if (m2Renderer) m2Renderer->removeInstance(sv.instanceId);
}
activeSpellVisuals_.clear();
}
bool Renderer::isMoving() const {