mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 12:28:03 -08:00
More refactoring
This commit is contained in:
@@ -57,7 +57,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
|
||||
local monster = large_monster.list[enemy];
|
||||
if monster == nil then
|
||||
customization_menu.status = "No monster hp entry";
|
||||
customization_menu.status = "No large monster hp entry";
|
||||
goto continue
|
||||
end
|
||||
|
||||
@@ -137,7 +137,7 @@ function large_monster_UI.draw_dynamic(displayed_monsters, highlighted_monster)
|
||||
opacity_scale = 1 - (monster.distance / cached_config.settings.max_distance);
|
||||
end
|
||||
|
||||
large_monster.draw_dynamic(monster, position_on_screen, opacity_scale);
|
||||
large_monster.draw(monster, "dynamic", cached_config, position_on_screen, opacity_scale);
|
||||
|
||||
i = i + 1;
|
||||
::continue::
|
||||
@@ -218,7 +218,7 @@ function large_monster_UI.draw_static(displayed_monsters, highlighted_monster)
|
||||
monster_position_on_screen.y = monster_position_on_screen.y + cached_config.spacing.y * i * global_scale_modifier;
|
||||
end
|
||||
|
||||
large_monster.draw_static(monster, monster_position_on_screen, 1);
|
||||
large_monster.draw(monster, "static", cached_config, monster_position_on_screen, 1);
|
||||
|
||||
i = i + 1;
|
||||
::continue::
|
||||
@@ -238,7 +238,7 @@ function large_monster_UI.draw_highlighted(monster)
|
||||
return;
|
||||
end
|
||||
|
||||
large_monster.draw_highlighted(monster, position_on_screen, 1);
|
||||
large_monster.draw(monster, "highlighted", cached_config, position_on_screen, 1);
|
||||
end
|
||||
|
||||
function large_monster_UI.init_module()
|
||||
|
||||
@@ -38,7 +38,7 @@ function small_monster_UI.draw()
|
||||
|
||||
local monster = small_monster.list[enemy];
|
||||
if monster == nil then
|
||||
customization_menu.status = "No monster hp entry";
|
||||
customization_menu.status = "No small monster hp entry";
|
||||
goto continue
|
||||
end
|
||||
|
||||
@@ -147,7 +147,7 @@ function small_monster_UI.draw()
|
||||
|
||||
|
||||
|
||||
small_monster.draw(monster, position_on_screen, opacity_scale);
|
||||
small_monster.draw(monster, cached_config, position_on_screen, opacity_scale);
|
||||
|
||||
i = i + 1;
|
||||
::continue::
|
||||
|
||||
@@ -42,112 +42,11 @@ function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_la
|
||||
return entity;
|
||||
end
|
||||
|
||||
function ailment_UI_entity.draw_dynamic(ailment, ailment_UI, position_on_screen, opacity_scale)
|
||||
function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_screen, opacity_scale)
|
||||
if not ailment_UI.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.ailments;
|
||||
|
||||
local ailment_name = "";
|
||||
if cached_config.ailment_name_label.include.ailment_name then
|
||||
ailment_name = ailment.name .. " ";
|
||||
end
|
||||
if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
|
||||
end
|
||||
|
||||
if ailment.is_active then
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
|
||||
ailment.seconds_left);
|
||||
else
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
|
||||
ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
function ailment_UI_entity.draw_static(ailment, ailment_UI, position_on_screen, opacity_scale)
|
||||
if not ailment_UI.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
local cached_config = config.current_config.large_monster_UI.static.ailments;
|
||||
|
||||
local ailment_name = "";
|
||||
if cached_config.ailment_name_label.include.ailment_name then
|
||||
ailment_name = ailment.name .. " ";
|
||||
end
|
||||
if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
|
||||
end
|
||||
|
||||
if ailment.is_active then
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
|
||||
ailment.seconds_left);
|
||||
else
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
|
||||
ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
function ailment_UI_entity.draw_highlighted(ailment, ailment_UI, position_on_screen, opacity_scale)
|
||||
if not ailment_UI.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.ailments;
|
||||
|
||||
local ailment_name = "";
|
||||
if cached_config.ailment_name_label.include.ailment_name then
|
||||
ailment_name = ailment.name .. " ";
|
||||
end
|
||||
if cached_config.ailment_name_label.include.activation_count and ailment.activate_count ~= 0 then
|
||||
ailment_name = ailment_name .. "x" .. tostring(ailment.activate_count);
|
||||
end
|
||||
|
||||
if ailment.is_active then
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.timer_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.timer_label, position_on_screen, opacity_scale, ailment.minutes_left,
|
||||
ailment.seconds_left);
|
||||
else
|
||||
drawing.draw_bar(ailment_UI.bar, position_on_screen, opacity_scale, ailment.buildup_percentage);
|
||||
|
||||
drawing.draw_label(ailment_UI.name_label, position_on_screen, opacity_scale, ailment_name);
|
||||
drawing.draw_label(ailment_UI.text_label, position_on_screen, opacity_scale, language.current_language.UI.buildup);
|
||||
drawing.draw_label(ailment_UI.value_label, position_on_screen, opacity_scale, ailment.total_buildup,
|
||||
ailment.buildup_limit);
|
||||
drawing.draw_label(ailment_UI.percentage_label, position_on_screen, opacity_scale, 100 * ailment.buildup_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
function ailment_UI_entity.draw_small(ailment, ailment_UI, position_on_screen, opacity_scale)
|
||||
if not ailment_UI.visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
local cached_config = config.current_config.small_monster_UI.ailments;
|
||||
|
||||
local ailment_name = "";
|
||||
if cached_config.ailment_name_label.include.ailment_name then
|
||||
ailment_name = ailment.name .. " ";
|
||||
|
||||
@@ -55,11 +55,9 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
|
||||
return entity;
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, position_on_screen, opacity_scale,
|
||||
top_buildup)
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.ailment_buildups;
|
||||
|
||||
function ailment_buildup_UI_entity.draw(_player, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup)
|
||||
local player_buildup_bar_percentage = 0;
|
||||
xy = 11.1;
|
||||
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
else
|
||||
@@ -67,111 +65,19 @@ function ailment_buildup_UI_entity.draw_dynamic(_player, ailment_buildup_UI, pos
|
||||
player_buildup_bar_percentage = _player.buildup / top_buildup;
|
||||
end
|
||||
end
|
||||
|
||||
xy = 11.2;
|
||||
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
else
|
||||
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
|
||||
player.get_player(_player.id).name);
|
||||
xy = 11.3;
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale, player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
|
||||
100 * _player.buildup_share);
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.draw_static(_player, ailment_buildup_UI, position_on_screen, opacity_scale,
|
||||
top_buildup)
|
||||
local cached_config = config.current_config.large_monster_UI.static.ailment_buildups;
|
||||
|
||||
local player_buildup_bar_percentage = 0;
|
||||
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
else
|
||||
if top_buildup ~= 0 then
|
||||
player_buildup_bar_percentage = _player.buildup / top_buildup;
|
||||
end
|
||||
end
|
||||
|
||||
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
else
|
||||
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
|
||||
player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
|
||||
100 * _player.buildup_share);
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.draw_highlighted(_player, ailment_buildup_UI, position_on_screen, opacity_scale,
|
||||
top_buildup)
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.ailment_buildups;
|
||||
|
||||
local player_buildup_bar_percentage = 0;
|
||||
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
else
|
||||
if top_buildup ~= 0 then
|
||||
player_buildup_bar_percentage = _player.buildup / top_buildup;
|
||||
end
|
||||
end
|
||||
|
||||
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
else
|
||||
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
|
||||
player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
|
||||
100 * _player.buildup_share);
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.draw_small(_player, ailment_buildup_UI, position_on_screen, opacity_scale, top_buildup)
|
||||
local cached_config = config.current_config.small_monster_UI.ailment_buildups;
|
||||
|
||||
local player_buildup_bar_percentage = 0;
|
||||
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
|
||||
player_buildup_bar_percentage = _player.buildup_share;
|
||||
else
|
||||
if top_buildup ~= 0 then
|
||||
player_buildup_bar_percentage = _player.buildup / top_buildup;
|
||||
end
|
||||
end
|
||||
|
||||
if _player.id == player.myself.id and cached_config.settings.highlighted_bar == "Me" then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
elseif cached_config.settings.highlighted_bar == "Top Buildup" and _player.buildup == top_buildup then
|
||||
drawing.draw_bar(ailment_buildup_UI.highlighted_buildup_bar, position_on_screen, opacity_scale,
|
||||
player_buildup_bar_percentage);
|
||||
else
|
||||
drawing.draw_bar(ailment_buildup_UI.buildup_bar, position_on_screen, opacity_scale, player_buildup_bar_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(ailment_buildup_UI.player_name_label, position_on_screen, opacity_scale,
|
||||
player.get_player(_player.id).name);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_value_label, position_on_screen, opacity_scale, _player.buildup);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale,
|
||||
100 * _player.buildup_share);
|
||||
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * _player.buildup_share);
|
||||
xy = 11.4;
|
||||
end
|
||||
|
||||
function ailment_buildup_UI_entity.init_module()
|
||||
|
||||
@@ -87,10 +87,8 @@ function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibi
|
||||
return entity;
|
||||
end
|
||||
|
||||
function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
|
||||
|
||||
if not part.body_part_dynamic_UI.part_visibility then
|
||||
function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_screen, opacity_scale)
|
||||
if not part_UI.part_visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -122,251 +120,61 @@ function body_part_UI_entity.draw_dynamic(part, position_on_screen, opacity_scal
|
||||
local flinch_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_health.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_health.offset.y,
|
||||
visibility = part.body_part_dynamic_UI.flinch_visibility
|
||||
visibility = part_UI.flinch_visibility
|
||||
};
|
||||
|
||||
local break_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_break.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_break.offset.y,
|
||||
visibility = part.body_part_dynamic_UI.flinch_visibility
|
||||
visibility = part_UI.flinch_visibility
|
||||
};
|
||||
|
||||
local loss_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_loss.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_loss.offset.y
|
||||
|
||||
y = position_on_screen.y + cached_config.part_loss.offset.y,
|
||||
part_UI = part_UI.loss_visibility
|
||||
};
|
||||
|
||||
if part.body_part_dynamic_UI.flinch_visibility then
|
||||
drawing.draw_bar(part.body_part_dynamic_UI.flinch_bar, flinch_position_on_screen, opacity_scale,
|
||||
if part_UI.flinch_visibility then
|
||||
drawing.draw_bar(part_UI.flinch_bar, flinch_position_on_screen, opacity_scale,
|
||||
part.health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
|
||||
if part_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
|
||||
part.break_max_count then
|
||||
drawing.draw_bar(part.body_part_dynamic_UI.break_bar, break_position_on_screen, opacity_scale,
|
||||
drawing.draw_bar(part_UI.break_bar, break_position_on_screen, opacity_scale,
|
||||
part.break_health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_dynamic_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
drawing.draw_bar(part.body_part_dynamic_UI.loss_bar, loss_position_on_screen, opacity_scale,
|
||||
if part_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
drawing.draw_bar(part_UI.loss_bar, loss_position_on_screen, opacity_scale,
|
||||
part.loss_health_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(part.body_part_dynamic_UI.part_name_label, position_on_screen, opacity_scale, part_name);
|
||||
drawing.draw_label(part_UI.part_name_label, position_on_screen, opacity_scale, part_name);
|
||||
|
||||
if part.body_part_dynamic_UI.flinch_visibility then
|
||||
drawing.draw_label(part.body_part_dynamic_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
|
||||
if part_UI.flinch_visibility then
|
||||
drawing.draw_label(part_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
|
||||
health_string);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
|
||||
drawing.draw_label(part_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
|
||||
100 * part.health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_dynamic_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
|
||||
if part_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
|
||||
part.break_max_count then
|
||||
drawing.draw_label(part.body_part_dynamic_UI.break_text_label, break_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.break_value_label, break_position_on_screen, opacity_scale,
|
||||
drawing.draw_label(part_UI.break_text_label, break_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part_UI.break_value_label, break_position_on_screen, opacity_scale,
|
||||
break_health_string);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.break_percentage_label, break_position_on_screen, opacity_scale,
|
||||
drawing.draw_label(part_UI.break_percentage_label, break_position_on_screen, opacity_scale,
|
||||
100 * part.break_health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_dynamic_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
drawing.draw_label(part.body_part_dynamic_UI.loss_text_label, loss_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.loss_value_label, loss_position_on_screen, opacity_scale,
|
||||
if part_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
drawing.draw_label(part_UI.loss_text_label, loss_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part_UI.loss_value_label, loss_position_on_screen, opacity_scale,
|
||||
loss_health_string);
|
||||
drawing.draw_label(part.body_part_dynamic_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
|
||||
100 * part.loss_health_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
function body_part_UI_entity.draw_static(part, position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.static.body_parts;
|
||||
|
||||
if not part.body_part_static_UI.part_visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
local part_name = "";
|
||||
if cached_config.part_name_label.include.part_name then
|
||||
part_name = part.name .. " ";
|
||||
end
|
||||
if cached_config.part_name_label.include.flinch_count and part.flinch_count ~= 0 then
|
||||
part_name = part_name .. "x" .. tostring(part.flinch_count) .. " ";
|
||||
end
|
||||
|
||||
if part.break_max_count ~= 0 then
|
||||
if cached_config.part_name_label.include.break_count then
|
||||
if cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
|
||||
|
||||
elseif part.flinch_count ~= 0 then
|
||||
part_name = part_name .. "x" .. tostring(part.break_count);
|
||||
end
|
||||
elseif cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. "/" .. tostring(part.break_max_count);
|
||||
end
|
||||
end
|
||||
|
||||
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
|
||||
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
|
||||
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
|
||||
|
||||
local flinch_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_health.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_health.offset.y,
|
||||
visibility = part.body_part_static_UI.flinch_visibility
|
||||
};
|
||||
|
||||
local break_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_break.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_break.offset.y,
|
||||
visibility = part.body_part_static_UI.flinch_visibility
|
||||
};
|
||||
|
||||
local loss_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_loss.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_loss.offset.y
|
||||
|
||||
};
|
||||
|
||||
if part.body_part_static_UI.flinch_visibility then
|
||||
drawing.draw_bar(part.body_part_static_UI.flinch_bar, flinch_position_on_screen, opacity_scale, part.health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_static_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
|
||||
part.break_max_count then
|
||||
drawing.draw_bar(part.body_part_static_UI.break_bar, break_position_on_screen, opacity_scale,
|
||||
part.break_health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_static_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
drawing.draw_bar(part.body_part_static_UI.loss_bar, loss_position_on_screen, opacity_scale,
|
||||
part.loss_health_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(part.body_part_static_UI.part_name_label, position_on_screen, opacity_scale, part_name);
|
||||
|
||||
if part.body_part_static_UI.flinch_visibility then
|
||||
drawing.draw_label(part.body_part_static_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_static_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
|
||||
health_string);
|
||||
drawing.draw_label(part.body_part_static_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
|
||||
100 * part.health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_static_UI.break_visibility and part.break_max_health ~= -1 and part.break_count <
|
||||
part.break_max_count then
|
||||
drawing.draw_label(part.body_part_static_UI.break_text_label, break_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_static_UI.break_value_label, break_position_on_screen, opacity_scale,
|
||||
break_health_string);
|
||||
drawing.draw_label(part.body_part_static_UI.break_percentage_label, break_position_on_screen, opacity_scale,
|
||||
100 * part.break_health_percentage);
|
||||
end
|
||||
|
||||
if part.body_part_static_UI.loss_visibility and part.loss_max_health ~= -1 and not part.is_severed then
|
||||
drawing.draw_label(part.body_part_static_UI.loss_text_label, loss_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_static_UI.loss_value_label, loss_position_on_screen, opacity_scale,
|
||||
loss_health_string);
|
||||
drawing.draw_label(part.body_part_static_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
|
||||
100 * part.loss_health_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
function body_part_UI_entity.draw_highlighted(part, position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.body_parts;
|
||||
|
||||
if not part.body_part_highlighted_UI.part_visibility then
|
||||
return;
|
||||
end
|
||||
|
||||
local part_name = "";
|
||||
if cached_config.part_name_label.include.part_name then
|
||||
part_name = part.name .. " ";
|
||||
end
|
||||
if cached_config.part_name_label.include.flinch_count and part.flinch_count ~= 0 then
|
||||
part_name = part_name .. "x" .. tostring(part.flinch_count) .. " ";
|
||||
end
|
||||
|
||||
if part.break_max_count ~= 0 then
|
||||
if cached_config.part_name_label.include.break_count then
|
||||
if cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. tostring(part.break_count) .. "/" .. tostring(part.break_max_count);
|
||||
|
||||
elseif part.flinch_count ~= 0 then
|
||||
part_name = part_name .. "x" .. tostring(part.break_count);
|
||||
end
|
||||
elseif cached_config.part_name_label.include.break_max_count then
|
||||
part_name = part_name .. "/" .. tostring(part.break_max_count);
|
||||
end
|
||||
end
|
||||
|
||||
local health_string = string.format("%.0f/%.0f", part.health, part.max_health);
|
||||
local break_health_string = string.format("%.0f/%.0f", part.break_health, part.break_max_health);
|
||||
local loss_health_string = string.format("%.0f/%.0f", part.loss_health, part.loss_max_health);
|
||||
|
||||
local flinch_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_health.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_health.offset.y,
|
||||
visibility = part.body_part_highlighted_UI.flinch_visibility
|
||||
};
|
||||
|
||||
local break_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_break.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_break.offset.y,
|
||||
visibility = part.body_part_highlighted_UI.flinch_visibility
|
||||
};
|
||||
|
||||
local loss_position_on_screen = {
|
||||
x = position_on_screen.x + cached_config.part_loss.offset.x,
|
||||
y = position_on_screen.y + cached_config.part_loss.offset.y
|
||||
|
||||
};
|
||||
|
||||
local draw_health = part.body_part_highlighted_UI.flinch_visibility and part.max_health > 0;
|
||||
local draw_break = part.body_part_highlighted_UI.break_visibility and part.break_max_health > 0 and part.break_count <
|
||||
part.break_max_count;
|
||||
local draw_loss = part.body_part_highlighted_UI.loss_visibility and part.loss_max_health > 0 and not part.is_severed;
|
||||
|
||||
if draw_health then
|
||||
drawing.draw_bar(part.body_part_highlighted_UI.flinch_bar, flinch_position_on_screen, opacity_scale,
|
||||
part.health_percentage);
|
||||
end
|
||||
|
||||
if draw_break then
|
||||
drawing.draw_bar(part.body_part_highlighted_UI.break_bar, break_position_on_screen, opacity_scale,
|
||||
part.break_health_percentage);
|
||||
end
|
||||
|
||||
if draw_loss then
|
||||
drawing.draw_bar(part.body_part_highlighted_UI.loss_bar, loss_position_on_screen, opacity_scale,
|
||||
part.loss_health_percentage);
|
||||
end
|
||||
|
||||
drawing.draw_label(part.body_part_highlighted_UI.part_name_label, position_on_screen, opacity_scale, part_name);
|
||||
|
||||
if draw_health then
|
||||
drawing.draw_label(part.body_part_highlighted_UI.flinch_text_label, flinch_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.flinch_value_label, flinch_position_on_screen, opacity_scale,
|
||||
health_string);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.flinch_percentage_label, flinch_position_on_screen, opacity_scale,
|
||||
100 * part.health_percentage);
|
||||
end
|
||||
|
||||
if draw_break then
|
||||
drawing.draw_label(part.body_part_highlighted_UI.break_text_label, break_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.break_value_label, break_position_on_screen, opacity_scale,
|
||||
break_health_string);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.break_percentage_label, break_position_on_screen, opacity_scale,
|
||||
100 * part.break_health_percentage);
|
||||
end
|
||||
|
||||
if draw_loss then
|
||||
drawing.draw_label(part.body_part_highlighted_UI.loss_text_label, loss_position_on_screen, opacity_scale);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.loss_value_label, loss_position_on_screen, opacity_scale,
|
||||
loss_health_string);
|
||||
drawing.draw_label(part.body_part_highlighted_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
|
||||
drawing.draw_label(part_UI.loss_health_percentage_label, loss_position_on_screen, opacity_scale,
|
||||
100 * part.loss_health_percentage);
|
||||
end
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user