Separate Dependency Initializations

This commit is contained in:
GreenComfyTea
2023-08-05 11:24:26 +03:00
parent 30672922c4
commit 4bdb4ee2e6
52 changed files with 284 additions and 72 deletions

View File

@@ -604,7 +604,7 @@ function this.get_hotkey_name(hotkey)
return hotkey_name .. tostring(this.keys[hotkey.key]);
end
function this.init_module()
function this.init_dependencies()
config = require "MHR_Overlay.Misc.config"
singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu");
@@ -615,4 +615,7 @@ function this.init_module()
time = require("MHR_Overlay.Game_Handler.time");
end
function this.init_module()
end
return this;

View File

@@ -370,7 +370,7 @@ function this.update_is_training_area()
end
end
function this.init_module()
function this.init_dependencies()
singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu");
players = require("MHR_Overlay.Damage_Meter.players");
@@ -380,9 +380,13 @@ function this.init_module()
time = require("MHR_Overlay.Game_Handler.time");
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
non_players = require("MHR_Overlay.Damage_Meter.non_players");
end
function this.init_module()
this.init();
time.new_timer(this.update_is_online, 1);
sdk.hook(on_changed_game_status_method, function(args)
this.on_changed_game_status(sdk.to_int64(args[3]));
end, function(retval) return retval; end);

View File

@@ -2,6 +2,8 @@ local this = {};
local config;
local singletons;
local utils;
local time;
local sdk = sdk;
local tostring = tostring;
@@ -131,9 +133,15 @@ function this.calculate_absolute_coordinates(position)
return { x = _position.x, y = _position.y };
end
function this.init_module()
function this.init_dependencies()
config = require("MHR_Overlay.Misc.config");
singletons = require("MHR_Overlay.Game_Handler.singletons");
time = require("MHR_Overlay.Game_Handler.time");
utils = require("MHR_Overlay.Misc.utils");
end
function this.init_module()
time.new_timer(this.update_window_size, 1);
end
return this;

View File

@@ -1,5 +1,8 @@
local this = {};
local time;
local utils;
local sdk = sdk;
local tostring = tostring;
local pairs = pairs;
@@ -231,8 +234,13 @@ function this.init_otomo_manager()
return this.otomo_manager;
end
function this.init_dependencies()
time = require("MHR_Overlay.Game_Handler.time");
utils = require("MHR_Overlay.Misc.utils");
end
function this.init_module()
this.init();
time.new_timer(this.init, 1);
end
return this;

View File

@@ -55,7 +55,7 @@ this.last_elapsed_script_seconds = 0;
this.list = {};
function this.new_timer(callback, cooldown_seconds, start_offset_seconds)
start_offset_seconds = start_offset_seconds or 0;
start_offset_seconds = start_offset_seconds or utils.math.random();
if callback == nil or cooldown_seconds == nil then
return;
@@ -114,7 +114,7 @@ function this.update_quest_time()
this.elapsed_seconds = quest_time_total_elapsed_seconds - quest_time_elapsed_minutes * 60;
end
function this.init_module()
function this.init_dependencies()
players = require("MHR_Overlay.Damage_Meter.players");
singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu");
@@ -125,4 +125,8 @@ function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
end
function this.init_module()
this.new_timer(this.update_quest_time, 1 / 60);
end
return this;