Removed EGUI in favor of UI Rework by Sota Added in GTR Optimized for higher res textures, over Zone Reality Remade and removed all files that conflicted from ZRR to save storage space.
380 lines
12 KiB
Plaintext
380 lines
12 KiB
Plaintext
--[[
|
|
--------------------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 active_slot,anim_exist_tm,wpn,item_usage_snd,monster_usage_snd,item,anim_use_time,obj_m,used_monster = nil
|
|
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)
|
|
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()
|
|
local outfit = db.actor:item_in_slot(7)
|
|
outfit = outfit and outfit:section() or item
|
|
local hud = SYS_GetParam(0, outfit, "player_hud_section", "")
|
|
if hud:find("exo$") then
|
|
item = item .. "_exo"
|
|
if not ini_eff:r_string_ex(item, "snd") then
|
|
-- Revert back
|
|
item = obj:section()
|
|
end
|
|
end
|
|
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_knife3"
|
|
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") or 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_knife3" ) .. "_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()
|
|
local outfit = db.actor:item_in_slot(7)
|
|
outfit = outfit and outfit:section() or item
|
|
local hud = SYS_GetParam(0, outfit, "player_hud_section", "")
|
|
printf("hud section is %s", hud)
|
|
if hud:find("exo$") then
|
|
item = item .. "_exo"
|
|
if not ini_eff:r_string_ex(item, "snd") then
|
|
-- Revert back
|
|
printf("hud section %s is exo but no animation %s, revert back", hud, item)
|
|
item = obj:section()
|
|
else
|
|
printf("hud section %s is exo and found animation %s", hud, item)
|
|
end
|
|
else
|
|
printf("hud section %s is not exo", hud)
|
|
end
|
|
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 >--
|