mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Release v1.11
1) Cache config access function-wide where possible; 2) Break and Sever values added to parts; 3) Hooks are now applied in init_module instead of global space; 4) Added checks for submodule (health, stamina, etc) visibility. If not visible, do not pull data.
This commit is contained in:
@@ -46,93 +46,105 @@ end
|
||||
|
||||
|
||||
function body_part.init_dynamic_UI(part)
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
|
||||
|
||||
part.body_part_dynamic_UI = body_part_UI_entity.new(
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.visibility,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_name_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.visibility,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.bar,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.text_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.value_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_health.percentage_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.visibility,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.bar,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.text_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.value_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_break.percentage_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.visibility,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.bar,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.text_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.value_label,
|
||||
config.current_config.large_monster_UI.dynamic.body_parts.part_loss.percentage_label
|
||||
cached_config.visibility,
|
||||
cached_config.part_name_label,
|
||||
cached_config.part_health.visibility,
|
||||
cached_config.part_health.bar,
|
||||
cached_config.part_health.text_label,
|
||||
cached_config.part_health.value_label,
|
||||
cached_config.part_health.percentage_label,
|
||||
cached_config.part_break.visibility,
|
||||
cached_config.part_break.bar,
|
||||
cached_config.part_break.text_label,
|
||||
cached_config.part_break.value_label,
|
||||
cached_config.part_break.percentage_label,
|
||||
cached_config.part_loss.visibility,
|
||||
cached_config.part_loss.bar,
|
||||
cached_config.part_loss.text_label,
|
||||
cached_config.part_loss.value_label,
|
||||
cached_config.part_loss.percentage_label
|
||||
);
|
||||
end
|
||||
|
||||
function body_part.init_static_UI(part)
|
||||
local cached_config = config.current_config.large_monster_UI.static.body_parts;
|
||||
|
||||
part.body_part_static_UI = body_part_UI_entity.new(
|
||||
config.current_config.large_monster_UI.static.body_parts.visibility,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_name_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.visibility,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.bar,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.text_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.value_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_health.percentage_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.visibility,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.bar,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.text_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.value_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_break.percentage_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.visibility,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.bar,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.text_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.value_label,
|
||||
config.current_config.large_monster_UI.static.body_parts.part_loss.percentage_label
|
||||
cached_config.visibility,
|
||||
cached_config.part_name_label,
|
||||
cached_config.part_health.visibility,
|
||||
cached_config.part_health.bar,
|
||||
cached_config.part_health.text_label,
|
||||
cached_config.part_health.value_label,
|
||||
cached_config.part_health.percentage_label,
|
||||
cached_config.part_break.visibility,
|
||||
cached_config.part_break.bar,
|
||||
cached_config.part_break.text_label,
|
||||
cached_config.part_break.value_label,
|
||||
cached_config.part_break.percentage_label,
|
||||
cached_config.part_loss.visibility,
|
||||
cached_config.part_loss.bar,
|
||||
cached_config.part_loss.text_label,
|
||||
cached_config.part_loss.value_label,
|
||||
cached_config.part_loss.percentage_label
|
||||
);
|
||||
end
|
||||
|
||||
function body_part.init_highlighted_UI(part)
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.body_parts;
|
||||
|
||||
part.body_part_highlighted_UI = body_part_UI_entity.new(
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.visibility,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_name_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.visibility,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.bar,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.text_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.value_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_health.percentage_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.visibility,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.bar,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.text_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.value_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_break.percentage_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.visibility,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.bar,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.text_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.value_label,
|
||||
config.current_config.large_monster_UI.highlighted.body_parts.part_loss.percentage_label
|
||||
cached_config.visibility,
|
||||
cached_config.part_name_label,
|
||||
cached_config.part_health.visibility,
|
||||
cached_config.part_health.bar,
|
||||
cached_config.part_health.text_label,
|
||||
cached_config.part_health.value_label,
|
||||
cached_config.part_health.percentage_label,
|
||||
cached_config.part_break.visibility,
|
||||
cached_config.part_break.bar,
|
||||
cached_config.part_break.text_label,
|
||||
cached_config.part_break.value_label,
|
||||
cached_config.part_break.percentage_label,
|
||||
cached_config.part_loss.visibility,
|
||||
cached_config.part_loss.bar,
|
||||
cached_config.part_loss.text_label,
|
||||
cached_config.part_loss.value_label,
|
||||
cached_config.part_loss.percentage_label
|
||||
);
|
||||
end
|
||||
|
||||
function body_part.update(part, part_current, part_max, part_break_current, part_break_max, part_loss_current, part_loss_max, part_break_count, part_break_max_count, is_severed)
|
||||
if part == nil then
|
||||
return;
|
||||
end
|
||||
|
||||
function body_part.update_flinch(part, part_current, part_max)
|
||||
if part_current > part.health then
|
||||
part.flinch_count = part.flinch_count + 1;
|
||||
end
|
||||
|
||||
if part_break_current > part.break_health then
|
||||
part.break_count = part.break_count + 1;
|
||||
end
|
||||
|
||||
if part.health ~= part_current then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.max_health ~= part_max then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
part.health = part_current;
|
||||
part.max_health = part_max;
|
||||
|
||||
if part.max_health ~= 0 then
|
||||
part.health_percentage = part.health / part.max_health;
|
||||
end
|
||||
end
|
||||
|
||||
function body_part.update_break(part, part_break_current, part_break_max, part_break_count, part_break_max_count)
|
||||
|
||||
if part.break_health ~= part_break_current then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.loss_health ~= part_loss_current then
|
||||
if part.break_max_health ~= part_break_max then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
@@ -143,31 +155,35 @@ function body_part.update(part, part_current, part_max, part_break_current, part
|
||||
if part.break_max_count ~= part_break_max_count then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.is_severed ~= is_severed then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
part.health = part_current;
|
||||
part.max_health = part_max;
|
||||
|
||||
part.break_health = part_break_current;
|
||||
part.break_max_health = part_break_max;
|
||||
|
||||
part.loss_health = part_loss_current;
|
||||
part.loss_max_health = part_loss_max;
|
||||
|
||||
part.break_count = part_break_count;
|
||||
part.break_max_count = part_break_max_count;
|
||||
part.is_severed = is_severed;
|
||||
|
||||
if part.max_health ~= 0 then
|
||||
part.health_percentage = part.health / part.max_health;
|
||||
end
|
||||
|
||||
if part.break_max_health ~= 0 then
|
||||
part.break_health_percentage = part.break_health / part.break_max_health;
|
||||
end
|
||||
end
|
||||
|
||||
function body_part.update_loss(part, part_loss_current, part_loss_max, is_severed)
|
||||
if part.loss_health ~= part_loss_current then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.loss_max_health ~= part_loss_max then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if part.is_severed ~= is_severed then
|
||||
part.last_change_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
part.loss_health = part_loss_current;
|
||||
part.loss_max_health = part_loss_max;
|
||||
|
||||
part.is_severed = is_severed;
|
||||
|
||||
if part.loss_max_health ~= 0 then
|
||||
part.loss_health_percentage = part.loss_health / part.loss_max_health;
|
||||
@@ -176,22 +192,25 @@ function body_part.update(part, part_current, part_max, part_break_current, part
|
||||
end
|
||||
|
||||
function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.dynamic.body_parts;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
local displayed_parts = {};
|
||||
for REpart, part in pairs(monster.parts) do
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.settings.hide_undamaged_parts
|
||||
and part.health == part.max_health and part.flinch_count == 0
|
||||
if cached_config.settings.hide_undamaged_parts
|
||||
and ((part.health == part.max_health and part.flinch_count == 0) or part.max_health < 0)
|
||||
and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0)
|
||||
and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if (not part.body_part_dynamic_UI.flinch_visibility)
|
||||
if (not part.body_part_dynamic_UI.flinch_visibility or part.max_health < 0)
|
||||
and (not part.body_part_dynamic_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count)
|
||||
and (not part.body_part_dynamic_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > config.current_config.large_monster_UI.dynamic.body_parts.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -199,8 +218,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
::continue::
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.id > right.id;
|
||||
end);
|
||||
@@ -209,8 +228,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Health" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health > right.health;
|
||||
end);
|
||||
@@ -219,8 +238,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.health < right.health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Health Percentage" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health_percentage > right.health_percentage;
|
||||
end);
|
||||
@@ -229,8 +248,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.health_percentage < right.health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Flinch Count" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Flinch Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.flinch_count > right.flinch_count;
|
||||
end);
|
||||
@@ -239,8 +258,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.flinch_count < right.flinch_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Break Health" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health > right.break_health;
|
||||
end);
|
||||
@@ -249,8 +268,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.break_health < right.break_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Break Health Percentage" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health_percentage > right.break_health_percentage;
|
||||
end);
|
||||
@@ -259,8 +278,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.break_health_percentage < right.break_health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Break Count" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_count > right.break_count;
|
||||
end);
|
||||
@@ -269,8 +288,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.break_count < right.break_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Sever Health" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health > right.loss_health;
|
||||
end);
|
||||
@@ -279,8 +298,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
return left.loss_health < right.loss_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.dynamic.body_parts.sorting.type == "Sever Health Percentage" then
|
||||
if config.current_config.large_monster_UI.dynamic.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health_percentage > right.loss_health_percentage;
|
||||
end);
|
||||
@@ -295,8 +314,8 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
|
||||
for j, part in ipairs(displayed_parts) do
|
||||
local part_position_on_screen = {
|
||||
x = parts_position_on_screen.x + config.current_config.large_monster_UI.dynamic.body_parts.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = parts_position_on_screen.y + config.current_config.large_monster_UI.dynamic.body_parts.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = parts_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = parts_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
}
|
||||
|
||||
body_part_UI_entity.draw_dynamic(part, part_position_on_screen, opacity_scale);
|
||||
@@ -307,23 +326,25 @@ function body_part.draw_dynamic(monster, parts_position_on_screen, opacity_scale
|
||||
end
|
||||
|
||||
function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.static.body_parts;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
local displayed_parts = {};
|
||||
for REpart, part in pairs(monster.parts) do
|
||||
if config.current_config.large_monster_UI.static.body_parts.settings.hide_undamaged_parts
|
||||
and part.health == part.max_health and part.flinch_count == 0
|
||||
if cached_config.settings.hide_undamaged_parts
|
||||
and ((part.health == part.max_health and part.flinch_count == 0) or part.max_health < 0)
|
||||
and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0)
|
||||
and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if (not part.body_part_static_UI.flinch_visibility)
|
||||
if (not part.body_part_static_UI.flinch_visibility or part.max_health < 0)
|
||||
and (not part.body_part_static_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count)
|
||||
and (not part.body_part_static_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.body_parts.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > config.current_config.large_monster_UI.static.body_parts.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -331,8 +352,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
::continue::
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.id > right.id;
|
||||
end);
|
||||
@@ -341,8 +362,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Health" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health > right.health;
|
||||
end);
|
||||
@@ -351,8 +372,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.health < right.health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Health Percentage" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health_percentage > right.health_percentage;
|
||||
end);
|
||||
@@ -361,8 +382,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.health_percentage < right.health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Flinch Count" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Flinch Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.flinch_count > right.flinch_count;
|
||||
end);
|
||||
@@ -371,8 +392,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.flinch_count < right.flinch_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Break Health" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health > right.break_health;
|
||||
end);
|
||||
@@ -381,8 +402,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.break_health < right.break_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Break Health Percentage" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health_percentage > right.break_health_percentage;
|
||||
end);
|
||||
@@ -391,8 +412,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.break_health_percentage < right.break_health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Break Count" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_count > right.break_count;
|
||||
end);
|
||||
@@ -401,8 +422,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.break_count < right.break_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Sever Health" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health > right.loss_health;
|
||||
end);
|
||||
@@ -411,8 +432,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
return left.loss_health < right.loss_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.static.body_parts.sorting.type == "Sever Health Percentage" then
|
||||
if config.current_config.large_monster_UI.static.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health_percentage > right.loss_health_percentage;
|
||||
end);
|
||||
@@ -427,8 +448,8 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
|
||||
for j, part in ipairs(displayed_parts) do
|
||||
local part_position_on_screen = {
|
||||
x = parts_position_on_screen.x + config.current_config.large_monster_UI.static.body_parts.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = parts_position_on_screen.y + config.current_config.large_monster_UI.static.body_parts.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = parts_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = parts_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
}
|
||||
|
||||
body_part_UI_entity.draw_static(part, part_position_on_screen, opacity_scale);
|
||||
@@ -439,22 +460,25 @@ function body_part.draw_static(monster, parts_position_on_screen, opacity_scale)
|
||||
end
|
||||
|
||||
function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_scale)
|
||||
local cached_config = config.current_config.large_monster_UI.highlighted.body_parts;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
local displayed_parts = {};
|
||||
for REpart, part in pairs(monster.parts) do
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.settings.hide_undamaged_parts
|
||||
and part.health == part.max_health and part.flinch_count == 0
|
||||
if cached_config.settings.hide_undamaged_parts
|
||||
and ((part.health == part.max_health and part.flinch_count == 0) or part.max_health < 0)
|
||||
and ((part.break_health == part.break_max_health and part.break_count == 0) or part.break_max_health < 0)
|
||||
and ((part.loss_health == part.loss_max_health and not part.is_severed) or part.loss_max_health < 0) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if (not part.body_part_highlighted_UI.flinch_visibility)
|
||||
if (not part.body_part_highlighted_UI.flinch_visibility or part.max_health < 0)
|
||||
and (not part.body_part_highlighted_UI.break_visibility or part.break_max_health < 0 or part.break_count >= part.break_max_count)
|
||||
and (not part.body_part_highlighted_UI.loss_visibility or part.loss_max_health < 0 or part.is_severed) then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > config.current_config.large_monster_UI.highlighted.body_parts.settings.time_limit then
|
||||
if cached_config.settings.time_limit ~= 0 and time.total_elapsed_seconds - part.last_change_time > cached_config.settings.time_limit then
|
||||
goto continue;
|
||||
end
|
||||
|
||||
@@ -462,8 +486,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
::continue::
|
||||
end
|
||||
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Normal" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
if cached_config.sorting.type == "Normal" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.id > right.id;
|
||||
end);
|
||||
@@ -472,8 +496,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.id < right.id;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Health" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health > right.health;
|
||||
end);
|
||||
@@ -482,8 +506,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.health < right.health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Health Percentage" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.health_percentage > right.health_percentage;
|
||||
end);
|
||||
@@ -492,8 +516,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.health_percentage < right.health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Flinch Count" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Flinch Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.flinch_count > right.flinch_count;
|
||||
end);
|
||||
@@ -502,8 +526,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.flinch_count < right.flinch_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Break Health" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health > right.break_health;
|
||||
end);
|
||||
@@ -512,8 +536,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.break_health < right.break_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Break Health Percentage" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_health_percentage > right.break_health_percentage;
|
||||
end);
|
||||
@@ -522,8 +546,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.break_health_percentage < right.break_health_percentage;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Break Count" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Break Count" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.break_count > right.break_count;
|
||||
end);
|
||||
@@ -532,8 +556,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.break_count < right.break_count;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Sever Health" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health > right.loss_health;
|
||||
end);
|
||||
@@ -542,8 +566,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
return left.loss_health < right.loss_health;
|
||||
end);
|
||||
end
|
||||
elseif config.current_config.large_monster_UI.highlighted.body_parts.sorting.type == "Sever Health Percentage" then
|
||||
if config.current_config.large_monster_UI.highlighted.body_parts.sorting.reversed_order then
|
||||
elseif cached_config.sorting.type == "Sever Health Percentage" then
|
||||
if cached_config.sorting.reversed_order then
|
||||
table.sort(displayed_parts, function(left, right)
|
||||
return left.loss_health_percentage > right.loss_health_percentage;
|
||||
end);
|
||||
@@ -558,8 +582,8 @@ function body_part.draw_highlighted(monster, parts_position_on_screen, opacity_s
|
||||
|
||||
for j, part in ipairs(displayed_parts) do
|
||||
local part_position_on_screen = {
|
||||
x = parts_position_on_screen.x + config.current_config.large_monster_UI.highlighted.body_parts.spacing.x * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier,
|
||||
y = parts_position_on_screen.y + config.current_config.large_monster_UI.highlighted.body_parts.spacing.y * (j - 1) * config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
x = parts_position_on_screen.x + cached_config.spacing.x * (j - 1) * global_scale_modifier,
|
||||
y = parts_position_on_screen.y + cached_config.spacing.y * (j - 1) * global_scale_modifier;
|
||||
};
|
||||
|
||||
body_part_UI_entity.draw_highlighted(part, part_position_on_screen, opacity_scale);
|
||||
|
||||
Reference in New Issue
Block a user