Utilize this keyword everywhere

This commit is contained in:
GreenComfyTea
2023-04-21 10:19:12 +03:00
parent 94e9e5d18b
commit 9b1ff5b264
49 changed files with 1398 additions and 1403 deletions

View File

@@ -1,4 +1,4 @@
local ailment_UI_entity = {};
local this = {};
local config;
local utils;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_label, percentage_label, timer_label)
function this.new(visibility, bar, name_label, text_label, value_label, percentage_label, timer_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -75,7 +75,7 @@ function ailment_UI_entity.new(visibility, bar, name_label, text_label, value_la
return entity;
end
function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_screen, opacity_scale)
function this.draw(ailment, ailment_UI, cached_config, position_on_screen, opacity_scale)
if not ailment_UI.visibility then
return;
end
@@ -118,11 +118,11 @@ function ailment_UI_entity.draw(ailment, ailment_UI, cached_config, position_on_
end
end
function ailment_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
language = require("MHR_Overlay.Misc.language");
end
return ailment_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local ailment_buildup_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -38,7 +38,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ailment_name_label, player_name_label,
function this.new(buildup_bar, highlighted_buildup_bar, ailment_name_label, player_name_label,
buildup_value_label, buildup_percentage_label, total_buildup_label,
total_buildup_value_label)
local entity = {};
@@ -88,7 +88,7 @@ function ailment_buildup_UI_entity.new(buildup_bar, highlighted_buildup_bar, ail
return entity;
end
function ailment_buildup_UI_entity.draw(player, player_buildup, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup)
function this.draw(player, player_buildup, ailment_buildup_UI, cached_config, position_on_screen, opacity_scale, top_buildup)
local player_buildup_bar_percentage = 0;
if cached_config.settings.buildup_bar_relative_to == "Total Buildup" then
@@ -117,7 +117,7 @@ function ailment_buildup_UI_entity.draw(player, player_buildup, ailment_buildup_
drawing.draw_label(ailment_buildup_UI.buildup_percentage_label, position_on_screen, opacity_scale, 100 * player_buildup.buildup_share);
end
function ailment_buildup_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
@@ -125,4 +125,4 @@ function ailment_buildup_UI_entity.init_module()
language = require("MHR_Overlay.Misc.language");
end
return ailment_buildup_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local body_part_UI_entity = {};
local this = {};
local config;
local utils;
@@ -36,7 +36,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibility, flinch_bar, flinch_text_label,
function this.new(part_visibility, part_name_label, flinch_visibility, flinch_bar, flinch_text_label,
flinch_value_label, flinch_percentage_label, break_visibility, break_bar, break_text_label, break_value_label,
break_percentage_label, loss_visibility, loss_bar, loss_text_label, loss_value_label, loss_health_percentage_label)
@@ -120,7 +120,7 @@ function body_part_UI_entity.new(part_visibility, part_name_label, flinch_visibi
return entity;
end
function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_screen, opacity_scale)
function this.draw(part, part_UI, cached_config, position_on_screen, opacity_scale)
if not part_UI.part_visibility then
return;
end
@@ -250,10 +250,10 @@ function body_part_UI_entity.draw(part, part_UI, cached_config, position_on_scre
end
end
function body_part_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
end
return body_part_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local buff_UI_entity = {};
local this = {};
local config;
local utils;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function buff_UI_entity.new(bar, name_label, timer_label)
function this.new(bar, name_label, timer_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -63,7 +63,7 @@ function buff_UI_entity.new(bar, name_label, timer_label)
return entity;
end
function buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale)
function this.draw(buff, buff_UI, position_on_screen, opacity_scale)
local cached_config = config.current_config.buff_UI;
if not buff.is_infinite then
@@ -81,11 +81,11 @@ function buff_UI_entity.draw(buff, buff_UI, position_on_screen, opacity_scale)
end
end
function buff_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
language = require("MHR_Overlay.Misc.language");
end
return buff_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local damage_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -40,7 +40,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function damage_UI_entity.new(damage_meter_UI_elements, type)
function this.new(damage_meter_UI_elements, type)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -111,7 +111,7 @@ function damage_UI_entity.new(damage_meter_UI_elements, type)
return entity;
end
function damage_UI_entity.draw(player, position_on_screen, opacity_scale, top_damage, top_dps)
function this.draw(player, position_on_screen, opacity_scale, top_damage, top_dps)
local cached_config = config.current_config.damage_meter_UI;
local name_include = nil;
@@ -233,7 +233,7 @@ function damage_UI_entity.draw(player, position_on_screen, opacity_scale, top_da
end
end
function damage_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
config = require("MHR_Overlay.Misc.config");
@@ -243,4 +243,4 @@ function damage_UI_entity.init_module()
non_players = require("MHR_Overlay.Damage_Meter.non_players");
end
return damage_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local health_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function health_UI_entity.new(visibility, bar, text_label, value_label, percentage_label)
function this.new(visibility, bar, text_label, value_label, percentage_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -67,7 +67,7 @@ function health_UI_entity.new(visibility, bar, text_label, value_label, percenta
return entity;
end
function health_UI_entity.draw(monster, health_UI, position_on_screen, opacity_scale)
function this.draw(monster, health_UI, position_on_screen, opacity_scale)
if not health_UI.visibility then
return;
end
@@ -91,11 +91,11 @@ function health_UI_entity.draw(monster, health_UI, position_on_screen, opacity_s
drawing.draw_label(health_UI.percentage_label, position_on_screen, opacity_scale, 100 * monster.health_percentage);
end
function health_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
end
return health_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local rage_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
function this.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -71,7 +71,7 @@ function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage
return entity;
end
function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale)
function this.draw(monster, rage_UI, position_on_screen, opacity_scale)
if not rage_UI.visibility then
return;
end
@@ -105,11 +105,11 @@ function rage_UI_entity.draw(monster, rage_UI, position_on_screen, opacity_scale
end
end
function rage_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
end
return rage_UI_entity;
return this;

View File

@@ -1,4 +1,4 @@
local stamina_UI_entity = {};
local this = {};
local utils;
local drawing;
@@ -37,7 +37,7 @@ local os = os;
local ValueType = ValueType;
local package = package;
function stamina_UI_entity.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
function this.new(visibility, bar, text_label, value_label, percentage_label, timer_label)
local entity = {};
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
@@ -69,7 +69,7 @@ function stamina_UI_entity.new(visibility, bar, text_label, value_label, percent
return entity;
end
function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity_scale)
function this.draw(monster, stamina_UI, position_on_screen, opacity_scale)
if not stamina_UI.visibility then
return;
end
@@ -102,11 +102,11 @@ function stamina_UI_entity.draw(monster, stamina_UI, position_on_screen, opacity
end
end
function stamina_UI_entity.init_module()
function this.init_module()
utils = require("MHR_Overlay.Misc.utils");
drawing = require("MHR_Overlay.UI.drawing");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
end
return stamina_UI_entity;
return this;