mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-25 04:48:22 -08:00
Remove Max Updates per Tick, add Update Rate
This commit is contained in:
@@ -185,9 +185,9 @@ function damage_hook.update_damage(enemy, enemy_calc_damage_info)
|
||||
--" Condition Type: (" .. tostring(attacker_type) ..
|
||||
--") " .. tostring(condition_type);
|
||||
|
||||
if string.len(xy) > 2300 then
|
||||
xy = "";
|
||||
end
|
||||
--if string.len(xy) > 2300 then
|
||||
-- xy = "";
|
||||
--end
|
||||
|
||||
local damage_source_type = damage_hook.get_damage_source_type(attacker_type, is_marionette_attack);
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ function player.update_damage(_player, damage_source_type, is_large_monster, dam
|
||||
end
|
||||
|
||||
if _player.first_hit_time == -1 then
|
||||
_player.first_hit_time = time.total_elapsed_seconds;
|
||||
_player.first_hit_time = time.total_elapsed_script_seconds;
|
||||
end
|
||||
|
||||
local player_monster_type = _player.small_monsters;
|
||||
|
||||
@@ -3,7 +3,6 @@ local singletons;
|
||||
local customization_menu;
|
||||
local player;
|
||||
local config;
|
||||
local small_monster;
|
||||
|
||||
local quest_manager_type_def = sdk.find_type_definition("snow.QuestManager");
|
||||
local get_quest_elapsed_time_min_method = quest_manager_type_def:get_method("getQuestElapsedTimeMin");
|
||||
@@ -13,16 +12,9 @@ time.total_elapsed_seconds = 0;
|
||||
time.elapsed_minutes = 0;
|
||||
time.elapsed_seconds = 0;
|
||||
|
||||
time.total_elapsed_script_seconds = 0;
|
||||
time.last_whole_script_seconds = 0;
|
||||
|
||||
function time.update_script_time()
|
||||
time.total_elapsed_script_seconds = os.clock();
|
||||
end
|
||||
time.last_elapsed_seconds = 0;
|
||||
|
||||
function time.tick()
|
||||
time.update_script_time();
|
||||
|
||||
if singletons.quest_manager == nil then
|
||||
return;
|
||||
end
|
||||
@@ -44,10 +36,9 @@ function time.tick()
|
||||
time.total_elapsed_seconds = quest_time_total_elapsed_seconds;
|
||||
time.elapsed_seconds = quest_time_total_elapsed_seconds - quest_time_elapsed_minutes * 60;
|
||||
|
||||
if time.total_elapsed_script_seconds - time.last_whole_script_seconds > 1 then
|
||||
time.last_whole_script_seconds = time.total_elapsed_script_seconds;
|
||||
if time.total_elapsed_seconds - time.last_elapsed_seconds > 60 / config.current_config.global_settings.performance.updates_rate then
|
||||
time.last_elapsed_seconds = time.total_elapsed_seconds;
|
||||
time.update_players_dps();
|
||||
time.update_small_monsters();
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,20 +48,20 @@ function time.update_players_dps()
|
||||
local new_total_dps = 0;
|
||||
for _, _player in pairs(player.list) do
|
||||
if _player.join_time == -1 then
|
||||
_player.join_time = time.total_elapsed_script_seconds;
|
||||
_player.join_time = time.total_elapsed_seconds;
|
||||
end
|
||||
|
||||
if cached_config.dps_mode == "Quest Time" then
|
||||
if time.total_elapsed_script_seconds > 0 then
|
||||
_player.dps = _player.display.total_damage / time.total_elapsed_script_seconds;
|
||||
if time.total_elapsed_seconds > 0 then
|
||||
_player.dps = _player.display.total_damage / time.total_elapsed_seconds;
|
||||
end
|
||||
elseif cached_config.dps_mode == "Join Time" then
|
||||
if time.total_elapsed_script_seconds - _player.join_time > 0 then
|
||||
_player.dps = _player.display.total_damage / (time.total_elapsed_script_seconds - _player.join_time);
|
||||
if time.total_elapsed_seconds - _player.join_time > 0 then
|
||||
_player.dps = _player.display.total_damage / (time.total_elapsed_seconds - _player.join_time);
|
||||
end
|
||||
elseif cached_config.dps_mode == "First Hit" then
|
||||
if time.total_elapsed_script_seconds - _player.first_hit_time > 0 then
|
||||
_player.dps = _player.display.total_damage / (time.total_elapsed_script_seconds - _player.first_hit_time);
|
||||
if time.total_elapsed_seconds - _player.first_hit_time > 0 then
|
||||
_player.dps = _player.display.total_damage / (time.total_elapsed_seconds - _player.first_hit_time);
|
||||
end
|
||||
else
|
||||
end
|
||||
@@ -81,20 +72,12 @@ function time.update_players_dps()
|
||||
player.total.dps = new_total_dps;
|
||||
end
|
||||
|
||||
function time.update_small_monsters()
|
||||
|
||||
for enemy, monster in pairs(small_monster.list) do
|
||||
small_monster.update(enemy, monster);
|
||||
end
|
||||
end
|
||||
|
||||
function time.init_module()
|
||||
player = require("MHR_Overlay.Damage_Meter.player");
|
||||
singletons = require("MHR_Overlay.Game_Handler.singletons");
|
||||
customization_menu = require("MHR_Overlay.UI.customization_menu");
|
||||
time = require("MHR_Overlay.Game_Handler.time");
|
||||
config = require("MHR_Overlay.Misc.config");
|
||||
small_monster = require("MHR_Overlay.Monsters.small_monster");
|
||||
end
|
||||
|
||||
return time;
|
||||
@@ -29,8 +29,7 @@ function config.init()
|
||||
},
|
||||
|
||||
performance = {
|
||||
max_monster_updates_per_tick = 2,
|
||||
prioritize_large_monsters = false,
|
||||
update_rate = 60
|
||||
},
|
||||
|
||||
module_visibility = {
|
||||
|
||||
@@ -376,7 +376,9 @@ language.default_language = {
|
||||
hide_other_players = "Hide Other Players",
|
||||
hide_total_damage = "Hide Total Damage",
|
||||
|
||||
player_name_size_limit = "Player Name Size Limit"
|
||||
player_name_size_limit = "Player Name Size Limit",
|
||||
|
||||
update_rate = "Update Rate"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -820,14 +820,9 @@ function customization_menu.draw()
|
||||
end
|
||||
|
||||
if imgui.tree_node(language.current_language.customization_menu.performance) then
|
||||
changed, config.current_config.global_settings.performance.max_monster_updates_per_tick = imgui.slider_int(language.current_language
|
||||
.customization_menu.max_monster_updates_per_tick,
|
||||
config.current_config.global_settings.performance.max_monster_updates_per_tick, 1, 150);
|
||||
config_changed = config_changed or changed;
|
||||
|
||||
changed, config.current_config.global_settings.performance.prioritize_large_monsters = imgui.checkbox(
|
||||
language.current_language.customization_menu.prioritize_large_monsters,
|
||||
config.current_config.global_settings.performance.prioritize_large_monsters);
|
||||
changed, config.current_config.global_settings.performance.update_rate = imgui.slider_int(language.current_language
|
||||
.customization_menu.update_rate,
|
||||
config.current_config.global_settings.performance.update_rate, 1, 400);
|
||||
config_changed = config_changed or changed;
|
||||
|
||||
imgui.tree_pop();
|
||||
|
||||
Reference in New Issue
Block a user