Damage Numbers


Adds floating damage numbers like in RPGs.

Tweaks
1 year, 2 months ago
1.1
4.70K

b Multiple surfaces

1 year, 2 months ago
(updated 1 year, 2 months ago)

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),

1 year, 2 months ago

Thank you for your report and especially thank you for including the snippet. I have uploaded a new version with your fix.

New response