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,58 @@
--[[
cigarettes smoke effect script
Author: Feel_Fried
--]]
local smoke = false
local ltx = ini_file("items\\items\\anims_cigga_smoke.ltx")
local function create_smoke()
if not smoke then
smoke = particles_object("damage_fx\\mod_cig_smoke")
local dir2 = device().cam_dir
smoke:set_direction(dir2)
smoke:play_at_pos(db.actor:bone_position("jaw_1"))
end
return true
end
local function move_smoke()
if smoke then
local dir2 = device().cam_dir
local pos = device().cam_pos
pos.y = pos.y - 0.35 + 0.3*dir2.y
pos.x = pos.x + 0.3*dir2.x
pos.z = pos.z + 0.3*dir2.z
smoke:set_direction(dir2)
smoke:move_to(pos, dir2)
return false
else
return true
end
end
local function destroy_smoke()
if smoke then
smoke:stop()
smoke = nil
end
return true
end
function ciga_start(used_item)
CreateTimeEvent("ea_cig_light","ea_cig_light",6,ea_light.light_on,1,0.9,0.2,1,0.1,0.15,0.25,0.2)
CreateTimeEvent("ea_cig_light2","ea_cig_light2",6.5,ea_light.light_on,0.8,0.5,0,3,0.5,1.3,0.7,0.1)
local t = {}
if not ltx:section_exist(used_item) then return end
local lines = ltx:line_count(used_item)
if lines % 2 ~= 0 then return end
local variable, value, result, i = "", "", "", ""
for current_line = 0, lines - 1 do
i = current_line+1
result, variable, value = ltx:r_line(used_item, current_line, "", "")
t[i] = value
if i % 2 == 0 then
CreateTimeEvent("ea_s_c".. i, "ea_s_c" .. i, t[current_line], create_smoke)
CreateTimeEvent("ea_s_m".. i, "ea_s_m".. i, t[current_line] + 0.050, move_smoke)
CreateTimeEvent("ea_s_d".. i, "ea_s_d".. i, t[i], destroy_smoke)
end
end
end
@@ -0,0 +1,31 @@
local intercepts = {}
function EA_RegisterScriptCallback(name,func_or_userdata)
if (func_or_userdata == nil) then
callstack()
end
if not intercepts[name] then
intercepts[name] = {}
end
if (intercepts[name]) then
intercepts[name][func_or_userdata] = true
end
end
function EA_UnregisterScriptCallback(name,func_or_userdata)
if (intercepts[name]) then
intercepts[name][func_or_userdata] = nil
end
end
function EA_SendScriptCallback(name,...)
if (intercepts[name]) then
for func_or_userdata,v in pairs(intercepts[name]) do
if (type(func_or_userdata) == "function") then
func_or_userdata(...)
elseif (func_or_userdata[name]) then
func_or_userdata[name](func_or_userdata,...)
end
end
end
end
@@ -0,0 +1,48 @@
class "EA_window" (CUIScriptWnd)
local gt = game.translate_string
ea_error_text = gt("st_EA_game_ver_error_1").." "..GAME_VERSION.." "..gt("st_EA_game_ver_error_2")
ea_button_ok_text = gt("st_EA_game_ver_error_button_ok")
ea_button_cancel_text = gt("st_EA_game_ver_error_button_cancel")
function EA_window:__init() super()
self:InitControls()
self:InitCallBacks()
end
function EA_window:__finalize()
end
function EA_window:InitControls()
self:SetWndPos (vector2():set(342,199))
self:SetWndSize (vector2():set(339,369))
local xml = CScriptXmlInit()
xml:ParseFile("EA_window.xml")
self.Static1 = xml:InitStatic("Static1", self)
self.Static1:TextControl():SetText(ea_error_text)
self.btn_enter = xml:Init3tButton("btn_enter", self)
self:Register(self.btn_enter, "btn_enter")
self.btn_cancel = xml:Init3tButton("btn_cancel", self)
self:Register(self.btn_cancel, "btn_cancel")
self.btn_enter:TextControl():SetText(ea_button_ok_text)
self.btn_cancel:TextControl():SetText(ea_button_cancel_text)
end
function EA_window:InitCallBacks()
-- new game
self:AddCallback("btn_enter", ui_events.BUTTON_CLICKED, self.OnButton_OK_clicked, self)
self:AddCallback("btn_cancel", ui_events.BUTTON_CLICKED, self.OnButton_CANCEL_clicked, self)
end
function EA_window:OnButton_CANCEL_clicked()
ea_callbacks.EA_SendScriptCallback("ea_error_ONcancel")
self:HideDialog()
end
function EA_window:OnButton_OK_clicked()
ea_callbacks.EA_SendScriptCallback("ea_error_ONOk")
self:HideDialog()
end
@@ -0,0 +1,71 @@
--[[ for light test
function on_game_start()
RegisterScriptCallback("on_key_press",on_key_press)
end
local keybind = 47
function on_key_press(key)
if (key == keybind) then
hit_key()
end
end
function hit_key()
CreateTimeEvent("ea_cig_light","ea_cig_light",0,ea_light.light_on,1,0.9,0.2,1,0.1,0.15,0.25,0.2)
CreateTimeEvent("ea_cig_light2","ea_cig_light2",0.5,ea_light.light_on,0.8,0.5,0,3,0.5,1.3,0.7,0.1)
end
--]]
local light,light_flag,light_bright,light_range = nil
function light_on(r,g,b,range,bright,time,y_pos,dirmult)
--printf("light call "..r.." "..g.." "..b.." "..range.." "..bright.." "..time.." ")
light = script_light() -- Create a light source
light.type = 1 -- 1 = Point ; 2 = Spot
light.range = range --1
light_bright = bright --0.1
light_range = range --1
light.lanim = "koster_01_electra"
light.lanim_brightness = 0.025
light.hud_mode = false
light.shadow = true -- Turn on/off
light.volumetric = false
light.enabled = true
-- Pos/Rot
light.color = fcolor():set(r,g,b,bright)
--light.color = fcolor():set(1,0.9,0.2,0.05)
local dir = device().cam_dir
local pos = device().cam_pos
pos = pos:add(dir:mul(dirmult)) --0.2
pos.y = pos.y - y_pos--0.2
light:set_position(pos)
light:set_direction(dir)
light:update()
CreateTimeEvent("ea_s_l1", "ea_s_l1", time, light_off)
CreateTimeEvent("ea_s_l_2move", "ea_l_2move", 0, light_move,r,g,b,y_pos,dirmult)
light_flag = true
return true
end
function light_move(r,g,b,y_pos,dirmult)
light_bright = light_bright - 0.02
light_range = light_range - 0.06
light.range = light_range
light.color = fcolor():set(r,g,b,light_bright)
local dir = device().cam_dir
local pos = device().cam_pos
pos = pos:add(dir:mul(dirmult))
pos.y = pos.y - y_pos
light:set_position(pos)
light:set_direction(dir)
light:update()
if light_flag then
return false
else
return true
end
end
function light_off()
light.enabled = false
light:update()
light_flag = false
return true
end
@@ -0,0 +1,24 @@
function on_game_start()
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
end
function actor_on_first_update()
local ini_eff_sounds = ini_file("items\\items\\ea_snd_prefetch.ltx")
local lines = ini_eff_sounds:line_count("ea_sounds_list")
local result, variable, value, current_line = nil
for current_line = 0, lines - 1 do
result, variable, value = ini_eff_sounds:r_line("ea_sounds_list", current_line, "", "")
printf(value.."soud prefetched")
level.prefetch_sound(value)
end
local ini_eff_anims = ini_file("items\\items\\ea_anm_prefetch.ltx")
local lines = ini_eff_anims:line_count("ea_anims_list")
for current_line = 0, lines - 1 do
result, variable, value = ini_eff_anims:r_line("ea_anims_list", current_line, "", "")
game.play_hud_motion(2, value, "anm_ea_show", false, 1)
printf(value.." anim cached")
game.stop_hud_motion()
end
result, variable, value, ini_eff_anims, lines, current_line, ini_eff_sounds = nil
end
@@ -0,0 +1,381 @@
--[[
--------------------PLEASE DO NOT DELETE THIS SECTION---------------------------
================================================================================
Script(enhanced_animations) original:
\\Author : thales100
================================================================================
Animations authors: LilGABE,denis2000,ValeroK,STRIFER,Feel_Fried
================================================================================
Script(enhanced_animations) reworked:
Adaptation and crooked rework for Anomaly =): Feel_Fried
Engine functions consultants: Amomawy devs - Lucy, tdef, Tronex
Monkey patches and mask effect switcher implementation: RavenAscendant
Main shitcode critic: Igigog
================================================================================
Addon main page:
https://www.moddb.com/mods/stalker-anomaly/addons/food-drug-and-drinks-animations-reuploaded
================================================================================
All your base are belong to us! (⌐■_■)
]]--
local ini_eff = {}
enable_animations = true
mutant_loot_mod = true
local ea_debug = false
ini_eff = ini_file("items\\items\\animations_settings.ltx")
local anim_exist_tm,wpn,item_usage_snd,monster_usage_snd,item,anim_use_time,obj_m,used_monster = nil
active_slot,used_item,ea_flag,fake_monster,det_active,anim_section = nil
function on_game_start()
RegisterScriptCallback("on_game_load",on_game_load)
RegisterScriptCallback("on_option_change", loadsettings)
RegisterScriptCallback("on_key_press", check_for_game_ver)
if not ui_mcm then
RegisterScriptCallback("on_key_release", on_key_release)
end
end
function on_game_load()
activate()
end
--< Addon control
function on_key_release(key)
local bind = dik_to_bind(key)
if (bind == key_bindings.kCAM_ZOOM_OUT) then
enable_animations = not enable_animations
end
end
function loadsettings()
if ui_mcm then -- here we test to make sure ui_mcm exists before trying to call it's get function.
enable_animations = ui_mcm.get("EA_settings/enable_animations")
mutant_loot_mod = ui_mcm.get("EA_settings/mutant_loot")
ea_debug = ui_mcm.get("EA_settings/ea_debug")
if enable_animations == false then
mutant_loot_mod = false
ui_mcm.set("EA_settings/mutant_loot", false)
end
else
mutant_loot_mod = ini_eff:r_bool_ex("anim_settings", "mutant_loot_mod")
enable_animations = ui_options.get("video/player/animations")
end
end
function activate()
ini_eff = ini_file("items\\items\\animations_settings.ltx")
RegisterScriptCallback("monster_on_actor_use_callback",monster_on_actor_use)
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
end
-- Addon control >--
--< Animations engine
function anim_prepare()
game.only_allow_movekeys(true)
hide_det()
active_slot = db.actor:active_slot()
anim_exist_tm = nil
db.actor:restore_weapon()
db.actor:activate_slot(0)
RegisterScriptCallback("actor_on_update", actor_on_update)
end
function use_item(obj)
item = obj:section()
obj_m = obj
used_item = item
hide_hud_inventory()
anim_section = ini_eff:r_string_ex(item, "anm")
mask_hud_switcher()
anim_prepare()
end
function monster_on_actor_use(obj)
if (not mutant_loot_mod) or (not enable_animations) then
used_monster = nil
anim_exist_tm = nil
return
end
wpn = db.actor:active_item()
if wpn then
wpn = wpn:clsid() == clsid.wpn_knife_s and wpn:section() or "wpn_knife5"
wpn = string.gsub(wpn,"-","_")
end
item_knife.degradate()
used_monster = obj
level.disable_input()
anim_prepare()
recalc_actor_campos()
end
function start_anim(anim_section_hud)
UnregisterScriptCallback("actor_on_update", actor_on_update)
fov_anim_manager.change_fov(0.45)
local speed = ini_eff:r_float_ex(used_item or "nothing", "speed",1)
if ea_debug then printf("speed is = "..speed) end
game.play_hud_motion(2, anim_section_hud, "anm_ea_show", false, speed)
local hud_anm = used_item and ini_eff:r_string_ex(used_item, "hud_anm")
if hud_anm then
game.play_hud_anm(hud_anm, 0, 1, 1, false)
end
hud_anm = nil
end
function anim_manager_item(anim_section_hud)
item_usage_snd = sound_object(ini_eff:r_string_ex(used_item, "snd"))
item_usage_snd:play(db.actor, 0, sound_object.s2d)
level.add_cam_effector(ini_eff:r_string_ex(used_item, "cam"), 8555, false, "")
tmr = ini_eff:r_float_ex(used_item, "tm")
anim_exist_tm = tmr*0.001
anim_use_time = anim_exist_tm*0.367
CreateTimeEvent("ea_object_eater", "eat_my_obj", anim_use_time, eat_my_obj)
CreateTimeEvent("ea_slot_returner", "call_my_slot_back", (anim_exist_tm + 0.1), call_my_slot_back)
if ciga_effects then
if ini_eff:line_exist(used_item, "smoke") then ciga_effects.ciga_start(used_item) end
end
alife_create_item("items_anm_dummy",db.actor)
CreateTimeEvent("ea_anim_stoper", "stop_my_item_anim", anim_exist_tm, stop_my_item_anim)
ea_callbacks.EA_SendScriptCallback("ea_on_item_use",used_item,anim_exist_tm)
end
function anim_manager_monster()
monster_usage_snd = sound_object(ini_eff:r_string_ex("item_ea_harv_wpn_knife", "anim_sound"))
monster_usage_snd:play(db.actor, 0, sound_object.s2d)
level.add_cam_effector("itemuse_anm_effects\\harvest_skin_use.anm", 8558, false, "")
level.add_cam_effector("itemuse_anm_effects\\test.anm", 8559, false, "")
tmr = ini_eff:r_float_ex("item_ea_harv_wpn_knife", "anim_length")
anim_exist_tm = tmr*0.001
CreateTimeEvent("ea_slot_returner", "call_my_slot_back", (anim_exist_tm + 0.5), call_my_slot_back)
CreateTimeEvent("ea_blood_fx", "blood_fx", (1), blood_fx)
CreateTimeEvent("ea_blood_fx2", "blood_fx2", (1.6), blood_fx)
CreateTimeEvent("ea_blood_fx3", "blood_fx3", (2.1), blood_fx)
CreateTimeEvent("ea_blood_fx4", "blood_fx4", (2.2), blood_fx)
CreateTimeEvent("ea_anim_stoper", "stop_my_monster_anim", anim_exist_tm, stop_my_monster_anim)
end
local failure_timer = 0
local fdda_error_snd = sound_object(ini_eff:r_string_ex("fdda_error_snd", "snd"))
function actor_on_update()
failure_timer = failure_timer + (device().time_delta/17)
if ea_debug then printf("update = "..failure_timer) end
if (db.actor:active_slot() ~= 0 or db.actor:active_detector()) and (failure_timer < 100) then
return
elseif ea_debug and (failure_timer >= 100) then
fdda_error_snd:play(db.actor, 0, sound_object.s2d)
printf("hide weapons for anim failed")
printf(used_item or (used_monster and used_monster:section()) or "anim find ERROR")
printf(anim_section or "NO ANIM SECTION FOUND")
level.enable_input()
game.only_allow_movekeys(false)
actor_menu.set_msg(1, "PLEASE EXIT THE GAME AND SEND LOG FILE TO FEEL_FRIED",5)
end
local anim_section_hud = nil
if used_monster then
anim_section_hud = "item_ea_harv_" .. ( wpn or "wpn_knife5" ) .. "_hud"
start_anim(anim_section_hud)
anim_manager_monster()
failure_timer = 0
return
end
failure_timer = 0
anim_section_hud = anim_section .. "_hud"
anim_section = nil
start_anim(anim_section_hud)
anim_manager_item(anim_section_hud)
end
-- Animations engine >--
--< Monkey patches
--preventing default Anomaly anims
local originalPIF = actor_effects.play_item_fx
function actor_effects.play_item_fx(item)
if ini_eff:r_string_ex(item, "snd") and enable_animations or ini_eff:r_bool_ex("skip_items", item) then return end
if skip_functor(item) then return end
originalPIF(item)
end
local originalUW = actor_effects.use_weapon
function actor_effects.use_weapon(f)
if f == 1 then
CreateTimeEvent("ea_def_use", "def_use_end", 0.5, def_use_end)
end
if f == 0 then
hide_hud_inventory()
game.only_allow_movekeys(true)
end
originalUW(f)
end
--delaying item use
local originalAOIBU = itms_manager.actor_on_item_before_use
function itms_manager.actor_on_item_before_use(obj,flags)
originalAOIBU(obj,flags)
local item = obj:section()
if IsMoveState("mcClimb") then
actor_menu.set_msg(1, game.translate_string("st_EA_ladder_item_not_allowed"),3)
flags.ret_value = false
return
end
if ini_eff:r_string_ex(item, "snd") and enable_animations and flags.ret_value then
use_item(obj)
flags.ret_value = false
return
end
return
end
--delaying mutant loot dialog
local originalUMLS = ui_mutant_loot.start
function ui_mutant_loot.start(obj, for_bug1, for_bug2)
if not ea_flag and enable_animations and mutant_loot_mod then return end
originalUMLS(obj, for_bug1, for_bug2)
end
-- Monkey patches >--
--< Time Events
function call_my_slot_back()
game.only_allow_movekeys(false)
if take_item_anim and fake_monster then
return true
end
db.actor:activate_slot(active_slot or 0)
if det_active then det_active:switch_state(1) end
return true
end
local bone_list = {
[1] = "bip01_spine1",
[2] = "bip01_spine2",
[3] = "bip01_spine",
[4] = "bip01_pelvis",
[5] = "bip01_head",
}
function blood_fx()
if not used_monster or used_monster:id() == 65535 then return true end
local fx_pos = used_monster:bone_position(bone_list[math.random(1,5)])
fx_pos.y = fx_pos.y + 0.1
local blood_trace = vector():set(0,-1,0)
wallmarks_manager():place_skeleton(used_monster, "bloody_marks", fx_pos, blood_trace, 0.2,-1)
wallmarks_manager():place(blood_trace, fx_pos, 15, 0.3, "bloody_marks", used_monster,-1)
local hit_fx = particles_object("hit_fx\\hit_flesh_01")
hit_fx:play_at_pos(fx_pos)
local hit_fx2 = particles_object("hit_fx\\hit_flesh_02a")
hit_fx2:play_at_pos(fx_pos)
local hit_fx3 = particles_object("hit_fx\\hit_knife_flesh_00")
hit_fx3:play_at_pos(fx_pos)
return true
end
--eating fake item to stop default items sound and delayed item using
function eat_my_obj()
if obj_m then
db.actor:eat(obj_m)
end
db.actor:eat(db.actor:object("items_anm_dummy"))
return true
end
function stop_my_item_anim()
ea_callbacks.EA_SendScriptCallback("ea_on_item_anim_stop",used_item)
ea_restore_actor()
mask_hud_switcher()
used_item = nil
obj_m = nil
return true
end
function stop_my_monster_anim()
ea_restore_actor()
if used_monster:id() == 65535 or ( not take_item_anim ) then
used_monster = nil
return true
end
fake_monster = used_monster
used_monster = nil
ea_flag = true
ui_mutant_loot.start(fake_monster, fake_monster:id(), fake_monster:section(), fake_monster:clsid())
ea_flag = nil
if not ui_mutant_loot.GUI:Reset(fake_monster, fake_monster:id(), fake_monster:section(), fake_monster:clsid()) then
fake_monster = nil
end
return true
end
function def_use_end()
game.only_allow_movekeys(false)
return true
end
-- Time Events >--
--< Additional animations and effects
function mask_hud_switcher()
if (not ini_eff:r_bool_ex(used_item, "helm")) and ui_options.get("video/player/mask_hud") then
actor_effects.switch_helm() --raven
actor_effects.Update_Mask(db.actor)
end
end
function ea_restore_actor()
db.actor:hide_weapon()
fov_anim_manager.restore_fov()
level.enable_input()
end
--holster item in device slot
function hide_det()
det_active = db.actor:active_detector() or nil
if det_active then det_active:switch_state(2) end
end
function actor_on_first_update()
if db.actor:object("items_anm_dummy") then alife_release(db.actor:object("items_anm_dummy")) end
loadsettings()
end
--addaptive camera for mutant skinning
function recalc_actor_campos()
local pm = used_monster:bone_position('bip01_spine1')
pm.y = pm.y + 0.8
db.actor:actor_look_at_point(pm)
end
-- mutant loot options check
function skip_functor(item)
return mutant_loot_mod and ini_eff:r_bool_ex("skip_mutant", item)
end
-- Additional animations and effects >--
--Errors handler >--
local Game_ver_window = ea_error.EA_window()
function check_for_game_ver()
if GAME_VERSION ~= "1.5.2" and GAME_VERSION ~= "1.5.3" then
ea_callbacks.EA_RegisterScriptCallback("ea_error_ONcancel",ea_error_ONcancel)
ea_callbacks.EA_RegisterScriptCallback("ea_error_ONOk",ea_error_ONOk)
Game_ver_window:ShowDialog(false)
else
stop_game_ver_check()
end
end
function stop_game_ver_check()
UnregisterScriptCallback("on_key_press", check_for_game_ver)
end
function ea_error_ONcancel()
ea_callbacks.EA_UnregisterScriptCallback("ea_error_ONcancel",ea_error_ONcancel)
ea_callbacks.EA_UnregisterScriptCallback("ea_error_ONOk",ea_error_ONOk)
stop_game_ver_check()
end
function ea_error_ONOk()
ea_dummy_var = ea_dummy_var + 5
end
--Errors handler <--
@@ -0,0 +1,15 @@
function on_mcm_load()
op = { id= "EA_settings" ,sh=true ,gr={
{ id= "friendlyfire" ,type= "slide" ,link= "ui_options_slider_disguise" ,text= "FDDA" ,size= {512,50} ,spacing= 20 },
{id = "enable_animations", type = "check", val = 1, def = true},
{id = "enable_backpack_addon", type = "check", val = 1, def = true},
{id = "enable_crouch_toggle_backpack_addon", type = "check", val = 1, def = true},
{id = "mutant_loot", type = "check", val = 1, def = true},
{id = "take_item_anim", type = "check", val = 1, def = true},
{id = "ea_debug", type = "check", val = 1, def = false},
}
}
return op
end
@@ -0,0 +1,36 @@
--[[
Fov animation manager script
Author: Tronex
--]]
local fov_prev
-- axr_options.ltx will handle saving fov changes during animation, if something breaks during it, it will restore previous cached FOV
function on_game_start()
local function actor_on_first_update()
local fov_changed = axr_main.config:r_value("temp", "fov_changed", 1)
local fov_value = axr_main.config:r_value("temp", "fov_value", 2)
if fov_changed and (type(fov_value) == "number") then
exec_console_cmd("hud_fov " .. fov_value)
end
axr_main.config:w_value("temp", "fov_changed", false)
end
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
end
function change_fov(value) -- change_fov(0.45)
local fov = get_console_cmd(2, "hud_fov")
if (fov ~= value) then
exec_console_cmd("hud_fov " .. value)
fov_prev = fov
axr_main.config:w_value("temp", "fov_changed", true)
axr_main.config:w_value("temp", "fov_value", fov)
end
end
function restore_fov()
if fov_prev then
exec_console_cmd("hud_fov " .. fov_prev)
fov_prev = nil
axr_main.config:w_value("temp", "fov_changed", false)
end
end
@@ -0,0 +1,130 @@
--[[
item pickup animation script
Author: Feel_Fried
--]]
local skin_anim, harv_usage_snd,enable_take
local ltx = ini_file("items\\items\\anims_loot_list.ltx")
function on_game_start()
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
RegisterScriptCallback("on_option_change", loadsettings)
end
function actor_on_first_update()
RegisterScriptCallback("actor_on_item_take",actor_on_item_take)
RegisterScriptCallback("actor_on_item_before_pickup",actor_on_item_before_pickup)
loadsettings()
end
function loadsettings()
if ui_mcm then
enable_animations = ui_mcm.get("EA_settings/enable_animations")
enable_take = ui_mcm.get("EA_settings/take_item_anim")
else
enable_animations = ui_options.get("video/player/animations")
enable_take = true
end
enable_multipickup = ui_options.get("control/general/pickup_mode")
end
local anim_plays = nil
local anm_name = "camera_effects\\weapon\\two_handed_weapon_effect.anm"
function actor_on_item_before_pickup(item,flags)
if (not enable_take) or (not enable_animations) then return end --1 - 10 single press, 50+ - long press
flags.ret_value = false
if not anim_plays and not enhanced_animations.used_item then
game.play_hud_motion(db.actor:active_slot()==0 and 2 or 1, "item_ea_take_hud", "anm_ea_take", true, 1.4)
game.play_hud_anm(anm_name, 0, 1.4, 1, false)
CreateTimeEvent("ea_item_take","take_delay",0.65,take_delay,item)
CreateTimeEvent("ea_item_take","anim_delay",1.33,anim_delay)
anim_plays = true
end
end
function anim_delay()
anim_plays = nil
return true
end
function take_delay(obj_o)
local actor = db.actor
actor:take_item(obj_o)
if enable_multipickup then
multipickup(1.5,0.75,actor)
multipickup(1,0.5,actor)
multipickup(0.5,0.25,actor)
end
printf(obj_o:section() .. " taken with id " .. obj_o:id())
actor = nil
return true
end
function multipickup(dist,radius,actor)
local pos = device().cam_pos
local dir = device().cam_dir
pos = pos:add(dir:mul(dist))
level.iterate_nearest(pos,dist,function(obj)
if obj:cast_InventoryItem() and (pos:distance_to(obj:position()) <= radius) then
actor:take_item(obj)
printf(obj:section() .. " taken with id " .. obj:id())
end
end)
pos,dir = nil
end
function actor_on_item_take(item)
--mutant loot bag animation
if enhanced_animations.fake_monster then
fov_anim_manager.change_fov(0.45)
enhanced_animations.fake_monster = nil
level.disable_input()
local sect = item:section()
local item_sect_index = ltx:section_exist(sect) and ltx:r_string_ex(sect, "indx"):match("(.+),(.+)") or math.random(14)
local anim_section_name = "item_ea_harv_meat_"..item_sect_index.."_hud"
harv_usage_snd = sound_object("interface\\item_usage\\harvest_use_success")
harv_usage_snd:play(db.actor, 0, sound_object.s2d)
game.play_hud_motion(2, anim_section_name, "anm_ea_show", true, 0.75)
level.add_cam_effector("itemuse_anm_effects\\harvest_loot.anm", 8560, false, "")
CreateTimeEvent("restore_knife", "restor_knife", 1.8 , restore_knife)
skin_anim = true
item_sect_index ,anim_section_name ,sect = nil
end
end
--patching mutant loot dialog close call
function ui_mutant_loot.UIMutantLoot:Close()
--deleting fake mutant object to prevent bag animation if mutant was empty
CreateTimeEvent("delete_fake", "delete_fake", 0.2, take_item_anim.delete_fake)
self:SetMutantState()
self:HideDialog()
Unregister_UI("UIMutantLoot")
end
function delete_fake()
enhanced_animations.fake_monster = nil
--draw knife if mutant was empty or player just closed dialog without looting anything
if not skin_anim then
return_slots()
end
return true
end
function restore_knife()
return_slots()
skin_anim = nil
level.enable_input()
return true
end
function return_slots()
fov_anim_manager.restore_fov()
local slot = enhanced_animations.active_slot
db.actor:activate_slot(slot or 1)
local device = enhanced_animations.det_active
if device then device:switch_state(1) end
device = nil
slot = nil
end
@@ -0,0 +1,265 @@
--[[
FDDA backpack addon script
Author: Feel_Fried
Anims author: Blindside
20.08.2022
--]]
local ini_eff = {}
local fov_prev,active_slot,item_after_backpack,backpack_open_flag,crouch_value,crouching,ea_force_inventory_close
local anim_enabled = true
local ea_debug = false
local crouch_toggle = true
ini_eff = ini_file("items\\items\\ea_addon_backpack.ltx")
local skip_anims = {
["outfit"] = true,
["helm"] = true,
["disassemble_cloth_fast"] = true,
["disassemble_metal_fast"] = true,
["lead_box_dummy"] = true,
["container_tool_lead_box_dummy"] = true,
["af_aac_dummy"] = true,
["af_aam_dummy"] = true,
["af_iam_dummy"] = true,
["container_tool_af_aac_dummy"] = true,
["container_tool_af_aam_dummy"] = true,
["container_tool_af_iam_dummy"] = true,
["package_content"] = true,
}
local bool_to_int = {
[true] = 1,
[false] = 0,
}
function backpack_m_open(name)
if enhanced_animations.used_item then return end
if not db.actor or not db.actor:alive() then
return
end
if name == "inventory" then
item_use_flag = nil
backpack_open_flag = true
backpack_open()
end
end
function a_crouch()
if crouch_toggle then
level.press_action(bind_to_dik(key_bindings.kCROUCH))
level.release_action(bind_to_dik(key_bindings.kCROUCH))
end
end
function backpack_m_close(name)
if name ~="UIInventory" then return end
if ea_force_inventory_close then
if ea_debug then
printf("force found")
end
return
end
if active_slot then
item_after_backpack = true
end
if backpack_open_flag == nil then return end
db.actor:hide_weapon()
if fov_prev then
get_console():execute("g_crouch_toggle "..bool_to_int[crouch_value] or get_console_cmd(2, "g_crouch_toggle"))
exec_console_cmd("hud_fov " .. fov_prev)
fov_prev = nil
if (crouch_value and not crouching) or not crouch_value then
a_crouch()
end
end
if enhanced_animations.used_item then
backpack_open_flag = nil
return
end
if not db.actor or not db.actor:alive() then
return
end
if ea_debug then
printf("inventory close")
end
backpack_open_flag = nil
if item_use_flag then
if ea_debug then
printf("item was used before closing backpack")
end
game.stop_hud_motion()
call_my_slot_back()
item_use_flag = nil
return
end
if ea_debug then
printf("called backpack close anim")
end
backpack_close()
end
local originalPIF = actor_effects.play_item_fx
function actor_effects.play_item_fx(item)
originalPIF(item)
if skip_anims[item] and backpack_open_flag then
item_use_flag = true
if ea_debug then
printf("item_skiped")
end
end
if ea_debug then
printf(item)
end
end
local originalUIV = ui_pda_npc_tab.use_view
function ui_pda_npc_tab.use_view(obj)
if not anim_enabled then
originalUIV(obj)
return
end
local p = obj:parent()
if not (p and p:id() == AC_ID) then
return
end
active_slot = nil
item_use_flag = nil
backpack_open_flag = nil
item_after_backpack = nil
db.actor:hide_weapon()
if fov_prev then
get_console():execute("g_crouch_toggle "..bool_to_int[crouch_value] or get_console_cmd(2, "g_crouch_toggle"))
exec_console_cmd("hud_fov " .. fov_prev)
fov_prev = nil
if (crouch_value and not crouching) or not crouch_value then
a_crouch()
end
end
game.stop_hud_motion()
ea_force_inventory_close = true
originalUIV(obj)
end
function backpack_open()
if IsMoveState("mcClimb") then
actor_menu.set_msg(1, game.translate_string("st_EA_ladder_item_not_allowed"),3)
backpack_open_flag = nil
return
end
crouch_value = get_console_cmd(1, "g_crouch_toggle")
get_console():execute("g_crouch_toggle 1")
crouching = IsMoveState('mcCrouch')
if ea_debug then
printf("crouching = "..bool_to_int[crouching])
end
if (crouch_value and not crouching) or not crouch_value then
a_crouch()
end
active_slot = db.actor:active_slot()
det_active = db.actor:active_detector() or nil
level.disable_input()
backpack_faction = character_community(db.actor):sub(7)
enhanced_animations.used_item = "backpack_open" .. "_" .. backpack_faction
enhanced_animations.anim_section = ini_eff:r_string_ex(enhanced_animations.used_item, "anm")
enhanced_animations.anim_prepare()
end
function backpack_close()
enhanced_animations.used_item = "backpack_close" .. "_" .. backpack_faction
enhanced_animations.anim_section = ini_eff:r_string_ex(enhanced_animations.used_item, "anm")
enhanced_animations.anim_prepare()
end
function EA_anim_stop(used_item)
if used_item:sub(1,13) == "backpack_open" then
db.actor:restore_weapon()
fov_prev = axr_main.config:r_value("temp", "fov_value", 2)
fov_anim_manager.change_fov(0.45)
idle = "item_ea_backpack_open_" .. backpack_faction .. "_" .. "hud"
game.play_hud_motion(2, idle, "anm_ea_idle", false, 1)
level.enable_input()
ea_invent_flag = true
RemoveTimeEvent("ea_slot_returner", "call_my_slot_back")
ui_inventory.start("inventory")
game.only_allow_movekeys(false)
end
end
function ea_on_item_use(used_item,tm)
if used_item:sub(1,14) == "backpack_close" then
CreateTimeEvent("ea_b_slot_returner", "b_call_my_slot_back", (tm + 0.55), call_my_slot_back)
return
end
if item_after_backpack then
CreateTimeEvent("ea_b_slot_returner", "b_call_my_slot_back", (tm + 0.3), call_my_slot_back)
item_after_backpack = nil
end
end
function call_my_slot_back()
if det_active and db.actor:item_in_slot(9) then
db.actor:item_in_slot(9):switch_state(1)
end
det_active = nil
db.actor:activate_slot(active_slot or 0)
active_slot = nil
item_after_backpack = nil
return true
end
local originalUIinvenory_start =ui_inventory.start
function ui_inventory.start(mode, obj)
originalUIinvenory_start(mode, obj)
if mode == "inventory" and ea_invent_flag == nil and anim_enabled then
ea_force_inventory_close = true
ui_inventory.hide_hud_inventory()
return
end
if ea_invent_flag then
ea_invent_flag = nil
ea_force_inventory_close = nil
end
end
function actor_on_item_use(item)
if item:section() ~= "items_anm_dummy" then item_use_flag = true end
end
function activate()
RegisterScriptCallback("ActorMenu_on_before_init_mode",backpack_m_open)
RegisterScriptCallback("GUI_on_hide",backpack_m_close)
RegisterScriptCallback("actor_on_item_use",actor_on_item_use)
ea_callbacks.EA_RegisterScriptCallback("ea_on_item_anim_stop",EA_anim_stop)
ea_callbacks.EA_RegisterScriptCallback("ea_on_item_use",ea_on_item_use)
end
function deactivate()
UnregisterScriptCallback("ActorMenu_on_before_init_mode",backpack_m_open)
UnregisterScriptCallback("GUI_on_hide",backpack_m_close)
UnregisterScriptCallback("actor_on_item_use",actor_on_item_use)
ea_callbacks.EA_UnregisterScriptCallback("ea_on_item_anim_stop",EA_anim_stop)
ea_callbacks.EA_UnregisterScriptCallback("ea_on_item_use",ea_on_item_use)
end
function on_game_start()
RegisterScriptCallback("on_option_change", loadsettings)
loadsettings()
end
function loadsettings()
if ui_mcm then
anim_enabled = ui_mcm.get("EA_settings/enable_backpack_addon")
crouch_toggle = ui_mcm.get("EA_settings/enable_crouch_toggle_backpack_addon")
ea_debug = ui_mcm.get("EA_settings/ea_debug")
end
if anim_enabled then
activate()
else
deactivate()
end
end