Divergent/mods/Outfit Animations/gamedata/scripts/a_gameplay_disguise_outfit_...

42 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

local originalPIF = actor_effects.play_item_fx
actor_effects.play_item_fx = function(name)
if name == "disguise_tear_patch" then return end
originalPIF(name)
end
local originalMPA = gameplay_disguise.menu_patch_action
gameplay_disguise.menu_patch_action = function(obj)
local section = obj:section()
local comm = ini_sys:r_string_ex(section, "community")
if comm and (comm ~= "") and gameplay_disguise.possible_factions[comm] then
local id = obj:id()
local obj_patch = gameplay_disguise.get_patch(comm)
local state = se_load_var(id, obj:name(), "unpatched")
local current_outfit_id = db.actor:item_in_slot(7) and db.actor:item_in_slot(7):id() or -1
local is_equipped_outfit = id == current_outfit_id and true or false
if state and obj_patch then
if is_equipped_outfit then
outfit_animations_patches.play_animation_apply_patch(comm)
else
outfit_animations_patches.play_animation_apply_patch_inventory(comm)
end
elseif (state == nil) then
if is_equipped_outfit then
outfit_animations_patches.play_animation_remove_patch(comm)
else
outfit_animations_patches.play_animation_remove_patch_inventory(comm)
end
end
end
originalMPA(obj)
end