Change default values

This commit is contained in:
GreenComfyTea
2023-08-09 16:08:27 +03:00
parent a100932a02
commit b805d88205
6 changed files with 37 additions and 18 deletions

View File

@@ -10,6 +10,7 @@ local drawing;
local language;
local players;
local error_handler;
local utils;
local sdk = sdk;
local tostring = tostring;
@@ -56,8 +57,8 @@ function this.new(id, name, level, type)
non_player.type = type;
non_player.join_time = -1;
non_player.first_hit_time = -1;
non_player.join_time = utils.constants.uninitialized_int;
non_player.first_hit_time = utils.constants.uninitialized_int;
non_player.dps = 0;
non_player.small_monsters = players.init_damage_sources()
@@ -409,6 +410,7 @@ function this.init_dependencies()
language = require("MHR_Overlay.Misc.language");
players = require("MHR_Overlay.Damage_Meter.players");
error_handler = require("MHR_Overlay.Misc.error_handler");
utils = require("MHR_Overlay.Misc.utils");
end
function this.init_module()

View File

@@ -91,8 +91,8 @@ function this.new(id, name, master_rank, hunter_rank, type)
player.cart_count = 0;
player.join_time = -1;
player.first_hit_time = -1;
player.join_time = utils.constants.uninitialized_int;
player.first_hit_time = utils.constants.uninitialized_int;
player.dps = 0;
player.small_monsters = this.init_damage_sources();
@@ -141,7 +141,7 @@ function this.update_damage(player, damage_source_type, is_large_monster, damage
return;
end
if player.first_hit_time == -1 then
if player.first_hit_time == utils.constants.uninitialized_int then
player.first_hit_time = time.total_elapsed_script_seconds;
end
@@ -375,7 +375,7 @@ end
function this.update_player_dps(player)
local cached_config = config.current_config.damage_meter_UI.settings;
if player.join_time == -1 then
if player.join_time == utils.constants.uninitialized_int then
player.join_time = time.total_elapsed_script_seconds;
end

View File

@@ -41,6 +41,7 @@ local is_empty;
local unicode_map;
local unicode_relative_position;
local unicode_chars;
local epsilon = 0.000001;
this.table = {};
this.number = {};
@@ -51,6 +52,11 @@ this.vec4 = {};
this.math = {};
this.unicode = {};
this.constants = {};
this.constants.uninitialized_int = -420;
this.constants.uninitialized_string = "Uninitialized";
this.constants.epsilon = epsilon;
function this.table.tostring(table_)
if type(table_) == "number" or type(table_) == "boolean" or type(table_) == "string" then
return tostring(table_);
@@ -225,6 +231,14 @@ function this.number.is_even(value)
return value % 2 == 0;
end
function this.number.is_equal(value1, value2)
if math.abs(value1 - value2) < epsilon then
return true;
end
return false;
end
function this.string.trim(str)
return str:match("^%s*(.-)%s*$");
end

View File

@@ -10,6 +10,7 @@ local small_monster;
local large_monster;
local non_players;
local error_handler;
local utils;
local sdk = sdk;
local tostring = tostring;
@@ -95,7 +96,7 @@ function this.new(_ailments, ailment_id)
new_ailment.buildup_percentage = 0;
new_ailment.timer = 0;
new_ailment.duration = 100000;
new_ailment.duration = 0;
new_ailment.timer_percentage = 0;
new_ailment.minutes_left = 0;
@@ -874,6 +875,7 @@ function this.init_dependencies()
small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster");
error_handler = require("MHR_Overlay.Misc.error_handler");
utils = require("MHR_Overlay.Misc.utils");
end
function this.init_module()

View File

@@ -73,8 +73,8 @@ function this.new(enemy)
monster.id = 0;
monster.unique_id = 0;
monster.health = 100000;
monster.max_health = 100000;
monster.health = 0;
monster.max_health = 0;
monster.health_percentage = 0;
monster.missing_health = 0;
monster.is_health_initialized = false;
@@ -90,12 +90,12 @@ function this.new(enemy)
monster.is_tired = false;
monster.stamina = 0;
monster.max_stamina = 1000;
monster.max_stamina = 0;
monster.stamina_percentage = 0;
monster.missing_stamina = 0;
monster.tired_timer = 0;
monster.tired_duration = 600;
monster.tired_duration = 0;
monster.tired_total_seconds_left = 0;
monster.tired_minutes_left = 0;
@@ -104,12 +104,12 @@ function this.new(enemy)
monster.is_in_rage = false;
monster.rage_point = 0;
monster.rage_limit = 3000;
monster.rage_limit = 0;
monster.rage_count = 0;
monster.rage_percentage = 0;
monster.rage_timer = 0;
monster.rage_duration = 600;
monster.rage_duration = 0;
monster.rage_total_seconds_left = 0;
monster.rage_minutes_left = 0;
@@ -120,10 +120,10 @@ function this.new(enemy)
monster.distance = 0;
monster.name = "Large Monster";
monster.size = -1;
monster.small_border = -1;
monster.big_border = -1;
monster.king_border = -1;
monster.size = 0;
monster.small_border = 0;
monster.big_border = 0;
monster.king_border = 0;
monster.crown = "";
monster.is_anomaly = false;
@@ -771,6 +771,7 @@ function this.update_rage(enemy, monster, anger_param)
local is_in_rage = is_anger_method:call(anger_param);
if is_in_rage ~= nil then
--xy = xy .. tostring(is_in_rage) .. "\n";
monster.is_in_rage = is_in_rage;
else
error_handler.report("large_monster.update_rage", "Failed to access Data: is_in_rage");

View File

@@ -53,7 +53,7 @@ function this.new(enemy)
monster.is_large = false;
monster.health = 0;
monster.max_health = 999999;
monster.max_health = 0;
monster.health_percentage = 0;
monster.missing_health = 0;
monster.capture_health = 0;