When using a mod that lets the player go to multiple surfaces (discovered with Space Exploration), damage on any surface causes damage numbers to appear at those coordinates even if the player is looking at a different surface, causing "ghost" damage numbers to appear.
This can be fixed by ensuring the surface index of the event and player match before displaying the text. The diff below applies this fix.
for i, player in pairs(game.connected_players) do
+ -- do not show damage numbers if the player is on a different surface
+ if player.surface_index ~= target.surface_index then return end
player.create_local_flying_text({text = string.format("%.0f", dmg),