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

@@ -62,13 +62,11 @@ end
function env_creature.init_UI(creature)
creature.name_label = table_helpers.deep_copy(config.current_config.endemic_life_UI.creature_name_label);
creature.name_label.offset.x = creature.name_label.offset.x * config.current_config.global_settings.modifiers.global_scale_modifier;
creature.name_label.offset.y = creature.name_label.offset.y * config.current_config.global_settings.modifiers.global_scale_modifier;
end
local global_scale_modifier = config.current_config.global_settings.modifiers.global_scale_modifier;
--local get_game_object_method = sdk.find_type_definition("via.Component"):get_method("get_GameObject");
--local get_transform_method = sdk.find_type_definition("via.GameObject"):get_method("get_Transform");
--local get_position_method = sdk.find_type_definition("via.Transform"):get_method("get_Position");
creature.name_label.offset.x = creature.name_label.offset.x * global_scale_modifier;
creature.name_label.offset.y = creature.name_label.offset.y * global_scale_modifier;
end
function env_creature.update(REcreature)
if not config.current_config.endemic_life_UI.enabled then
@@ -82,33 +80,6 @@ function env_creature.update(REcreature)
creature.position = position;
end
--[[
if creature.game_object == nil then
creature.game_object = get_game_object_method:call(REcreature);
if creature.game_object == nil then
customization_menu.status = "No enemy game object";
return;
end
end
if creature.transform == nil then
creature.transform = get_transform_method:call(creature.game_object);
if creature.transform == nil then
customization_menu.status = "No enemy transform";
return;
end
end
local position = get_position_method:call(creature.transform);
if position == nil then
customization_menu.status = "No enemy position";
return;
end
creature.position = position;
--]]
local is_inactive = creature_is_inactive_field:get_data(REcreature);
if is_inactive ~= nil then
creature.is_inactive = is_inactive;

View File

@@ -5,11 +5,6 @@ local time;
local environment_creature_base_type_def = sdk.find_type_definition("snow.envCreature.EnvironmentCreatureBase");
local environment_creature_base_update_method = environment_creature_base_type_def:get_method("update");
sdk.hook(environment_creature_base_update_method, function(args)
pcall(env_creature_hook.update_env_creature, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
function env_creature_hook.update_env_creature(REcreature)
if not config.current_config.endemic_life_UI.enabled then
@@ -23,6 +18,12 @@ function env_creature_hook.init_module()
config = require("MHR_Overlay.Misc.config");
env_creature = require("MHR_Overlay.Endemic_Life.env_creature");
time = require("MHR_Overlay.Game_Handler.time");
sdk.hook(environment_creature_base_update_method, function(args)
pcall(env_creature_hook.update_env_creature, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
end
return env_creature_hook;