Release v1.11

1) Cache config access function-wide where possible;
2) Break and Sever values added to parts;
3) Hooks are now applied in init_module instead of global space;
4) Added checks for submodule (health, stamina, etc) visibility. If not visible, do not pull data.
This commit is contained in:
GreenComfyTea
2022-06-20 13:01:10 +03:00
parent 286c54aa55
commit f64d6c84d3
31 changed files with 1617 additions and 1539 deletions

View File

@@ -20,18 +20,6 @@ local stock_damage_method = enemy_damage_param_type_def:get_method("stockDamage"
local poison_param_field = enemy_damage_param_type_def:get_field("_PoisonParam");
local blast_param_field = enemy_damage_param_type_def:get_field("_BlastParam");
sdk.hook(stock_damage_method, function(args)
pcall(ailment_hook.stock_damage);
end, function(retval)
return retval;
end);
sdk.hook(on_poison_activate_proc_method, function(args)
pcall(ailment_hook.poison_proc, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
function ailment_hook.poison_proc(poison_param)
if poison_param == nil then
return;
@@ -54,7 +42,7 @@ function ailment_hook.poison_proc(poison_param)
monster = small_monster.get_monster(enemy);
end
monster.ailments[ailments.poison_id].cashed_buildup_share = monster.ailments[ailments.poison_id].buildup_share;
monster.ailments[ailments.poison_id].cached_buildup_share = monster.ailments[ailments.poison_id].buildup_share;
ailments.clear_ailment_contribution(monster, ailments.poison_id);
end
@@ -92,6 +80,18 @@ function ailment_hook.init_module()
config = require("MHR_Overlay.Misc.config");
ailments = require("MHR_Overlay.Monsters.ailments");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
sdk.hook(stock_damage_method, function(args)
pcall(ailment_hook.stock_damage);
end, function(retval)
return retval;
end);
sdk.hook(on_poison_activate_proc_method, function(args)
pcall(ailment_hook.poison_proc, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
end
return ailment_hook;