Fix HP not updating in online when not hosting.

This commit is contained in:
GreenComfyTea
2022-07-11 12:31:10 +03:00
parent 8da36a275c
commit 072f13007d
3 changed files with 14 additions and 2 deletions

View File

@@ -167,8 +167,16 @@ function damage_hook.update_damage(enemy, enemy_calc_damage_info)
local monster;
if is_large_monster then
monster = large_monster.get_monster(enemy);
if quest_status.is_online and player.myself.id ~= 0 then
local physical_param = large_monster.update_health(enemy, monster);
large_monster.update_parts(enemy, monster, physical_param);
end
else
monster = small_monster.get_monster(enemy);
if quest_status.is_online and player.myself.id ~= 0 then
monster = small_monster.get_monster(enemy);
small_monster.update_health(enemy, monster);
end
end
local stun_damage = enemy_calc_damage_info:get_field("<StunDamage>k__BackingField");
@@ -182,6 +190,7 @@ function damage_hook.update_damage(enemy, enemy_calc_damage_info)
player.update_damage(player.total, damage_source_type, is_large_monster, damage_object);
player.update_damage(attacking_player, damage_source_type, is_large_monster, damage_object);
end
--function damage_hook.on_mystery_core_break(enemy)

View File

@@ -578,7 +578,8 @@ function player.init_UI(_player)
cached_config.dps_label,
cached_config.master_hunter_rank_label,
cached_config.damage_value_label,
cached_config.damage_percentage_label
cached_config.damage_percentage_label,
cached_config.cart_count_label
);
end

View File

@@ -3,6 +3,7 @@ local small_monster;
local large_monster;
local config;
local ailments;
local quest_status;
local character_base_type_def = sdk.find_type_definition("snow.CharacterBase");
local character_base_start_method = character_base_type_def:get_method("start");
@@ -114,6 +115,7 @@ function monster_hook.init_module()
small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster");
config = require("MHR_Overlay.Misc.config");
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
sdk.hook(enemy_character_base_update_method, function(args)
pcall(monster_hook.update_monster, sdk.to_managed_object(args[2]));