mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 12:28:03 -08:00
Refactor Damage Meter UI config;
This commit is contained in:
@@ -2,7 +2,7 @@ local damage_meter_UI = {};
|
||||
local singletons;
|
||||
local config;
|
||||
local customization_menu;
|
||||
local player;
|
||||
local players;
|
||||
local non_players;
|
||||
local quest_status;
|
||||
local screen;
|
||||
@@ -28,7 +28,7 @@ function damage_meter_UI.draw()
|
||||
local cached_config = config.current_config.damage_meter_UI;
|
||||
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
|
||||
|
||||
if player.total.display.total_damage == 0 and cached_config.settings.hide_module_if_total_damage_is_zero then
|
||||
if players.total.display.total_damage == 0 and cached_config.settings.hide_module_if_total_damage_is_zero then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ function damage_meter_UI.draw()
|
||||
if damage_meter_UI.freeze_displayed_players and not table_helpers.is_empty(damage_meter_UI.last_displayed_players) then
|
||||
quest_players = damage_meter_UI.last_displayed_players;
|
||||
else
|
||||
quest_players = player.display_list;
|
||||
quest_players = players.display_list;
|
||||
end
|
||||
|
||||
damage_meter_UI.last_displayed_players = quest_players;
|
||||
@@ -64,11 +64,11 @@ function damage_meter_UI.draw()
|
||||
return;
|
||||
end
|
||||
|
||||
if cached_config.settings.hide_total_if_total_damage_is_zero and player.total.display.total_damage == 0 then
|
||||
if cached_config.settings.hide_total_if_total_damage_is_zero and players.total.display.total_damage == 0 then
|
||||
return;
|
||||
end
|
||||
|
||||
player.draw_total(position_on_screen, 1);
|
||||
players.draw(players.total, position_on_screen, 1, top_damage, top_dps);
|
||||
|
||||
if cached_config.settings.orientation == "Horizontal" then
|
||||
position_on_screen.x = position_on_screen.x + cached_config.spacing.x * global_scale_modifier;
|
||||
@@ -83,32 +83,26 @@ function damage_meter_UI.draw()
|
||||
end
|
||||
|
||||
for _, _player in ipairs(quest_players) do
|
||||
|
||||
if _player.display.total_damage == 0 and cached_config.settings.hide_player_if_player_damage_is_zero then
|
||||
goto continue
|
||||
end
|
||||
|
||||
if _player == player.myself then
|
||||
if _player.type == players.types.myself then
|
||||
if cached_config.settings.hide_myself then
|
||||
goto continue
|
||||
end
|
||||
elseif _player.is_servant then
|
||||
if cached_config.settings.hide_servants and not _player.is_otomo then
|
||||
elseif _player.type == players.types.servant then
|
||||
if cached_config.settings.hide_servants then
|
||||
goto continue
|
||||
end
|
||||
else
|
||||
if cached_config.settings.hide_other_players and not _player.is_otomo then
|
||||
elseif _player.type == players.types.other_player then
|
||||
if cached_config.settings.hide_other_players then
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
|
||||
if _player.is_player then
|
||||
player.draw(_player, position_on_screen, 1, top_damage, top_dps);
|
||||
else
|
||||
non_players.draw(_player, position_on_screen, 1, top_damage, top_dps);
|
||||
end
|
||||
players.draw(_player, position_on_screen, 1, top_damage, top_dps);
|
||||
|
||||
|
||||
if cached_config.settings.orientation == "Horizontal" then
|
||||
position_on_screen.x = position_on_screen.x + cached_config.spacing.x * global_scale_modifier;
|
||||
else
|
||||
@@ -125,7 +119,7 @@ function damage_meter_UI.draw()
|
||||
return;
|
||||
end
|
||||
|
||||
if cached_config.settings.hide_total_if_total_damage_is_zero and player.total.display.total_damage == 0 then
|
||||
if cached_config.settings.hide_total_if_total_damage_is_zero and players.total.display.total_damage == 0 then
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -133,7 +127,7 @@ function damage_meter_UI.draw()
|
||||
position_on_screen = screen.calculate_absolute_coordinates(cached_config.position);
|
||||
end
|
||||
|
||||
player.draw_total(position_on_screen, 1);
|
||||
players.draw(players.total, position_on_screen, 1);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -141,7 +135,7 @@ function damage_meter_UI.init_module()
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
player = require("MHR_Overlay.Damage_Meter.player");
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
non_players = require("MHR_Overlay.Damage_Meter.non_players");
|
||||
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
|
||||
screen = require("MHR_Overlay.Game_Handler.screen");
|
||||
|
||||
@@ -4,7 +4,7 @@ local config;
|
||||
local customization_menu;
|
||||
local large_monster;
|
||||
local screen;
|
||||
local player;
|
||||
local players;
|
||||
local drawing;
|
||||
local table_helpers;
|
||||
local health_UI_entity;
|
||||
@@ -46,7 +46,7 @@ function env_creature_UI.draw()
|
||||
position_on_screen.x = position_on_screen.x + cached_config.viewport_offset.x * global_scale_modifier;
|
||||
position_on_screen.y = position_on_screen.y + cached_config.viewport_offset.y * global_scale_modifier;
|
||||
|
||||
creature.distance = (player.myself_position - creature.position):length();
|
||||
creature.distance = (players.myself_position - creature.position):length();
|
||||
|
||||
local opacity_scale = 1;
|
||||
if creature.distance > cached_config.settings.max_distance then
|
||||
@@ -68,7 +68,7 @@ function env_creature_UI.init_module()
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
screen = require("MHR_Overlay.Game_Handler.screen");
|
||||
player = require("MHR_Overlay.Damage_Meter.player");
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
drawing = require("MHR_Overlay.UI.drawing");
|
||||
table_helpers = require("MHR_Overlay.Misc.table_helpers");
|
||||
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
|
||||
|
||||
@@ -4,7 +4,7 @@ local config;
|
||||
local customization_menu;
|
||||
local large_monster;
|
||||
local screen;
|
||||
local player;
|
||||
local players;
|
||||
local drawing;
|
||||
local table_helpers;
|
||||
local health_UI_entity;
|
||||
@@ -70,7 +70,7 @@ function large_monster_UI.draw(dynamic_enabled, static_enabled, highlighted_enab
|
||||
end
|
||||
|
||||
if update_distance then
|
||||
monster.distance = (player.myself_position - monster.position):length();
|
||||
monster.distance = (players.myself_position - monster.position):length();
|
||||
end
|
||||
|
||||
if cached_config.highlighted.auto_highlight.enabled then
|
||||
@@ -294,7 +294,7 @@ function large_monster_UI.init_module()
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
large_monster = require("MHR_Overlay.Monsters.large_monster");
|
||||
screen = require("MHR_Overlay.Game_Handler.screen");
|
||||
player = require("MHR_Overlay.Damage_Meter.player");
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
drawing = require("MHR_Overlay.UI.drawing");
|
||||
table_helpers = require("MHR_Overlay.Misc.table_helpers");
|
||||
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
|
||||
|
||||
@@ -4,7 +4,7 @@ local config;
|
||||
local small_monster;
|
||||
local customization_menu;
|
||||
local screen;
|
||||
local player;
|
||||
local players;
|
||||
local drawing;
|
||||
local table_helpers;
|
||||
local health_UI_entity;
|
||||
@@ -53,7 +53,7 @@ function small_monster_UI.draw()
|
||||
if cached_config.dynamic_positioning.enabled
|
||||
or (not cached_config.dynamic_positioning.enabled and cached_config.static_sorting.type == "Distance") then
|
||||
for _, monster in ipairs(displayed_monsters) do
|
||||
monster.distance = (player.myself_position - monster.position):length();
|
||||
monster.distance = (players.myself_position - monster.position):length();
|
||||
end
|
||||
end
|
||||
|
||||
@@ -160,7 +160,7 @@ function small_monster_UI.init_module()
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
small_monster = require("MHR_Overlay.Monsters.small_monster");
|
||||
screen = require("MHR_Overlay.Game_Handler.screen");
|
||||
player = require("MHR_Overlay.Damage_Meter.player");
|
||||
players = require("MHR_Overlay.Damage_Meter.players");
|
||||
drawing = require("MHR_Overlay.UI.drawing");
|
||||
table_helpers = require("MHR_Overlay.Misc.table_helpers");
|
||||
health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
|
||||
|
||||
Reference in New Issue
Block a user