Added New Mods and Profiles Folders

This is a complete rebuild of the modpack, with all new mods and updates for 1.5.3 of Anomaly.
This commit is contained in:
2025-01-14 05:07:53 -05:00
parent 85c665b107
commit 376b4b9689
21217 changed files with 546254 additions and 0 deletions
@@ -0,0 +1,396 @@
--TODO:
--remove dependency on fdda. Ether move all funcs to patches or add more checks
--move instant unequip code from outfit_animations.script into this script
----------------------------------------
-- action example
----------------------------------------
-- function get_action()
-- local action = {
-- sec = "", --section with animation info
-- anm = "", --animation name from animation section, if empty "anm_use" will be used by default
-- cam = "", --camera motion name from animation section, if empty "cam" will be used by default
-- snd = "", --sound path name from animation section, if empty "snd" will be used by default
-- params = {
-- delay = 0, --delay before animation will be played
-- length = 0, --set custom action length independant of animation length. Example: play idle animation while some audio plays
-- can_walk = true, --self explanatory
-- hud_fov = 0.6, --self explanatory
-- },
-- fnc = {
-- [1] = "",
-- [2] = "",
-- }
-- }
-- return action
-- end
----------------------------------------
-- moneky patches
----------------------------------------
--makes that you can't open backpack while animation palys
if zzz_ea_addon_backpack then
local originalBMO = zzz_ea_addon_backpack.backpack_m_open
zzz_ea_addon_backpack.backpack_m_open = function(name)
if lam.is_playing() then return end
originalBMO(name)
end
end
--makes that you can't pick up items while animation plays. Was causeing crash to desktop
if take_item_anim then
local originalAOIBP = take_item_anim.actor_on_item_before_pickup
function take_item_anim.actor_on_item_before_pickup(item, flags)
if is_playing() then
flags.ret_value = false
return
end
originalAOIBP(item, flags)
end
end
----------------------------------------
-- action list
----------------------------------------
local actions_first = 0
local actions_last = -1
local actions = {}
local snd_obj = nil
local current_action = nil
function add_action(action)
actions_last = actions_last + 1
actions[actions_last] = action
-- printf("first %s | last %s | length %s", actions_first, actions_last, actions_count())
on_action_added()
end
function get_next_action()
if actions_first > actions_last then return nil end --if list of action is empty
local val = actions[actions_first]
actions[actions_first] = nil
actions_first = actions_first + 1
return val
end
function actions_count()
local count = 0
for i, v in pairs(actions) do
count = count + 1
end
return count
end
----------------------------------------
-- public functions (sorta api i guess)
----------------------------------------
local _is_enabled = false
local _is_playing = false
function is_enabled()
return _is_enabled
end
function stop_current_action()
if is_playing() then
game.stop_hud_motion()
level.remove_cam_effector(2190)
if snd_obj then snd_obj:stop() end
if current_action then
local fnc = current_action.fnc
if fnc then
for i,v in pairs(fnc) do
RemoveTimeEvent("liz_animation_manager", "play_action_func_" .. i .. "_te")
end
end
RemoveTimeEvent("liz_animation_manager", "play_action_end_te")
if current_action.params.can_walk then
game.only_allow_movekeys(false)
else
level.enable_input()
end
if current_action.params.hud_fov then
lam_fov_manager.restore_fov()
end
end
current_action = nil
snd_obj = nil
on_action_end()
end
end
function stop_all_actions()
if is_playing() then
--clear action list
actions = {}
actions_first = 0
actions_last = -1
stop_current_action()
end
end
function is_playing()
return _is_playing
end
function is_able_to_play()
--all safety checks go here
if not _is_enabled then return false end --script is disabled
if not db.actor:alive() then return end --player is dead
if has_alife_info("BAR_ARENA_FIGHT") then return end --is fighting on arena
if enhanced_animations and enhanced_animations.used_item then return end --possible compatibility issues?
return true
end
--add action to play queue if nothing other plays
function try_play_action(action)
if not is_enabled() then return false end
if is_playing() then return false end
add_action(action)
return true
end
--add action to paly queue no matter if something already palys
function add_action_to_queue(action)
if not is_enabled() then return end
add_action(action)
end
----------------------------------------
-- callbacks
----------------------------------------
function on_game_start()
RegisterScriptCallback("actor_on_first_update", actor_on_first_update)
-- RegisterScriptCallback("on_before_key_press", on_before_key_press)
end
function actor_on_first_update()
CreateTimeEvent("liz_animation_manager", "initialize_te", 3, function ()
_is_enabled = true
return true
end)
end
-- function on_before_key_press(dik, bind, dis, flags)
-- if is_playing() then
-- if dik == DIK_keys.DIK_K then
-- stop_current_action()
-- elseif dik == DIK_keys.DIK_L then
-- stop_all_actions()
-- end
-- if _lock_keys_allow_movement then
-- if
-- dik ~= DIK_keys.DIK_W
-- and dik ~= DIK_keys.DIK_A
-- and dik ~= DIK_keys.DIK_S
-- and dik ~= DIK_keys.DIK_D
-- then
-- flags.ret_value = false
-- return
-- end
-- elseif _lock_keys_all then
-- flags.ret_value = false
-- return
-- end
-- end
-- end
function on_action_added()
if is_playing() then return end
process_next_action()
end
function on_action_end()
process_next_action()
end
----------------------------------------
-- main
----------------------------------------
local cur_slot
local det_active
function process_next_action()
--out of actions show weapon set playing flag to false
if actions_count() == 0 then
show_weapons()
_is_playing = false
return
end
--semething else don't allow to play action, then skip it
if not is_able_to_play() then
get_next_action()
process_next_action()
return
end
if not is_playing() then
_is_playing = true
hide_weapons()
CreateTimeEvent("liz_animation_manager", "wait_for_free_hands_te", 0, function()
if
db.actor:active_slot() == 0
and not db.actor:active_detector()
and (not enhanced_animations or not enhanced_animations.used_item)
then
-- play_action()
CreateTimeEvent("liz_animation_manager", "wait_for_free_hands_delay_te", 0, function () --"fix" for 1.5.1 why it works I do not know ¯\(°_o)/¯
play_action()
return true
end)
return true
end
return false
end)
return
end
CreateTimeEvent("liz_animation_manager", "play_next_action_te", 0.01, function()
play_action()
return true
end)
end
function hide_weapons()
--fdda compatibility
if enhanced_animations and (zzz_ea_addon_backpack and zzz_ea_addon_backpack.anim_enabled and zzz_ea_addon_backpack.backpack_open_flag) then
cur_slot = zzz_ea_addon_backpack.active_slot
det_active = zzz_ea_addon_backpack.det_active
zzz_ea_addon_backpack.active_slot = nil
zzz_ea_addon_backpack.det_active = nil
else
cur_slot = db.actor:active_slot()
det_active = db.actor:active_detector() or nil
if det_active then det_active:switch_state(2) end
end
hide_hud_inventory()
db.actor:activate_slot(0)
end
function show_weapons()
db.actor:activate_slot(cur_slot or 0)
if det_active then det_active:switch_state(1) end
end
-- local ae = actor_effects --sortcut cuz i'm lazy to type full script name every time
function play_action()
local action = get_next_action()
current_action = action
local params = action.params or {}
local length = params.length or game.get_motion_length(action.sec, action.anm or "anm_use", 1) / 1000
local delay = params.delay or 0
--handle params start
if params.can_walk then
game.only_allow_movekeys(true)
else
level.disable_input()
end
if params.hud_fov then
lam_fov_manager.set_fov(0.6)
end
--handle params end
--play animation
CreateTimeEvent("liz_animation_manager", "play_action_te", delay, function()
game.play_hud_motion(2, action.sec, action.anm or "anm_use", false, 1)
local cam = ini_sys:r_string_ex(action.sec, action.cam or "cam")
if cam then
level.add_cam_effector(cam, 2190, false, "")
end
local snd = ini_sys:r_string_ex(action.sec, action.snd or "snd")
if snd then
-- xr_effects.play_snd(db.actor, nil, { [1] = snd })
snd_obj = sound_object(snd)
snd_obj:play(db.actor, 0, sound_object.s2d)
end
return true
end)
--create time events for all additional actions
local last_fnc = 0
local animation_end = delay + length
local fnc = action.fnc
if fnc then
for i,v in pairs(fnc) do
if i > last_fnc then
last_fnc = i
end
CreateTimeEvent("liz_animation_manager", "play_action_func_" .. i .. "_te", i/1000, function ()
assert(loadstring(v))() --this bound to blowup in my face at some point
return true
end)
end
end
last_fnc = last_fnc / 1000
local action_end = animation_end > last_fnc and animation_end or last_fnc
--callback after action ends
CreateTimeEvent("liz_animation_manager", "play_action_end_te", action_end, function ()
--handle params start
if params.can_walk then
game.only_allow_movekeys(false)
else
level.enable_input()
end
if params.hud_fov then
lam_fov_manager.restore_fov()
end
--handle params end
current_action = nil
snd_obj = nil
on_action_end()
return true
end)
-- is it good idea to piggyback on actor_effects code?
-- if (time_global() > ae.time_disabled) then
-- local tg = tostring(time_global())
-- local te = (delay + length) * 1000
-- ae.item_not_in_use = false
-- ae.item_in_use[tg] = action.fnc or {} -- should actually find last object in array. if it fiers after animation then add callback after it
-- if params.can_walk then
-- ae.item_in_use[tg][te] = "game.only_allow_movekeys(false)"
-- else
-- ae.item_in_use[tg][te] = "level.disable_input()"
-- end
-- ae.item_in_use[tg][te + 1] = "liz_anim_manager.on_action_end()"
-- for i,v in pairs(ae.item_in_use[tg]) do
-- printf("%s = %s", i, v)
-- end
-- end
end
-- local _lock_keys_allow_movement = false
-- local _lock_keys_all = false
@@ -0,0 +1,31 @@
local default_fov
function on_game_start()
RegisterScriptCallback("on_game_load", on_game_load)
RegisterScriptCallback("on_option_change", on_option_change)
end
function on_game_load()
write_fov()
end
function on_option_change()
write_fov()
end
function write_fov()
default_fov = ui_options.get("video/basic/hud_fov")
end
function set_fov(new_fov)
exec_console_cmd("hud_fov " .. new_fov)
end
function restore_fov()
exec_console_cmd("hud_fov " .. default_fov)
end
@@ -0,0 +1,382 @@
enable_animations = false
-- local fov_manager = lam_fov_manager
local mcm_memory_enable = outfit_animations_mcm.get_config("memory")
local mcm_allow_movement = outfit_animations_mcm.get_config("allow_movement")
local mcm_enable_animation = outfit_animations_mcm.get_config("enable_outfit_equip")
local ruck_last_outfit = -1
local is_animation_playing = false
local item_to_equip
local item_to_unequip
------------------------------------------------------------------------------
--#region monkey patches
------------------------------------------------------------------------------
local originalPIF = actor_effects.play_item_fx
function actor_effects.play_item_fx(name)
if name == "outfit" then return end
originalPIF(name)
end
--#endregion
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--#region callbacks
------------------------------------------------------------------------------
function on_game_start()
RegisterScriptCallback("on_option_change", on_option_change)
RegisterScriptCallback("actor_on_first_update", actor_on_first_update)
RegisterScriptCallback("actor_item_to_slot", on_item_to_slot)
RegisterScriptCallback("actor_item_to_ruck", on_item_to_ruck)
RegisterScriptCallback("actor_on_item_drop", on_item_to_ruck)
end
function on_option_change()
mcm_memory_enable = outfit_animations_mcm.get_config("memory")
mcm_allow_movement = outfit_animations_mcm.get_config("allow_movement")
memory_max = outfit_animations_mcm.get_config("memory_size")
mcm_enable_animation = outfit_animations_mcm.get_config("enable_outfit_equip")
end
function actor_on_first_update()
CreateTimeEvent("outfit_animations", "enable_animation_delay_te", 3, function()
ruck_last_outfit = db.actor:item_in_slot(7) and db.actor:item_in_slot(7):id() or -1
local sec = db.actor:item_in_slot(7) and db.actor:item_in_slot(7):section()
if sec then remember_outfit(sec) end
enable_animations = true
return true
end)
end
function on_item_to_ruck(obj)
if IsOutfit(obj) and obj:id() == ruck_last_outfit then
ruck_last_outfit = -1
if not db.actor:alive() then return end
if not enable_animations then return end
if not mcm_enable_animation then return end
if has_alife_info("bar_arena_fight") then return end
item_to_unequip = obj and obj:section() or nil
if not is_animation_playing then
is_animation_playing = true
play_animation(obj)
end
end
end
function on_item_to_slot(obj)
if IsOutfit(obj) and obj:id() ~= ruck_last_outfit then
ruck_last_outfit = obj:id()
if not db.actor:alive() then return end
if not enable_animations then return end
if not mcm_enable_animation then return end
if has_alife_info("bar_arena_fight") then return end
item_to_equip = obj and obj:section() or nil
if not is_animation_playing then
is_animation_playing = true
play_animation(obj)
end
end
end
--#endregion
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--#region main
------------------------------------------------------------------------------
local activeSlot
local activeWpn
local activeDetector
local activeWpnId
local activeDetectorId
function play_animation(obj)
hide_hud_inventory()
CreateTimeEvent("outfit_animations", "select_animation_te", 0.05, function ()
--trying to kill backpack animation (kinda afterid that it might cause busy hands bug. Need some testing)
-- if enhanced_animations and ui_mcm and ui_mcm.get("EA_settings/enable_backpack_addon") then
if enhanced_animations and enhanced_animations.used_item and enhanced_animations.used_item:sub(1,14) == "backpack_close" then
game.stop_hud_motion()
enhanced_animations.stop_my_item_anim() --boy I don't like this hack
RemoveTimeEvent("ea_anim_stoper", "stop_my_item_anim")
end
hide_weapon()
local anm_info = select_animation(item_to_equip or item_to_unequip)
local length = game.get_motion_length(anm_info.section_name, "anm_equip", 1) -- / 1000
local action = {
sec = anm_info.section_name,
anm = "anm_equip",
params = {
delay = 0.125,
can_walk = mcm_allow_movement,
hud_fov = 0.6
},
fnc = {
[length + 125] = "outfit_animations.show_weapon()"
}
}
lam.try_play_action(action)
is_animation_playing = false
item_to_equip = nil
item_to_unequip = nil
return true
end)
end
function hide_weapon()
activeSlot = db.actor:active_slot()
activeWpn = db.actor:active_item()
activeDetector = db.actor:active_detector()
activeWpnId = nil
activeDetectorId = nil
if activeWpn or activeDetector then
if activeWpn then
db.actor:move_to_ruck(activeWpn)
activeWpnId = activeWpn:id()
end
if activeDetector then
db.actor:move_to_ruck(activeDetector)
activeDetectorId = activeDetector:id()
end
end
-- return true
end
function show_weapon()
-- Restore weapons if had
if activeWpnId or activeDetectorId then
if activeWpnId then
local obj = level.object_by_id(activeWpnId)
if obj then
db.actor:move_to_slot(obj, activeSlot)
CreateTimeEvent("outfit_animations", "restore_active_weapon_te", 0.05, function()
db.actor:activate_slot(activeSlot)
return true
end)
-- nextTick(function()
-- db.actor:activate_slot(activeSlot)
-- return true
-- end, 2)
end
end
if activeDetectorId then
local obj = level.object_by_id(activeDetectorId)
if obj then
db.actor:move_to_slot(obj, 9)
-- Time event for proper animation play
CreateTimeEvent("outfit_animations", "restore_active_detector_te", 0.5, function()
obj:switch_state(1)
return true
end)
end
end
end
-- if mcm_allow_movement then game.only_allow_movekeys(false) else level.enable_input() end
-- if headgear_animations then headgear_animations.enable_animations = true end
-- outfit_animations_backpack.enable_animations = true
end
-- function play_animation_old(obj)
-- --prepare for anim
-- outfit_animations_backpack.enable_animations = false
-- if headgear_animations then headgear_animations.enable_animations = false end
-- hide_hud_inventory()
-- --trying to kill backpack animation (kinda afterid that it might cause busy hands bug. Need some testing)
-- if enhanced_animations and ui_mcm.get("EA_settings/enable_backpack_addon") then
-- CreateTimeEvent("outfit_animations", "stop_fdda_animation_te", 0.05, function()
-- game.stop_hud_motion()
-- fov_manager.restore_fov()
-- if mcm_allow_movement then game.only_allow_movekeys(true) else level.disable_input() end
-- return true
-- end)
-- end
-- local activeSlot = db.actor:active_slot()
-- local activeWpn = db.actor:active_item()
-- local activeDetector = db.actor:active_detector()
-- local activeWpnId
-- local activeDetectorId
-- CreateTimeEvent("outfit_animations", "unequip_weapon_te", 0.1, function()
-- if activeWpn or activeDetector then
-- if activeWpn then
-- db.actor:move_to_ruck(activeWpn)
-- activeWpnId = activeWpn:id()
-- end
-- if activeDetector then
-- db.actor:move_to_ruck(activeDetector)
-- activeDetectorId = activeDetector:id()
-- end
-- end
-- return true
-- end)
-- --play
-- anm_info = select_animation(obj)
-- local delay = 0.25
-- local length = 0
-- length = length + game.get_motion_length(anm_info.section_name, anm_info.anm, 1) / 1000
-- Invoke("play_outfti_inspect_animation_te", delay, function()
-- xr_effects.play_snd(db.actor, nil, {[1] = anm_info.snd})
-- level.add_cam_effector(anm_info.cam, 1300, false, "")
-- game.play_hud_motion(2, anm_info.section_name, anm_info.anm, false, 1)
-- end)
-- --restore
-- Invoke("restore_after_animtion_play_te", delay + length + 0.25, function()
-- -- Restore weapons if had
-- if activeWpnId or activeDetectorId then
-- if activeWpnId then
-- local obj = level.object_by_id(activeWpnId)
-- if obj then
-- db.actor:move_to_slot(obj, activeSlot)
-- CreateTimeEvent("outfit_animations", "restore_active_weapon_te", 0.05, function()
-- db.actor:activate_slot(activeSlot)
-- return true
-- end)
-- -- nextTick(function()
-- -- db.actor:activate_slot(activeSlot)
-- -- return true
-- -- end, 2)
-- end
-- end
-- if activeDetectorId then
-- local obj = level.object_by_id(activeDetectorId)
-- if obj then
-- db.actor:move_to_slot(obj, 9)
-- -- Time event for proper animation play
-- CreateTimeEvent("outfit_animations", "restore_active_detector_te", 0.5, function()
-- obj:switch_state(1)
-- return true
-- end)
-- end
-- end
-- end
-- if mcm_allow_movement then game.only_allow_movekeys(false) else level.enable_input() end
-- if headgear_animations then headgear_animations.enable_animations = true end
-- outfit_animations_backpack.enable_animations = true
-- end)
-- end
function select_animation(sec)
local m_section = "outfit_animation_hud"
if mcm_memory_enable then
-- local sec = obj and obj:section()
if sec then
if memory_contain(sec) then
m_section = "outfit_animation_fast_hud"
else
remember_outfit(sec)
m_section = "outfit_animation_hud"
end
else
m_section = "outfit_animation_fast_hud"
end
end
return {
section_name = m_section,
anm = "anm_equip",
cam = ini_sys:r_string_ex(m_section, "cam"),
snd = ini_sys:r_string_ex(m_section, "snd")
}
end
-- function Invoke(name, time, action)
-- CreateTimeEvent("outfit_animations", name, time, function()
-- action()
-- return true
-- end)
-- end
--#endregion
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--#region outfit memmory management.
------------------------------------------------------------------------------
local memory_first = 0
local memory_last = -1
local memory_max = outfit_animations_mcm.get_config("memory_size")
local memory = {}
function remember_outfit(sec)
local last = memory_last + 1
memory_last = last
memory[last] = sec
if memory_max > 0 and (memory_size() > memory_max) then
forget_outfit()
end
end
function forget_outfit()
local first = memory_first
memory[first] = nil
memory_first = first + 1
end
function memory_size()
local count = 0
for _, __ in pairs(memory) do
count = count + 1
end
return count
end
function memory_contain(sec)
for _, v in pairs(memory) do
if v == sec then return true end
end
return false
end
function memory_print()
local s = memory_size()
if s == 0 then
printf("outfit memory: l(" .. s ..") {}")
return
end
printf("outfit memory: l(" .. s .. ") {")
for i, v in pairs(memory) do
if i == "last" or i == "first" or i == "maximum" then
goto continue
end
printf(" " .. i .. " = " .. v)
::continue::
end
printf("}")
end
--#endregion
------------------------------------------------------------------------------
@@ -0,0 +1,245 @@
-- enable_animations = false
-- local fov_manager = lam_fov_manager
local mcm_allow_movement = outfit_animations_mcm.get_config("allow_movement")
local mcm_enable_animation = outfit_animations_mcm.get_config("enable_backpack_equip")
local ruck_last_backpack = -1
local is_animation_playing = false
local item_to_equip = nil
local item_to_unequip = nil
----------------------------------------
--#region callbacks
----------------------------------------
function on_game_start()
RegisterScriptCallback("on_option_change", on_option_change)
RegisterScriptCallback("actor_on_first_update", actor_on_first_update)
RegisterScriptCallback("actor_item_to_slot", on_item_to_slot)
RegisterScriptCallback("actor_item_to_ruck", on_item_to_ruck)
RegisterScriptCallback("actor_on_item_drop", on_item_to_ruck)
end
function on_option_change()
mcm_allow_movement = outfit_animations_mcm.get_config("allow_movement")
mcm_enable_animation = outfit_animations_mcm.get_config("enable_backpack_equip")
end
function actor_on_first_update()
CreateTimeEvent("outfit_animations_backpack", "enable_backpack_animation_delay_te", 3, function()
ruck_last_backpack = db.actor:item_in_slot(13) and db.actor:item_in_slot(13):id() or -1
-- enable_animations = true
return true
end)
end
function on_item_to_ruck(obj)
if IsItem("backpack", nil, obj) and obj:id() == ruck_last_backpack then
ruck_last_backpack = -1
-- if not db.actor:alive() then return end
-- if not enable_animations then return end
-- if has_alife_info("BAR_ARENA_FIGHT") then return end
if not mcm_enable_animation then return end
item_to_unequip = get_section_name("outfit_animation_backpack_unequip")
if not is_animation_playing then
is_animation_playing = true
-- play_animation_enter()
play_animation()
end
end
end
function on_item_to_slot(obj)
if IsItem("backpack", nil, obj) and obj:id() ~= ruck_last_backpack then
ruck_last_backpack = obj:id()
-- if not db.actor:alive() then return end
-- if not enable_animations then return end
-- if has_alife_info("BAR_ARENA_FIGHT") then return end
if not mcm_enable_animation then return end
item_to_equip = get_section_name("outfit_animation_backpack_equip")
if not is_animation_playing then
is_animation_playing = true
-- play_animation_enter()
play_animation()
end
end
end
--#endregion
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--#region main
------------------------------------------------------------------------------
function play_animation()
CreateTimeEvent("liz_outfit_animations_backpack", "select_animation", 0.1, function ()
local action_equip = {
sec = item_to_equip,
params = {
can_walk = mcm_allow_movement,
hud_fov = 0.6
}
}
local action_unequip = {
sec = item_to_unequip,
params = {
can_walk = mcm_allow_movement,
hud_fov = 0.6
}
}
if item_to_unequip and item_to_equip then
local result = lam.is_playing()
if result then
item_to_equip = nil
item_to_unequip = nil
is_animation_playing = false
return true
end
lam.try_play_action(action_unequip)
lam.add_action_to_queue(action_equip)
elseif item_to_unequip and not item_to_equip then
lam.try_play_action(action_unequip)
elseif not item_to_unequip and item_to_equip then
lam.try_play_action(action_equip)
end
item_to_equip = nil
item_to_unequip = nil
is_animation_playing = false
return true
end)
end
-- -- prepare before animation
-- function play_animation_enter()
-- hide_hud_inventory()
-- if headgear_animations then headgear_animations.enable_animations = false end
-- -- cur_slot = db.actor:active_slot()
-- det_active = db.actor:active_detector() or nil
-- if det_active then det_active:switch_state(2) end
-- db.actor:activate_slot(0)
-- wait_for_free_hands(play_animation_execute)
-- end
-- function play_animation_execute()
-- if mcm_allow_movement then game.only_allow_movekeys(true) else level.disable_input() end
-- fov_manager.restore_fov()
-- if item_to_unequip and item_to_equip then
-- swap()
-- elseif item_to_unequip and not item_to_equip then
-- unequip()
-- elseif not item_to_unequip and item_to_equip then
-- equip()
-- end
-- end
-- -- restore after animation
-- function play_animation_exit()
-- if mcm_allow_movement then game.only_allow_movekeys(false) else level.enable_input() end
-- if headgear_animations then headgear_animations.enable_animations = true end
-- item_to_equip = nil
-- item_to_unequip = nil
-- is_animation_playing = false
-- end
-- ------------------------------------------------------------------------------
-- function equip()
-- local anm = "anm_use"
-- local cam = ini_sys:r_string_ex(item_to_equip, "cam")
-- local snd = ini_sys:r_string_ex(item_to_equip, "snd")
-- local length = game.get_motion_length(item_to_equip, anm, 1) / 1000
-- xr_effects.play_snd(db.actor, nil, { [1] = snd })
-- level.add_cam_effector(cam, 1301, false, "")
-- game.play_hud_motion(2, item_to_equip, anm, false, 1)
-- Invoke("restore_after_animation_te", length + 0.25, play_animation_exit)
-- end
-- function unequip()
-- local anm = "anm_use"
-- local cam = ini_sys:r_string_ex(item_to_unequip, "cam")
-- local snd = ini_sys:r_string_ex(item_to_unequip, "snd")
-- local length = game.get_motion_length(item_to_unequip, anm, 1) / 1000
-- xr_effects.play_snd(db.actor, nil, { [1] = snd })
-- level.add_cam_effector(cam, 1302, false, "")
-- game.play_hud_motion(2, item_to_unequip, anm, false, 1)
-- Invoke("restore_after_animation_te", length + 0.25, play_animation_exit)
-- end
-- function swap()
-- local anm = "anm_use"
-- local cam_unequip = ini_sys:r_string_ex(item_to_unequip, "cam")
-- local snd_unequip = ini_sys:r_string_ex(item_to_unequip, "snd")
-- local cam_equip = ini_sys:r_string_ex(item_to_equip, "cam")
-- local snd_equip = ini_sys:r_string_ex(item_to_equip, "snd")
-- local length_unequip = game.get_motion_length(item_to_unequip, anm, 1) / 1000
-- local length_equip = game.get_motion_length(item_to_equip, anm, 1) / 1000
-- xr_effects.play_snd(db.actor, nil, { [1] = snd_unequip })
-- level.add_cam_effector(cam_unequip, 1303, false, "")
-- game.play_hud_motion(2, item_to_unequip, anm, false, 1)
-- Invoke("play_equip_animation_after_unequip_te", length_unequip, function ()
-- xr_effects.play_snd(db.actor, nil, { [1] = snd_equip })
-- level.add_cam_effector(cam_equip, 1300, false, "")
-- game.play_hud_motion(2, item_to_equip, anm, false, 1)
-- Invoke("restore_after_animation_te", length_equip + 0.25, play_animation_exit)
-- end)
-- end
--#endregion
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--#region utils
------------------------------------------------------------------------------
function get_section_name(section)
local faction = character_community(db.actor):sub(7)
return section .. "_" .. faction .. "_hud"
end
-- function wait_for_free_hands(action_to_perform)
-- local force_timer = 0
-- CreateTimeEvent("outfit_animations_backpack", "wait_for_free_hands_te0", 0.1, function()
-- if (db.actor:active_slot() == 0 and not db.actor:active_detector() and not enhanced_animations.used_item) or (force_timer > 5) then
-- Invoke("wait_for_free_hands_te1", 0.1, action_to_perform) --i don understan y this works (ノへ ̄、)
-- return true
-- end
-- force_timer = force_timer + (device().time_delta / 1000)
-- return false
-- end)
-- end
-- function Invoke(name, time, action)
-- CreateTimeEvent("outfit_animations_backpack", name, time, function()
-- action()
-- return true
-- end)
-- end
--#endregion
------------------------------------------------------------------------------
@@ -0,0 +1,3 @@
if demonized_time_events and fdda_time_events then
outfit_animations.RemoveTimeEvent = demonized_time_events.RemoveTimeEvent
end
@@ -0,0 +1,140 @@
local keybind = outfit_animations_mcm.get_config("keybind")
local modifier = outfit_animations_mcm.get_config("modifier")
local mode = outfit_animations_mcm.get_config("mode")
local mcm_allow_movement = outfit_animations_mcm.get_config("allow_movement")
local mcm_keybinds = ui_mcm and ui_mcm.key_hold
-- local fov_manager = lam_fov_manager
----------------------------------------
--#region callbacks
----------------------------------------
function on_game_start()
RegisterScriptCallback("on_option_change", on_option_change)
RegisterScriptCallback("on_key_hold", on_key_hold)
RegisterScriptCallback("on_key_press", on_key_press)
end
function on_option_change()
keybind = outfit_animations_mcm.get_config("keybind")
modifier = outfit_animations_mcm.get_config("modifier")
mode = outfit_animations_mcm.get_config("mode")
mcm_allow_movement = outfit_animations_mcm.get_config("allow_movement")
end
function on_key_hold(key)
if mcm_keybinds and (key == keybind) and (mode == 2) and ui_mcm.get_mod_key(modifier) and ui_mcm.key_hold("liz_outfit_animations", key) then
--do stuff on hold
play_animation()
end
end
function on_key_press(key)
if key ~= keybind then return end
if (not mcm_keybinds) then
-- do stuff for non mcm users
play_animation()
return
end
if (mode == 0) and ui_mcm.get_mod_key(modifier) then
ui_mcm.simple_press("liz_outfit_animations", key, play_animation)
end
if (mode == 1) and ui_mcm.get_mod_key(modifier) and ui_mcm.double_tap("liz_outfit_animations", key) then
-- do stuff for double tap
play_animation()
return
end
end
--#endregion
----------------------------------------
----------------------------------------
--#region main
----------------------------------------
function play_animation()
local action = {
sec = "outfit_animation_inspect_hud",
anm = "anm_equip",
params = {
can_walk = mcm_allow_movement
}
}
lam.try_play_action(action)
end
-- local cur_slot
-- local det_active
-- function play_animation()
-- --safety chekcs
-- if not db.actor:alive() then return end
-- if has_alife_info("bar_arena_fight") then return end
-- --prepare
-- hide_hud_inventory()
-- cur_slot = db.actor:active_slot()
-- det_active = db.actor:active_detector() or nil
-- if det_active then det_active:switch_state(2) end
-- db.actor:activate_slot(0)
-- wait_for_free_hands(function()
-- --play
-- fov_manager.restore_fov()
-- if mcm_allow_movement then game.only_allow_movekeys(true) else level.disable_input() end
-- local delay = 0.25
-- local m_section = "outfit_animation_inspect_hud"
-- local anm = "anm_equip"
-- local cam = ini_sys:r_string_ex(m_section, "cam")
-- local snd = ini_sys:r_string_ex(m_section, "snd")
-- local length = 0
-- length = length + game.get_motion_length(m_section, anm, 1) / 1000
-- Invoke("play_outfti_inspect_animation_te1", delay, function()
-- xr_effects.play_snd(db.actor, nil, {[1] = snd})
-- level.add_cam_effector(cam, 1300, false, "")
-- game.play_hud_motion(2, m_section, anm, false, 1)
-- end)
-- --restore
-- Invoke("play_outfti_inspect_animation_te2", length + delay + 0.25, function()
-- if mcm_allow_movement then game.only_allow_movekeys(false) else level.enable_input() end
-- db.actor:activate_slot(cur_slot or 0)
-- if det_active then det_active:switch_state(1) end
-- end)
-- end)
-- end
----------------------------------------
-- helper functions
----------------------------------------
-- function wait_for_free_hands(action_to_perform)
-- local force_timer = 0
-- CreateTimeEvent("outfit_animations_inspect", "wait_for_free_hands_te0", 0.1, function()
-- if (db.actor:active_slot() == 0 and not db.actor:active_detector() and not enhanced_animations.used_item) or (force_timer > 5) then
-- Invoke("wait_for_free_hands_te1", 0, action_to_perform) --i don understan y this works (ノへ ̄、)
-- return true
-- end
-- force_timer = force_timer + (device().time_delta/1000)
-- return false
-- end)
-- end
-- function Invoke(name, time, action)
-- CreateTimeEvent("outfit_animations_inspect", name, time, function()
-- action()
-- return true
-- end)
-- end
--#endregion
----------------------------------------
@@ -0,0 +1,112 @@
local defaults = {
["keybind"] = bind_to_dik(key_bindings.kCAM_ZOOM_IN),
["modifier"] = 3,
["mode"] = 0,
["memory"] = true,
["memory_size"] = 3,
["allow_movement"] = true,
["enable_outfit_equip"] = true,
["enable_backpack_equip"] = true,
["enable_patches"] = true,
["enable_patches_inventory"] = true,
}
function on_mcm_load()
local options = {
id = "liz_outfit_animations",
sh = true,
gr = {
{
id = "liz_outfit_animations",
type = "slide",
link = "ui_options_slider_player",
text = "ui_mcm_menu_liz_outfit_animations",
size = { 512, 50 },
spacing = 20
},
{
id = "keybind",
type = "key_bind",
val = 2,
def = defaults["keybind"],
},
{
id = "mode",
type = ui_mcm.kb_mod_radio,
val = 2,
def = 0,
hint = "mcm_kb_mode",
content = { { 0, "mcm_kb_mode_press" }, { 1, "mcm_kb_mode_dtap" }, { 2, "mcm_kb_mode_hold" } }
},
{
id = "modifier",
type = ui_mcm.kb_mod_radio,
val = 2,
def = 3,
hint = "mcm_kb_modifier",
content = { { 0, "mcm_kb_mod_none" }, { 1, "mcm_kb_mod_shift" }, { 3, "mcm_kb_mod_alt" } }
},
{
id = "desc_mcm",
type = "desc",
text = "ui_mcm_liz_outfit_animations_update_mcm",
clr = { 255, 175, 0, 0 },
precondition = { function () return not (ui_mcm and ui_mcm.key_hold) end } --warning message
},
{ id = "divider", type = "line" },
{
id = "memory",
type = "check",
val = 1,
def = true
},
{
id = "memory_size",
type = "track",
val = 2,
step = 1,
def = 3,
max = 10,
min = -1
},
{ id = "divider", type = "line" },
{
id = "allow_movement",
type = "check",
val = 1,
def = true
},
{ id = "divider", type = "line" },
{
id = "enable_outfit_equip",
type = "check",
val = 1,
def = true
},
{
id = "enable_backpack_equip",
type = "check",
val = 1,
def = true
},
{
id = "enable_patches",
type = "check",
val = 1,
def = true
},
{
id = "enable_patches_inventory",
type = "check",
val = 1,
def = true
},
}
}
return options
end
function get_config(key)
if ui_mcm and ui_mcm.key_hold then return ui_mcm.get("liz_outfit_animations/" .. key) else return defaults[key] end
end
@@ -0,0 +1,189 @@
-- local fov_manager = lam_fov_manager
local mcm_allow_movement = outfit_animations_mcm.get_config("allow_movement")
local mcm_enable_animation = outfit_animations_mcm.get_config("enable_patches")
local mcm_enable_animation_inventory = outfit_animations_mcm.get_config("enable_patches_inventory")
----------------------------------------
--#region monkey patches
----------------------------------------
--disable animation
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
--call animation when perform actions on patches
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
if mcm_enable_animation then play_animation_apply_patch(comm) end
else
if mcm_enable_animation_inventory then play_animation_apply_patch_inventory(comm) end
end
elseif (state == nil) then
if is_equipped_outfit then
if mcm_enable_animation then play_animation_remove_patch(comm) end
else
if mcm_enable_animation_inventory then play_animation_remove_patch_inventory(comm) end
end
end
end
originalMPA(obj)
end
--#endregion
----------------------------------------
----------------------------------------
--#region callbacks
----------------------------------------
function on_game_start()
RegisterScriptCallback("on_option_change", on_option_change)
end
function on_option_change()
mcm_allow_movement = outfit_animations_mcm.get_config("allow_movement")
mcm_enable_animation = outfit_animations_mcm.get_config("enable_patches")
mcm_enable_animation_inventory = outfit_animations_mcm.get_config("enable_patches_inventory")
end
--#endregion
----------------------------------------
----------------------------------------
--#region public functions (sorta api i guess)
----------------------------------------
function play_animation_apply_patch(faction)
local section_name = get_animation_section_name("outfit_animation_patch_apply", faction)
play_animation(section_name)
end
function play_animation_remove_patch(faction)
local section_name = get_animation_section_name("outfit_animation_patch_remove", faction)
play_animation(section_name)
end
function play_animation_apply_patch_inventory(faction)
local section_name = get_animation_section_name("outfit_animation_patch_apply_inventory", faction)
play_animation(section_name)
end
function play_animation_remove_patch_inventory(faction)
local section_name = get_animation_section_name("outfit_animation_patch_remove_inventory", faction)
play_animation(section_name)
end
--#endregion
----------------------------------------
----------------------------------------
--#region main
------------------------------------------------------------------------------
-- local anm_info = nil --it's here cuz of stalke engine magic that I don't know
-- local cur_slot
-- local det_active
function play_animation(section_name)
local action = {
sec = section_name,
params = {
can_walk = mcm_allow_movement,
hud_fov = 0.6
}
}
lam.try_play_action(action)
-- lam.add_action_to_queue(action)
end
-- function play_animation_old(section_name)
-- --prepare
-- Invoke("play_patch_animation_prepare_te", 0.01, function()
-- hide_hud_inventory()
-- cur_slot = db.actor:active_slot()
-- det_active = db.actor:active_detector() or nil
-- if det_active then det_active:switch_state(2) end
-- db.actor:activate_slot(0)
-- if headgear_animations then headgear_animations.enable_animations = false end
-- end)
-- wait_for_free_hands(function()
-- --play
-- fov_manager.restore_fov()
-- if mcm_allow_movement then game.only_allow_movekeys(true) else level.disable_input() end
-- -- anm_info = select_animation(faction, is_apply_patch, is_equipped)
-- local delay = 0.25
-- local length = 0
-- local anm = "anm_use"
-- local cam = ini_sys:r_string_ex(section_name, "cam")
-- local snd = ini_sys:r_string_ex(section_name, "snd")
-- length = length + game.get_motion_length(section_name, anm, 1) / 1000
-- Invoke("play_patch_animation_te", delay, function()
-- xr_effects.play_snd(db.actor, nil, { [1] = snd })
-- level.add_cam_effector(cam, 1300, false, "")
-- game.play_hud_motion(2, section_name, anm, false, 1)
-- end)
-- --restore
-- Invoke("play_patch_animation_restore_te", delay + length + 0.25, function()
-- if mcm_allow_movement then game.only_allow_movekeys(false) else level.enable_input() end
-- if headgear_animations then headgear_animations.enable_animations = true end
-- db.actor:activate_slot(cur_slot or 0)
-- if det_active then det_active:switch_state(1) end
-- end)
-- end)
-- end
function get_animation_section_name(section_name, faction)
return section_name .. "_" .. faction .. "_hud"
end
-- function wait_for_free_hands(action_to_perform)
-- local force_timer = 0
-- CreateTimeEvent("outfit_animations_patch", "wait_for_free_hands_te0", 0.1, function()
-- if (db.actor:active_slot() == 0 and not db.actor:active_detector() and not enhanced_animations.used_item) or (force_timer > 5) then
-- Invoke("wait_for_free_hands_te1", 0, action_to_perform) --i don understan y this works (ノへ ̄、)
-- return true
-- end
-- force_timer = force_timer + (device().time_delta / 1000)
-- return false
-- end)
-- end
-- function Invoke(name, time, action)
-- CreateTimeEvent("outfit_animations_patch", name, time, function()
-- action()
-- return true
-- end)
-- end
--#endregion
----------------------------------------