Various Changes; Updated and Added Mods
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
local fov_manager = outfit_animations_fov_manager
|
||||
local mcm_allow_movement = outfit_animations_mcm.get_config("allow_movement")
|
||||
|
||||
local
|
||||
|
||||
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")
|
||||
end
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- 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)
|
||||
--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
|
||||
|
||||
Reference in New Issue
Block a user