Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes relating to setting character visual state. #606

Merged
merged 3 commits into from
Jan 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions Hooks/PlayerStyleGloveHooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ elseif F == "glovestweakdata" then
end

local x_prio, y_prio
table.sort(variations, function (x, y)
table.sort(variations, function(x, y)
if x == "default" then
return true
end
Expand Down Expand Up @@ -289,6 +289,10 @@ elseif F == "criminalsmanager" then
local unit_damage = unit:damage()
if not unit_damage then return end

if unit:inventory() and unit:inventory().mask_visibility and not unit:inventory():mask_visibility() then
mask_id = nil
end

local function run_sequence_safe(sequence, sequence_unit)
if not sequence then
return
Expand Down Expand Up @@ -362,17 +366,16 @@ elseif F == "criminalsmanager" then
end
end

if unit:spawn_manager() then
local spawn_man = unit:spawn_manager()

local spawn_manager = unit:spawn_manager()
if spawn_manager then
-- Player Style
spawn_man:remove_unit("char_mesh")
spawn_manager:remove_unit("char_mesh")

local unit_name = get_player_style_value("unit", true)
local char_mesh_unit = nil
if unit_name then
spawn_man:spawn_and_link_unit("_char_joint_names", "char_mesh", unit_name)
char_mesh_unit = spawn_man:get_unit("char_mesh")
spawn_manager:spawn_and_link_unit("_char_joint_names", "char_mesh", unit_name)
char_mesh_unit = spawn_manager:get_unit("char_mesh")
end

if alive(char_mesh_unit) then
Expand All @@ -394,12 +397,12 @@ elseif F == "criminalsmanager" then
end

-- Gloves
spawn_man:remove_unit("char_gloves")
spawn_manager:remove_unit("char_gloves")

local char_gloves_unit = nil
if gloves_unit_name then
spawn_man:spawn_and_link_unit("_char_joint_names", "char_gloves", gloves_unit_name)
char_gloves_unit = spawn_man:get_unit("char_gloves")
spawn_manager:spawn_and_link_unit("_char_joint_names", "char_gloves", gloves_unit_name)
char_gloves_unit = spawn_manager:get_unit("char_gloves")
end

if alive(char_gloves_unit) then
Expand All @@ -421,7 +424,7 @@ elseif F == "criminalsmanager" then
end

-- Glove Adapter
spawn_man:remove_unit("char_glove_adapter")
spawn_manager:remove_unit("char_glove_adapter")

local default_adapter_data = tweak_data.blackmarket.glove_adapter

Expand Down Expand Up @@ -461,6 +464,14 @@ elseif F == "criminalsmanager" then
end
end
end

if unit:interaction() then
unit:interaction():refresh_material()
end

if unit:contour() then
unit:contour():update_materials()
end
end
elseif F == "menuarmourbase" then
function MenuArmourBase:set_gloves(glove_id, glove_variation)
Expand Down Expand Up @@ -882,7 +893,7 @@ elseif F == "blackmarketmanager" then
end
end

function BlackMarketManager:_verify_dlc_items()
Hooks:PostHook(BlackMarketManager, "_verify_dlc_items", "BeardLibVerifyDLCGloveVariations", function(self)
local achievement, glove_tweak, glove_variation_tweak, glove_variation_dlc

for glove_id, glove_data in pairs(Global.blackmarket_manager.gloves or {}) do
Expand Down Expand Up @@ -910,7 +921,7 @@ elseif F == "blackmarketmanager" then
end
end
end
end
end)
elseif F == "blackmarketgui" then
Hooks:PostHook(BlackMarketGui, "_setup", "BeardLibSetupBMG", function(self, is_start_page, component_data)
local BTNS = {
Expand Down