Floating Damage Text


Damage dealt to enemies and structures appear as floating text above their heads. Highly configurable.

Utilities
a month ago
0.17 - 2.0
16.9K

b 0.0 damage output seems odd, should probably be hidden?

5 years ago

When using the '%.1g' format (and power armor v2) I have had a few occasions when I see myself taking 0.0 damage. I'm not sure if that is a rounding issue, or if it is related to damage reduction. Either way it looks very odd.

Separate post because I think this is separate from the "integer output truncates" issue, but I'm not certain of that.

Unfortunately, I have no resource to point you at which will assist in getting better quality human-centric output here, rather than the very limited facilities that printf formatters provide. Sorry.

5 years ago

It's essentially the same issue as the other one. It appears as 0.0 because you're taking less than 0.1 damage due to damage resistance. Actual values of 0 don't get displayed (try using a flamethrower on a wall) but really small ones do. You are still taking damage (and the screen flashes red) so it would be even weirder not to display anything. I think I'll try setting a floor value that gets displayed so that values below say 0.1 display as 0.1 so it's clear that you're still taking a small amount of damage.

As for printf, I went with it because it was already built in to Lua and allows for decent string customization, although the number formatting leaves something to be desired. I'll keep looking into alternatives though.

5 years ago
(updated 5 years ago)

Yeah. OK, makes sense. Sorry for the duplicate then. Sadly, lua doesn't seem to have any of the happy "format numbers for people" libraries. At least, not that I can find.

The only thing I can think off, off-hand, to improve would be to use a drop-down for precision, and use that to round appropriately. Saves dealing with whatever random format some demanding kitten asks for ;)

Seriously, though, don't let me stress you about it, and thank you for the mod. It is great to have it.

5 years ago

Turns out interpreting the number as a string allows it to trim trailing zeroes, so between that and the new option to round to a configurable number of digits ends up making the numbers a lot more friendly to human readers. As such I'm making %s the default and recommended way to display numbers. I'm still using the print library since it makes displaying custom text really easy, so you can still use the other formatting options if you want.

5 years ago

Awesome. Sounds great to me. :)

New response