Starbound

Starbound

On-display Health, Stamina and Hunger Bar(Feb 14th 25, CHECK DESCRIPTION)
Showing 1-3 of 3 entries
Update: 10 Nov, 2023 @ 9:10pm

Uploaded a broken build on accident. Hopefully should fix half of the game suddenly not working correctly

Update: 9 Nov, 2023 @ 5:29pm

I am over a year late to the suggestions for optimizing but here goes
I spent like 2 hours optimizing the hell out of this. And while it's not the best(I'm not completely familiar with Starbound lua), it should be far better than the mod creating several tables for every bar or constantly indexing global variables

The hunger bar now only renders if the player has less than 25% of hunger(Idea inspired by On-display Health Bar - Improved)
The distance for an entity to get a health bar has been reduced to 20 blocks around the player(Previously was 60)
Bars will no longer render if the entity has no health and the bar already didn't render if the entity had full health

Technical stuff:
Now a custom vec2Add is used instead of the built-in vec2.add, This should be more efficient since it doesn't have to index vec2, and it doesn't have to convert any values out of lua
Several calculations are simplified to work off of eachother instead of recalculating entity positions several times
The bar table is now only generated once and then modified

Update: 22 Aug, 2020 @ 2:57am