Optimize small monster UI drawing function

This commit is contained in:
GreenComfyTea
2023-08-08 13:04:40 +03:00
parent e1d3754733
commit e09c82278d
10 changed files with 49 additions and 73 deletions

View File

@@ -52,6 +52,7 @@ function this.draw()
local cached_config = config.current_config.endemic_life_UI;
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
for REcreature, creature in pairs(env_creature.list) do
if cached_config.settings.max_distance == 0 then
break;

View File

@@ -91,8 +91,6 @@ function this.draw(dynamic_enabled, static_enabled, highlighted_enabled)
goto continue;
end
large_monster.update_position(enemy, monster);
if update_distance then
monster.distance = (players.myself_position - monster.position):length();
end

View File

@@ -56,31 +56,11 @@ function this.draw()
local displayed_monsters = {};
local enemy_count = get_zako_enemy_count_method:call(singletons.enemy_manager);
if enemy_count == nil then
error_handler.report("small_monster_UI.draw", "Failed to access Data: enemy_count");
return;
end
for i = 0, enemy_count - 1 do
local enemy = get_zako_enemy_method:call(singletons.enemy_manager, i);
if enemy == nil then
error_handler.report("small_monster_UI.draw", "Failed to access Data: enemy No. " .. tostring(i));
goto continue;
end
local monster = small_monster.get_monster(enemy);
if monster == nil then
error_handler.report("small_monster_UI.draw", "Failed to create Small Monster Entry No. " .. tostring(i));
goto continue;
end
for enemy, monster in pairs(small_monster.list) do
if monster.dead_or_captured and cached_config.settings.hide_dead_or_captured then
goto continue;
end;
small_monster.update_position(enemy, monster);
table.insert(displayed_monsters, monster);
::continue::
end
@@ -147,7 +127,7 @@ function this.draw()
position_on_screen = draw.world_to_screen(monster.position + world_offset);
if position_on_screen == nil then
goto continue
goto continue;
end
position_on_screen.x = position_on_screen.x + cached_config.dynamic_positioning.viewport_offset.x;
@@ -169,7 +149,7 @@ function this.draw()
end
if monster.distance > cached_config.dynamic_positioning.max_distance then
goto continue
goto continue;
end
if cached_config.dynamic_positioning.opacity_falloff then