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,79 @@
local speeds = {}
local sprint_modifiers = {}
local run_modifiers = {}
local not_first_update = true
local function actor_on_first_update()
speeds[0] = db.actor:get_actor_run_coef()
speeds[1] = db.actor:get_actor_runback_coef()
speeds[2] = db.actor:get_actor_sprint_koef()
not_first_update = false
end
function on_game_start()
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
end
local function update_speeds()
if not_first_update then
actor_on_first_update()
end
local run_coef = 1
for k,v in pairs(run_modifiers) do
--printf("run " .. k .. " " .. v)
run_coef = run_coef * v
end
local sprint_coef = 1
for k,v in pairs(sprint_modifiers) do
--printf("sprint " .. k .. " " .. v)
sprint_coef = sprint_coef * v
end
-- printf("base speed: "..speeds[0])
db.actor:set_actor_run_coef(clamp(speeds[0] * run_coef, 1, 10))
db.actor:set_actor_runback_coef(clamp(speeds[1] * run_coef, 1, 10))
db.actor:set_actor_sprint_koef(clamp(speeds[2] * sprint_coef, 1, 10))
end
-- Usage: Add a speed modifier.
-- Once a speed modifier is added, speed will be recalculated and set.
-- run_modifiers affects run and runback, sprint_modifiers affects sprint
-- Params:
-- speed_key - Name of speed multiplier you want to add
-- speed_mult - Speed multiplier as a number (e.g. 0.5 will halve speed)
-- is_sprint - Boolean, if true adds to sprint modifier and updates accordingly, false adds to run modifier
-- force - Boolean, will overwrite existing speed.
-- Returns true if speed added successfully, false if key already exists (and nothing happens as result)
function add_speed(speed_key, speed_mult, is_sprint, force)
if (is_sprint) then
if force or not sprint_modifiers[speed_key] then
--printf("sprint: " .. speed_key .. " " .. speed_mult)
sprint_modifiers[speed_key] = speed_mult
update_speeds()
return true
else
return false
end
else
if force or not run_modifiers[speed_key] then
--printf("run: " .. speed_key .. " " .. speed_mult)
run_modifiers[speed_key] = speed_mult
update_speeds()
return true
else
return false
end
end
end
-- Usage: Drop a speed modifier. Once a speed modifier is dropped, speed will be recalculated and set.
-- Params
-- speed_key - Name of speed multiplier to drop. Will drop from both tables.
function remove_speed(speed_key)
if sprint_modifiers[speed_key] then
sprint_modifiers[speed_key] = nil
end
if run_modifiers[speed_key] then
run_modifiers[speed_key] = nil
end
update_speeds()
end
@@ -0,0 +1,851 @@
local damagescale = zzz_player_injuries_mcm.get_config("damage_scale")
local regen = zzz_player_injuries_mcm.get_config("regen") -- Automatic blue health regeneration (in game minutes, each tick will heal 1 random limb for 1 hp)
local enable_display = zzz_player_injuries_mcm.get_config("enable_display")
local display_numeric_at = zzz_player_injuries_mcm.get_config("numeric_at") -- if medicine heal for this value or more then show it as number
local show_numeric_always = zzz_player_injuries_mcm.get_config("numeric_always") -- always show medicine values as numbers
local hud_type = zzz_player_injuries_mcm.get_config("hud_type")
local alt_mode_health = zzz_player_injuries_mcm.get_config("alt_mode_health")
local mcm_pos_x = zzz_player_injuries_mcm.get_config("position_x")
local mcm_pos_y = zzz_player_injuries_mcm.get_config("position_y")
local vanilla_bars = zzz_player_injuries_mcm.get_config("vanilla_bars")
local custom_colors = zzz_player_injuries_mcm.get_config("custom_colors")
local clr_main_r = zzz_player_injuries_mcm.get_config("clr_main_r")
local clr_main_g = zzz_player_injuries_mcm.get_config("clr_main_g")
local clr_main_b = zzz_player_injuries_mcm.get_config("clr_main_b")
local clr_timed_r = zzz_player_injuries_mcm.get_config("clr_timed_r")
local clr_timed_g = zzz_player_injuries_mcm.get_config("clr_timed_g")
local clr_timed_b = zzz_player_injuries_mcm.get_config("clr_timed_b")
local def_clr_t = {
["default"] = { main = { 90, 140, 215 }, timed = { 230, 200, 15 } },
["eft"] = { main = { 255, 255, 255 }, timed = { 50, 255, 50 } },
}
local ctime_to_t = utils_data.CTime_to_table
local t_to_ctime = utils_data.CTime_from_table
local prev_health
local damaged_limb
local preview_sec
local timedhp_timer
local heal_timer
maxhp = {
head = 11,
torso = 11,
leftarm = 5,
rightarm = 5,
leftleg = 5,
rightleg = 5
}
health = {
head = maxhp.head,
torso = maxhp.torso,
leftarm = maxhp.leftarm,
rightarm = maxhp.rightarm,
leftleg = maxhp.leftleg,
rightleg = maxhp.rightleg
}
timedhp = {
head = 0,
torso = 0,
leftarm = 0,
rightarm = 0,
leftleg = 0,
rightleg = 0,
}
medkits = {
morphine = {head = 8, torso = 5, rightleg = 4, leftleg = 4, rightarm = 4, leftarm = 4},
rebirth = {head = 11, torso = 11, rightleg = 5, leftleg = 5, rightarm = 5, leftarm = 5},
adrenalin = {head = 10, torso = 10, rightleg = 5, leftleg = 5, rightarm = 5, leftarm = 5},
cocaine = {head = 8, torso = 4, rightleg = 3, leftleg = 3, rightarm = 3, leftarm = 3},
analgetic = {head = 3, torso = 3, rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
salicidic_acid = {head = 5, torso = 5, rightleg = 3, leftleg = 3, rightarm = 3, leftarm = 3},
stimpack = {head = 5, torso = 5, rightleg = 3, leftleg = 3, rightarm = 3, leftarm = 3},
stimpack_army = {head = 5, torso = 7, rightleg = 3, leftleg = 3, rightarm = 3, leftarm = 3},
stimpack_scientic = {head = 6, torso = 9, rightleg = 4, leftleg = 4, rightarm = 4, leftarm = 4},
medkit = {head = 5, torso = 5, rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
medkit_army = {head = 7, torso = 8, rightleg = 3, leftleg = 3, rightarm = 3, leftarm = 3},
medkit_scientic = {head = 10, torso = 8, rightleg = 4, leftleg = 4, rightarm = 4, leftarm = 4},
jgut = {rightleg = 5, leftleg = 5, rightarm = 5, leftarm = 5},
survival_kit = {torso = 11, rightleg = 3, leftleg = 3, rightarm = 3, leftarm = 3},
bandage = {torso = 2, torso = 2, rightleg = 3, leftleg = 3, rightarm = 3, leftarm = 3},
}
healhelp = {
--bandage = {rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
caffeine = {head = 3},
drug_psy_blockade = {head = 5, rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
drug_sleepingpills = {head = 8},
drug_booster = {torso = 6},
drug_anabiotic = {head = 11, torso = 11, rightleg = 11, leftleg = 11, rightarm = 11, leftarm = 11},
rebirth = {head = 8, torso = 8, rightleg = 4, leftleg = 4, rightarm = 4, leftarm = 4},
glucose_s = {head = 2, torso = 2, rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
glucose = {head = 4, torso = 4, rightleg = 3, leftleg = 3, rightarm = 3, leftarm = 3},
medkit_army = {rightleg = 1, leftleg = 1, rightarm = 1, leftarm = 1},
medkit_scientic = {rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
salicidic_acid = {rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
analgetic = {torso = 2, rightleg = 1, leftleg = 1, rightarm = 1, leftarm = 1},
stimpack_army = {head = 2, torso = 2, rightleg = 1, leftleg = 1, rightarm = 1, leftarm = 1},
stimpack_scientic = {head = 3, torso = 6, rightleg = 1, leftleg = 1, rightarm = 1, leftarm = 1},
tetanus = {head = 3, rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
drug_coagulant = {torso = 3},
yadylin = {head = 4, torso = 4, rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
survival_kit = {torso = 11, rightleg = 3, leftleg = 3, rightarm = 3, leftarm = 3},
akvatab = {rightleg = 4, leftleg = 4, rightarm = 4, leftarm = 4},
vinca = {torso = 3},
antibio_chlor = {head = 1, torso = 2},
antibio_sulfad = {torso = 2, rightarm = 1, leftarm = 1},
antiemetic = {head = 2, rightleg = 1, leftleg = 1},
antirad = {head = 1, torso = 2, rightleg = 2, leftleg = 2, rightarm = 2, leftarm = 2},
antirad_cystamine = {head = 3, torso = 3},
antirad_kalium = {head = 1, torso = 1, rightleg = 1, leftleg = 1, rightarm = 1, leftarm = 1},
drug_antidot = {head = 4, torso = 2},
drug_radioprotector = {head = 1, rightleg = 1, leftleg = 1, rightarm = 1, leftarm = 1},
}
HUD = nil
function activate_hud()
if HUD == nil then
HUD = BHS()
get_hud():AddDialogToRender(HUD)
end
end
function deactivate_hud()
if HUD ~= nil then
get_hud():RemoveDialogToRender(HUD)
HUD = nil
end
end
function actor_on_first_update()
-- disable vanilla health / stamina / psi bars
if not vanilla_bars then
ActorMenu.get_maingame().m_ui_hud_states.m_ui_health_bar:SetWndPos(vector2():set(9999, 9999))
ActorMenu.get_maingame().m_ui_hud_states.m_ui_stamina_bar:SetWndPos(vector2():set(9999, 9999))
ActorMenu.get_maingame().m_ui_hud_states.m_ui_psy_bar:SetWndPos(vector2():set(9999, 9999))
ActorMenu.get_maingame().m_ui_hud_states.m_back:SetWndPos(vector2():set(9999, 9999))
end
activate_hud()
end
------------------------------------------------------------------------------
---------------------------------- HUD -------------------------------------
------------------------------------------------------------------------------
class "BHS" (CUIScriptWnd)
function BHS:__init() super()
self:InitControls()
end
function BHS:InitControls()
self:SetWndRect(Frect():set(0, 0, 1024, 768))
self:SetAutoDelete(true)
if hud_type == "text" then
self:BuildAltHUD()
else
self:BuildGraphicalHUD()
end
self:UpdatePos()
self:UpdateBars()
end
function BHS:BuildGraphicalHUD()
self.xml = CScriptXmlInit()
local xml = self.xml
local xml_name = (hud_type == "eft" and "ui_bhs_eft\\ui_bhs_eft.xml") or "ui_bhs\\ui_bhs.xml"
xml:ParseFile(xml_name)
-- backgrounds
self.bg = xml:InitStatic("body_health_system", self)
self.hud_bg = xml:InitStatic("body_health_system_hud", self.bg)
-- bars
self.health_bar_bg = xml:InitStatic("bhs_health_bar_bg", self.hud_bg)
self.health_bar = xml:InitProgressBar("bhs_health", self.health_bar_bg)
self.health_bar:SetProgressPos(0.0)
self.stamina_bar_bg = xml:InitStatic("bhs_stamina_bar_bg", self.hud_bg)
self.stamina_bar = xml:InitProgressBar("bhs_stamina", self.stamina_bar_bg)
self.stamina_bar:SetProgressPos(0.0)
self.psi_bar = xml:InitProgressBar("bhs_psi", self.hud_bg)
self.psi_bar:SetProgressPos(0.0)
for limb, _ in pairs(maxhp) do
self[limb .. "_bg"] = xml:InitStatic("bhs_health_" .. limb .. "_bar_bg", self.hud_bg)
self[limb .. "_green"] = xml:InitProgressBar("bhs_health_bodypart_green", self[limb .. "_bg"])
self[limb .. "_green"]:SetProgressPos(0.0)
self[limb] = xml:InitProgressBar("bhs_health_bodypart", self[limb .. "_bg"])
self[limb]:SetProgressPos(0.0)
end
-- colors
local main_r, main_g, main_b, timed_r, timed_g, timed_b = 255, 255, 255, 255, 255, 255
if def_clr_t[hud_type] then
local t = def_clr_t[hud_type]
main_r, main_g, main_b = t.main[1], t.main[2], t.main[3]
timed_r, timed_g, timed_b = t.timed[1], t.timed[2], t.timed[3]
end
if custom_colors then
main_r, main_g, main_b = clr_main_r, clr_main_g, clr_main_b
timed_r, timed_g, timed_b = clr_timed_r, clr_timed_g, clr_timed_b
end
self.health_bar:SetColor(GetARGB(255, main_r, main_g, main_b))
self.stamina_bar:SetColor(GetARGB(255, main_r, main_g, main_b))
self.psi_bar:SetColor(GetARGB(255, main_r, main_g, main_b))
for limb, _ in pairs(maxhp) do
self[limb .. "_green"]:SetColor(GetARGB(255, timed_r, timed_g, timed_b))
self[limb]:SetColor(GetARGB(255, main_r, main_g, main_b))
end
end
function BHS:BuildAltHUD()
self.xml = CScriptXmlInit()
local xml = self.xml
xml:ParseFile("ui_bhs_alt\\ui_bhs_alt.xml")
-- background
self.bg = xml:InitStatic("bhs_alt", self)
for limb, _ in pairs(maxhp) do
self[limb .. "_cont"] = xml:InitStatic("bhs_alt:" .. limb .. "_cont", self.bg)
self[limb .. "_bg"] = xml:InitStatic("bhs_alt:" .. limb .. "_cont:bar_bg", self[limb .."_cont"])
self[limb .. "_green"] = xml:InitProgressBar("bhs_alt:" .. limb .. "_cont:bar_green", self[limb .. "_bg"])
self[limb .. "_green"]:SetProgressPos(0.0)
self[limb] = xml:InitProgressBar("bhs_alt:" .. limb .. "_cont:bar", self[limb .. "_bg"])
self[limb]:SetProgressPos(0.0)
end
-- text
self.head_text = xml:InitTextWnd("bhs_alt:head_cont:head_text", self.head_cont)
self.torso_text = xml:InitTextWnd("bhs_alt:torso_cont:torso_text", self.torso_cont)
self.arms_text = xml:InitTextWnd("bhs_alt:text_arms", self.bg)
self.legs_text = xml:InitTextWnd("bhs_alt:text_legs", self.bg)
-- psi/hp/stamina
if alt_mode_health then
self.main_cont = xml:InitStatic("bhs_alt:main_cont", self.bg)
self.psi_bar = xml:InitProgressBar("bhs_alt:main_cont:psi_bar", self.main_cont)
self.psi_bar:SetProgressPos(0.0)
self.health_bar_bg = xml:InitStatic("bhs_alt:main_cont:health_bar_bg", self.main_cont)
self.health_bar = xml:InitProgressBar("bhs_alt:main_cont:health_bar", self.health_bar_bg)
self.health_bar:SetProgressPos(0.0)
self.stamina_bar_bg = xml:InitStatic("bhs_alt:main_cont:stamina_bar_bg", self.main_cont)
self.stamina_bar = xml:InitProgressBar("bhs_alt:main_cont:stamina_bar", self.stamina_bar_bg)
self.stamina_bar:SetProgressPos(0.0)
end
end
function BHS:UpdatePos()
local add_x = hud_type ~= "text" and -7 or 0 -- to compensate how bhs grabs texture
local add_y = hud_type ~= "text" and -15 or 0
self.bg:SetWndPos(vector2():set(mcm_pos_x + add_x, mcm_pos_y + add_y))
end
function BHS:UpdateBars()
if self.health_bar then
self.health_bar:SetProgressPos(db.actor.health)
self.stamina_bar:SetProgressPos(db.actor.power)
self.psi_bar:SetProgressPos(arszi_psy and arszi_psy.get_psy_health() or 0)
end
for limb, val in pairs(health) do
local timed_preview_val = 0
local preview_val = 0
if preview_sec then
-- no need to clamp, xml settings handle it
timed_preview_val = medkits[preview_sec] and medkits[preview_sec][limb] or 0
preview_val = healhelp[preview_sec] and healhelp[preview_sec][limb] or 0
end
self[limb .. "_green"]:SetProgressPos( (val + timedhp[limb] + timed_preview_val) / maxhp[limb])
self[limb]:SetProgressPos( (val + preview_val) / maxhp[limb])
end
end
function BHS:Update()
CUIScriptWnd.Update(self)
self:UpdateBars()
local hide_cond = actor_menu.last_mode == 1 or main_hud_shown()
self.bg:Show(hide_cond)
end
function BHS:__finalize()
end
------------------------------------------------------------------------------
----------------------------- Events / Updates -------------------------------
------------------------------------------------------------------------------
local hitboxes = {
[14] = "head", [15] = "head", [16] = "head", [17] = "head", [18] = "head", [19] = "head",
[2] = "torso", [11] = "torso", [12] = "torso", [13] = "torso", [20] = "torso", [33] = "torso",
[21] = "leftarm", [22] = "leftarm", [23] = "leftarm", [24] = "leftarm", [25] = "leftarm", [26] = "leftarm",
[27] = "leftarm", [28] = "leftarm", [29] = "leftarm", [30] = "leftarm", [31] = "leftarm", [32] = "leftarm",
[34] = "rightarm", [35] = "rightarm", [36] = "rightarm", [37] = "rightarm", [38] = "rightarm", [39] = "rightarm",
[40] = "rightarm", [41] = "rightarm", [42] = "rightarm", [43] = "rightarm", [44] = "rightarm", [45] = "rightarm",
[3] = "leftleg", [4] = "leftleg", [5] = "leftleg", [6] = "leftleg",
[7] = "rightleg", [8] = "rightleg", [9] = "rightleg", [10] = "rightleg",
}
local anomalies_hit = {
[hit.burn] = { "torso", "leftarm", "rightarm", "leftleg", "rightleg" },
[hit.strike] = { "torso", "leftarm", "rightarm", "leftleg", "rightleg" },
[hit.wound] = { "torso", "leftarm", "rightarm", "leftleg", "rightleg" },
[hit.shock] = { "torso", "leftarm", "rightarm", "leftleg", "rightleg" },
[hit.chemical_burn] = { "leftleg", "rightleg" },
}
local limb_msg = {
head = "Head fatally", torso = "Torso fatally", leftarm = "Left arm",
rightarm = "Right arm", leftleg = "Left leg", rightleg = "Right leg",
}
function actor_on_before_hit(s_hit, bone_id)
local draft = s_hit.draftsman
-- if none
if bone_id == 65535 then
return
end
-- if anomaly
if draft and IsAnomaly(draft) and bone_id == 0 and anomalies_hit[s_hit.type] then
local ar = anomalies_hit[s_hit.type]
damaged_limb = ar[math.random(1, #ar)]
return
end
-- if mutant
if draft and IsMonster(draft) and bone_id == 0 then
local near_bone_id = get_nearest_actor_bone_id(draft)
if near_bone_id and hitboxes[near_bone_id] then
damaged_limb = hitboxes[near_bone_id]
end
return
end
-- if fall
if s_hit.type == hit.strike and draft and draft:id() == 0 then
damaged_limb = math.random(2) == 1 and "leftleg" or "rightleg"
return
end
-- if bullet
if hitboxes[bone_id] then
damaged_limb = hitboxes[bone_id]
end
end
function hit_on_update()
-- skip first update
if not prev_health then
prev_health = db.actor.health
return
end
local old_hp = prev_health
prev_health = db.actor.health
-- register only_on_hit
if not damaged_limb then
return
end
local limb = damaged_limb
damaged_limb = nil
-- same check as old BHS for compatibility with ballistics etc
local amount = old_hp - db.actor.health
if amount <= 0.0293 then
return
end
local head_mult = limb == "head" and 2 or 1
local damage = math.ceil((amount * head_mult * 100) / 11 * damagescale)
health[limb] = health[limb] - damage
if health[limb] <= 0 then
-- reduce remnant from timedhp
timedhp[limb] = timedhp[limb] + health[limb]
-- clamp timedhp and send msg if health at 0 and timedhp at 0
if timedhp[limb] <= 0 then
timedhp[limb] = 0
actor_menu.set_msg(1, limb_msg[limb] .. " damaged!", 8)
end
-- clamp health
health[limb] = 0
end
-- for concussion
if limb == "head" and (health["head"] + timedhp["head"]) > 0 then
zzz_player_injuries_effects.head_concussion_start(damage)
end
end
function actor_on_item_use(obj, sec)
if medkits[sec] then
for limb, val in pairs(medkits[sec]) do
timedhp[limb] = timedhp[limb] + val
local diff = health[limb] + timedhp[limb] - maxhp[limb]
-- clamp timedhp
if diff > 0 then
timedhp[limb] = timedhp[limb] - diff
end
end
timedhp_timer = nil
end
if healhelp[sec] then
for limb, val in pairs(healhelp[sec]) do
-- restore only timedhp
if val > timedhp[limb] then
health[limb] = health[limb] + timedhp[limb]
timedhp[limb] = 0
-- restore val
else
health[limb] = health[limb] + val
timedhp[limb] = timedhp[limb] - val
end
end
timedhp_timer = nil
end
end
local med_tmr = 0
function medicine_on_update()
local tg = time_global()
if med_tmr > tg then return end
med_tmr = tg + 5000
local cur_time = game.get_game_time()
if not timedhp_timer then
timedhp_timer = ctime_to_t(cur_time)
end
local diff = cur_time:diffSec(t_to_ctime(timedhp_timer)) / 600 -- each per 10 game minutes
if diff >= 1 then
timedhp_timer = ctime_to_t(cur_time)
for limb, val in pairs(timedhp) do
timedhp[limb] = timedhp[limb] - (math.floor(diff))
if timedhp[limb] < 0 then
timedhp[limb] = 0
end
end
end
end
local heal_tmr = 0
function heal_on_update()
if regen <= 0 then return end
local tg = time_global()
if heal_tmr > tg then return end
heal_tmr = tg + 3000
local cur_time = game.get_game_time()
if not heal_timer then
heal_timer = ctime_to_t(cur_time)
end
local diff = cur_time:diffSec(t_to_ctime(heal_timer)) / (regen * 60) -- each per "regen" game minutes
if diff >= 1 then
heal_timer = ctime_to_t(cur_time)
for i = 1, math.floor(diff) do
heal_random_limb()
end
end
end
function kill_on_update()
if (health.torso + timedhp.torso) <= 0 or (health.head + timedhp.head) <= 0 then
db.actor.health = -1
end
end
function heal_random_limb()
local t = dup_table(health)
local t_size = size_table(t)
-- keep picking randomly until we find limb that needs healing
for i = 1, t_size do
local rnd_limb = random_key_table(t)
if t[rnd_limb] < maxhp[rnd_limb] then
health[rnd_limb] = health[rnd_limb] + 1
if timedhp[rnd_limb] > 0 then
timedhp[rnd_limb] = timedhp[rnd_limb] - 1
end
break
end
t[rnd_limb] = nil
end
end
-- preview
function ActorMenu_on_item_focus_receive(obj)
if not preview_sec then
preview_sec = obj:section()
end
end
function ActorMenu_on_item_focus_lost(obj)
if preview_sec == obj:section() then
preview_sec = nil
end
end
function ActorMenu_on_mode_changed(mode, last_mode)
if last_mode == 1 or last_mode == 4 then
preview_sec = nil
end
end
------------------------------------------------------------------------------
------------------------------- Utils / Misc ----------------------------------
------------------------------------------------------------------------------
function get_nearest_actor_bone_id(npc)
local head_bone_name = ini_sys:r_string_ex(npc:section(), "bone_head")
local head_bone_pos = head_bone_name and vector():set(npc:bone_position(head_bone_name))
if not head_bone_pos then return end
local min_dist = 99
local picked_bone_id
for bone_id, _ in pairs(hitboxes) do
local bone_name = db.actor:bone_name(bone_id)
local bone_pos = bone_name and vector():set(db.actor:bone_position(bone_name))
local dist = bone_pos and head_bone_pos:distance_to(bone_pos)
if dist and dist < min_dist then
min_dist = dist
picked_bone_id = bone_id
end
end
return picked_bone_id
end
-- item descr
local gt = game.translate_string
BuildHeaderBHS = ui_item.build_desc_header
function ui_item.build_desc_header(obj, sec, str)
str = str or gt(ini_sys:r_string_ex(sec, "description"))
if (not str) then return "" end
if not enable_display then
return BuildHeaderBHS(obj, sec, str)
end
local _str = ""
local blue_main = utils_xml.get_color("d_blue")
local blue_clr = strformat("%c[%s,%s,%s,%s]", 255, 74, 134, 232)
local yel_clr = strformat("%c[%s,%s,%s,%s]", 0, 252, 186, 3)
local grey_clr = utils_xml.get_color("ui_gray_2")
local obj_sec = obj and obj:section()
-- get circles/number for string
local function val_to_fkn_circles(val)
local circles = ""
if val >= display_numeric_at or show_numeric_always then
return val
elseif val > 0 then
for i = 1, val do
circles = circles .. gt("st_bhs_mihail_krug")
end
end
return circles
end
-- get string
local function build_string(t_name, sec, color)
local head_str = ""
local torso_str = ""
local arm_str = ""
local leg_str = ""
local timeregen_str = ""
if sec and t_name[sec] then
for limb, val in pairs(t_name[sec]) do
if limb == "head" then
head_str = grey_clr .. gt("st_bhs_head_str") .. color .. val_to_fkn_circles(val) .. " "
elseif limb == "torso" then
torso_str = grey_clr .. gt("st_bhs_torso_str") .. color .. val_to_fkn_circles(val) .. " "
elseif limb == "rightarm" then
arm_str = grey_clr .. gt("st_bhs_rightarm_str") .. color .. val_to_fkn_circles(val) .. " "
elseif limb == "rightleg" then
leg_str = grey_clr .. gt("st_bhs_rightleg_str") .. color .. val_to_fkn_circles(val) .. " "
-- elseif limb == "timeregen" and show_timed_heal_time then
-- timeregen_str = grey_clr .. gt("st_bhs_timeregen") .. color .. (val / 1000) .. " "
end
end
end
local main_string = head_str .. torso_str .. arm_str .. leg_str .. (timeregen_str ~= "" and (" " .. timeregen_str) or "")
return main_string
end
local medkits_pre = " " .. yel_clr .. gt("st_bhs_mihail_krug") .. " " .. yel_clr .. " " .. gt("st_bhs_timed_heal") .. " "
local medkits_str = build_string(medkits, obj_sec, yel_clr)
local healhelp_pre = " " .. blue_main .. gt("st_bhs_mihail_krug") .. " " .. blue_clr .. " " .. gt("st_bhs_full_heal") .. " "
local healhelp_str = build_string(healhelp, obj_sec, blue_clr)
if obj_sec then
if medkits_str ~= "" and healhelp_str ~= "" then
_str = medkits_pre .. medkits_str .. "\\n" .. healhelp_pre .. healhelp_str .. "\\n" .. utils_xml.get_color("ui_gray_1")
return BuildHeaderBHS(obj, sec, str) .. _str
elseif medkits_str ~= "" then
_str = medkits_pre .. medkits_str .. "\\n" .. utils_xml.get_color("ui_gray_1")
return BuildHeaderBHS(obj, sec, str) .. _str
elseif healhelp_str ~= "" then
_str = healhelp_pre .. healhelp_str .. "\\n" .. utils_xml.get_color("ui_gray_1")
return BuildHeaderBHS(obj, sec, str) .. _str
else
return BuildHeaderBHS(obj, sec, str)
end
else
return BuildHeaderBHS(obj, sec, str)
end
end
-- dialogues
function limb_is_damaged()
for k, v in pairs(health) do
if health[k] < maxhp[k] then
return true
end
end
end
function heal_all_limbs()
for k, v in pairs(health) do
health[k] = maxhp[k]
timedhp[k] = 0
end
end
base_not_healthy = dialogs.is_actor_not_healthy
function dialogs.is_actor_not_healthy(a, b)
if base_not_healthy(a, b) or limb_is_damaged() then
return true
end
end
base_actor_injured = dialogs.is_actor_injured
function dialogs.is_actor_injured(a, b)
if base_actor_injured(a, b) or (db.actor:money() >= 1850 and limb_is_damaged()) then
return true
end
end
base_actor_injured_irradiated = dialogs.is_actor_injured_irradiated
function dialogs.is_actor_injured_irradiated(a, b)
if base_actor_injured_irradiated(a, b) or (db.actor:money() >= 3350 and limb_is_damaged()) then
return true
end
end
base_heal_injury = dialogs.heal_actor_injury
function dialogs.heal_actor_injury(a, b)
base_heal_injury(a, b)
heal_all_limbs()
end
base_heal_injury_radiation = dialogs.heal_actor_injury_radiation
function dialogs.heal_actor_injury_radiation(a, b)
base_heal_injury_radiation(a, b)
heal_all_limbs()
end
-- items use override
function itms_manager.actor_on_item_before_use(obj, flags)
local sec = obj:section()
local ini_eff = ini_file("items\\items\\animations_settings.ltx")
-- headgear anims
if z_headgear_animations_fdda_strict_helmets and headgear_animations_mcm and headgear_animations_mcm.get_config("strict_helmets") then
if ini_eff:r_bool_ex(sec, "helm") == false then
if z_headgear_animations_fdda_strict_helmets.is_have_helmet() then
actor_menu.set_msg(1, game.translate_string("liz_ha_text_cant_consume_item"), 3)
flags.ret_value = false
return
end
end
end
---------
if IsItem("tool",sec) then
flags.ret_value = true
return
end
local pass = true
local require_tool = ini_sys:r_string_ex(sec, "required_tool")
local obj_tool = require_tool and ini_sys:section_exist(require_tool) and db.actor:object(require_tool)
if require_tool and (not obj_tool) then
str = strformat(game.translate_string("st_itm_manager_missing_requirements"), ui_item.get_sec_name(require_tool))
pass = false
end
if pass then
flags.ret_value = true
if obj_tool then
utils_item.discharge(obj_tool)
end
else
flags.ret_value = false
utils_xml.hide_menu()
actor_menu.set_msg(1, str, 3)
end
-- fdda
if enhanced_animations then
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
local enable_animations = ui_mcm and ui_mcm.get("EA_settings/enable_animations") or ui_options.get("video/player/animations")
if ini_eff:r_string_ex(sec, "snd") and enable_animations and flags.ret_value then
enhanced_animations.use_item(obj)
flags.ret_value = false
return
end
end
---------
end
--------------------------------------
function bhs_dbg_hit(limb, dmg)
-- zzz_player_injuries.bhs_dbg_hit("head", 0.3)
dmg = dmg >= db.actor.health and db.actor.health - 0.01 or dmg
damaged_limb = limb
db.actor:set_health_ex(db.actor.health - dmg)
end
function bhs_dbg_heal()
-- zzz_player_injuries.bhs_dbg_heal()
for k, _ in pairs(health) do
health[k] = maxhp[k]
timedhp[k] = 0
end
end
function bhs_dbg_set_health(limb, val)
-- zzz_player_injuries.bhs_dbg_set_health("head", 3)
val = (val > maxhp[limb] and maxhp[limb]) or (val <= 0 and 0) or val
health[limb] = val
end
------------------------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------
function actor_on_update()
hit_on_update()
medicine_on_update()
heal_on_update()
kill_on_update()
end
function save_state(m_data)
m_data.bhs_health = health
m_data.bhs_timedhp = timedhp
m_data.bhs_timedhp_timer = timedhp_timer
m_data.bhs_heal_timer = heal_timer
end
function load_state(m_data)
health = m_data.bhs_health or health
timedhp = m_data.bhs_timedhp or timedhp
timedhp_timer = m_data.bhs_timedhp_timer
heal_timer = m_data.bhs_heal_timer
end
function on_option_change()
damagescale = zzz_player_injuries_mcm.get_config("damage_scale")
regen = zzz_player_injuries_mcm.get_config("regen")
enable_display = zzz_player_injuries_mcm.get_config("enable_display")
display_numeric_at = zzz_player_injuries_mcm.get_config("numeric_at")
show_numeric_always = zzz_player_injuries_mcm.get_config("numeric_always")
hud_type = zzz_player_injuries_mcm.get_config("hud_type")
alt_mode_health = zzz_player_injuries_mcm.get_config("alt_mode_health")
mcm_pos_x = zzz_player_injuries_mcm.get_config("position_x")
mcm_pos_y = zzz_player_injuries_mcm.get_config("position_y")
vanilla_bars = zzz_player_injuries_mcm.get_config("vanilla_bars")
custom_colors = zzz_player_injuries_mcm.get_config("custom_colors")
clr_main_r = zzz_player_injuries_mcm.get_config("clr_main_r")
clr_main_g = zzz_player_injuries_mcm.get_config("clr_main_g")
clr_main_b = zzz_player_injuries_mcm.get_config("clr_main_b")
clr_timed_r = zzz_player_injuries_mcm.get_config("clr_timed_r")
clr_timed_g = zzz_player_injuries_mcm.get_config("clr_timed_g")
clr_timed_b = zzz_player_injuries_mcm.get_config("clr_timed_b")
deactivate_hud()
activate_hud()
end
function on_game_start()
RegisterScriptCallback("actor_on_first_update", actor_on_first_update)
RegisterScriptCallback("actor_on_net_destroy", deactivate_hud)
RegisterScriptCallback("actor_on_before_death", deactivate_hud)
RegisterScriptCallback("actor_on_before_hit", actor_on_before_hit)
RegisterScriptCallback("actor_on_item_use", actor_on_item_use)
RegisterScriptCallback("ActorMenu_on_item_focus_receive", ActorMenu_on_item_focus_receive)
RegisterScriptCallback("ActorMenu_on_item_focus_lost", ActorMenu_on_item_focus_lost)
RegisterScriptCallback("ActorMenu_on_mode_changed", ActorMenu_on_mode_changed)
RegisterScriptCallback("save_state", save_state)
RegisterScriptCallback("load_state", load_state)
RegisterScriptCallback("actor_on_update", actor_on_update)
RegisterScriptCallback("on_option_change", on_option_change)
end
@@ -0,0 +1,401 @@
------------------------------------------------------------------------------
---------------------------------- Arms -------------------------------------
------------------------------------------------------------------------------
local aim_anm = {"earthquake_1","earthquake_2"}
local mcm_arms_penalty = zzz_player_injuries_mcm.get_config("arm_opt")
local mcm_arms_min_hp = zzz_player_injuries_mcm.get_config("arm_pen_min_hp")
local mcm_arms_cam_pwr = zzz_player_injuries_mcm.get_config("arm_anm_pwr")
function shaking_hands()
if not mcm_arms_penalty then return end
local activeslot = db.actor:active_slot()
if not (activeslot == 2 or activeslot == 3 or activeslot == 1) then return end
local item_in_slot = db.actor:item_in_slot(activeslot)
if not (item_in_slot) then return end
local cam_power = 0
local weight = item_in_slot:weight()
local body_state = get_body_state()
local body_state_mult = (body_state == "crouch" and 0.75) or (body_state == "low_crouch" and 0.5) or 1
local health, timedhp, maxhp = zzz_player_injuries.health, zzz_player_injuries.timedhp, zzz_player_injuries.maxhp
local max_left_arm, max_right_arm = maxhp.rightarm, maxhp.leftarm
local left_arm, right_arm = health.rightarm + timedhp.rightarm, health.leftarm + timedhp.leftarm
local arms_ratio = (left_arm + right_arm) / (max_left_arm + max_right_arm)
if arms_ratio >= (mcm_arms_min_hp / 100) then
return
end
-- lower penalty if both arms almost equally damaged (except when both have low hp)
if (left_arm / right_arm) > 0.6 and (right_arm / left_arm) > 0.6 then
cam_power = 0.08 * weight / arms_ratio
else
cam_power = 0.12 * weight / arms_ratio
end
cam_power = cam_power * body_state_mult
cam_power = clamp(cam_power, 0, 3)
cam_power = cam_power * mcm_arms_cam_pwr
if item_in_slot:weapon_is_scope() then
cam_power = cam_power * 0.2
end
-- play anm
level.add_cam_effector("camera_effects\\" .. aim_anm[math.random(#aim_anm)] .. ".anm", 9921, true, "", 0, true, cam_power)
end
function actor_on_weapon_zoom_in()
shaking_hands()
end
function actor_on_weapon_zoom_out()
level.remove_cam_effector(9921)
end
------------------------------------------------------------------------------
---------------------------------- Legs --------------------------------------
------------------------------------------------------------------------------
local rightleg_anm = {"med1","med4"}
local leftleg_anm = {"med2","med3"}
local bothlegs_anm = {"strong1","strong2","strong4"}
local limp_flag
local mcm_legs_penalty = zzz_player_injuries_mcm.get_config("leg_opt")
local mcm_legs_min_hp = zzz_player_injuries_mcm.get_config("leg_pen_min_hp")
local mcm_legs_anm_pwr = zzz_player_injuries_mcm.get_config("leg_anm_pwr")
local mcm_legs_dmg_min_hp = zzz_player_injuries_mcm.get_config("leg_dmg_min_hp")
local mcm_legs_new_voice = zzz_player_injuries_mcm.get_config("new_voice_sounds")
local legs_speed_tmr = 0
function limp_speed_slow()
if not mcm_legs_penalty then return end
local tg = time_global()
if legs_speed_tmr > tg then return end
legs_speed_tmr = tg + 2000
local health, timedhp, maxhp = zzz_player_injuries.health, zzz_player_injuries.timedhp, zzz_player_injuries.maxhp
local legs_summ = health.leftleg + timedhp.leftleg + health.rightleg + timedhp.rightleg
local max_legs_summ = maxhp.leftleg + maxhp.rightleg
local legs_ratio = legs_summ / max_legs_summ
if legs_ratio >= (mcm_legs_min_hp / 100) then
speed.remove_speed("bhs_speed_run")
return
end
local val = normalize(legs_summ, -1, max_legs_summ)
speed.add_speed("bhs_speed_run", val, false, true)
end
local legs_limp_tmr = 0
function legs_limp_set()
if not mcm_legs_penalty then return end
local tg = time_global()
if legs_limp_tmr > tg then return end
legs_limp_tmr = tg + 2000
local health, timedhp, maxhp = zzz_player_injuries.health, zzz_player_injuries.timedhp, zzz_player_injuries.maxhp
local right_leg, left_leg = health.leftleg + timedhp.leftleg, health.rightleg + timedhp.rightleg -- right is left
local legs_summ = right_leg + left_leg
local max_right_leg, max_left_leg = maxhp.leftleg, maxhp.rightleg
local max_legs_summ = max_right_leg + max_left_leg
local legs_ratio = legs_summ / max_legs_summ
if legs_ratio >= (mcm_legs_min_hp / 100) then
limp_flag = nil
return
end
if (right_leg == left_leg) and (legs_summ < max_legs_summ) then
limp_flag = "both"
elseif (left_leg < max_left_leg) and (left_leg < right_leg) then
limp_flag = "left"
elseif (right_leg < max_right_leg) and (right_leg < left_leg) then
limp_flag = "right"
end
end
local legs_anm_tmr = 0
function legs_limp_animation()
if not mcm_legs_penalty then return end
if not limp_flag then return end
local tg = time_global() -- sprint is tearing animations apart, the only way is to increase delay for it
if legs_anm_tmr > tg then return end
local add_time = IsMoveState("mcSprint") and 1000 or 500
legs_anm_tmr = tg + add_time
local health, timedhp, maxhp = zzz_player_injuries.health, zzz_player_injuries.timedhp, zzz_player_injuries.maxhp
local right_leg, left_leg = health.leftleg + timedhp.leftleg, health.rightleg + timedhp.rightleg
local max_right_leg, max_left_leg = maxhp.leftleg, maxhp.rightleg
if limp_flag == "right" then
local val = normalize(right_leg, max_right_leg, 0) * mcm_legs_anm_pwr * 3
level.add_cam_effector("camera_effects\\switch\\" .. rightleg_anm[math.random(#rightleg_anm)] .. ".anm", 99251, false, "", 0, false, val)
elseif limp_flag == "left" then
local val = normalize(left_leg, max_left_leg, 0) * mcm_legs_anm_pwr * 3
level.add_cam_effector("camera_effects\\switch\\" .. leftleg_anm[math.random(#leftleg_anm)] .. ".anm", 99261, false, "", 0, false, val)
elseif limp_flag == "both" then
local val = normalize( left_leg + right_leg, max_left_leg + max_right_leg, 0 ) * mcm_legs_anm_pwr * 3
level.add_cam_effector("camera_effects\\switch\\" .. bothlegs_anm[math.random(#bothlegs_anm)] .. ".anm", 99271, false, "", 0, false, val)
end
end
local legs_dmg_tmr = 0
function legs_limp_damage()
if not mcm_legs_penalty then return end
if not IsMoveState("mcSprint") then return end
local tg = time_global()
if legs_dmg_tmr > tg then return end
legs_dmg_tmr = tg + 2500
local health, timedhp, maxhp = zzz_player_injuries.health, zzz_player_injuries.timedhp, zzz_player_injuries.maxhp
local right_leg, left_leg = health.leftleg + timedhp.leftleg, health.rightleg + timedhp.rightleg
local max_right_leg, max_left_leg = maxhp.leftleg, maxhp.rightleg
local right_leg_pwr = (right_leg / max_right_leg) < (mcm_legs_dmg_min_hp / 100) and 0.04 or 0
local left_leg_pwr = (left_leg / max_left_leg) < (mcm_legs_dmg_min_hp / 100) and 0.04 or 0
-- return if legs hp higher than mcm setting
local hit_pwr = (right_leg_pwr + left_leg_pwr) / 2
if hit_pwr <= 0 then return end
-- return if chance didn't proc
local legs_ratio = (right_leg + left_leg) / (max_right_leg + max_left_leg)
local chance = (1 - legs_ratio) * 0.5
if chance < math.random() then return end
local file
if mcm_legs_new_voice then
local helmet = db.actor:item_in_slot(12) or db.actor:get_current_outfit()
file = "bhs\\" .. (helmet and "m_" or "") .. "pain_" .. math.random(1, 13)
else
file = "actor\\pain_" .. math.random(1, 8)
end
file_to_say = sound_object(file)
file_to_say:play(db.actor, 0, sound_object.s2d)
level.add_pp_effector("blur_bhs.ppe", math.random(655808, 655820), false)
db.actor:set_health_ex(db.actor.health - hit_pwr)
end
function actor_on_footstep()
legs_limp_animation()
legs_limp_damage()
end
------------------------------------------------------------------------------
--------------------------------- Torso --------------------------------------
------------------------------------------------------------------------------
local mcm_torso_penalty = zzz_player_injuries_mcm.get_config("torso_opt")
local torso_tmr = 0
function torso_penalty()
if not mcm_torso_penalty then return end
local tg = time_global()
if torso_tmr > tg then return end
torso_tmr = tg + 1000
local torso = zzz_player_injuries.health.torso + zzz_player_injuries.timedhp.torso
local max_torso = zzz_player_injuries.maxhp.torso
local torso_ratio = torso / max_torso
local cap_health = normalize(torso_ratio, -2, 1)
if db.actor.health > cap_health then
db.actor.health = cap_health
end
end
------------------------------------------------------------------------------
--------------------------------- Head --------------------------------------
------------------------------------------------------------------------------
-- zzz_player_injuries.hit_on_update starts it
local mcm_head_penalty = zzz_player_injuries_mcm.get_config("head_opt")
local mcm_head_min_dmg = zzz_player_injuries_mcm.get_config("head_pen_min_hp")
local mcm_head_anm_pwr = zzz_player_injuries_mcm.get_config("head_anm_pwr")
head_tbl = {}
function head_concussion_start(damage)
if not mcm_head_penalty then return end
if damage < mcm_head_min_dmg then return end
-- new hit during stage 2, override
if head_tbl.stage and head_tbl.stage == 2 then
empty_table(head_tbl)
end
-- stage 1
if (not head_tbl.stage) then
head_tbl.stage = 1
head_tbl.damage = damage
local eff_pwr = (head_tbl.damage / zzz_player_injuries.maxhp.head) * mcm_head_anm_pwr
level.add_pp_effector("concussion_bhs.ppe", 99123, false)
level.set_pp_effector_factor(99123, (eff_pwr))
head_snd_off()
CreateTimeEvent("bhs_conc_e", "bhs_conc_a", 10, head_concussion_mid)
end
end
function head_concussion_mid()
-- set stage 2
head_tbl.stage = 2
head_snd_on()
local snd = sound_object("bhs\\tinnitusx")
snd:play_no_feedback(db.actor, sound_object.s2d, 0, VEC_ZERO, 1.0, 1.0)
snd.volume = 2
return true
end
local head_tmr = 0
function head_concussion_update()
-- stage 2
if not (head_tbl.stage and head_tbl.stage == 2) then return end
local tg = time_global()
if head_tmr > tg then return end
head_tmr = tg + 15000
-- reduce passive damage over time (5 damage effect needs 2.5 mins)
head_tbl.damage = head_tbl.damage - 0.5
-- remove effect if "damage" drops below zero
if head_tbl.damage <= 0 then
empty_table(head_tbl)
exec_console_cmd("cam_inert 0")
return
end
-- remove effect if head was healed to full (timedhp on head does not count)
local head, max_head = zzz_player_injuries.health.head, zzz_player_injuries.maxhp.head
if head >= max_head then
empty_table(head_tbl)
exec_console_cmd("cam_inert 0")
return
end
-- play ppe and anm
local eff_pwr = (head_tbl.damage / zzz_player_injuries.maxhp.head) * mcm_head_anm_pwr
if eff_pwr > math.random() then
level.add_cam_effector("camera_effects\\wake_up.anm", 96872, false, "", 0, true, eff_pwr)
end
level.add_pp_effector("concussion_post_bhs.ppe", 99133, false)
level.set_pp_effector_factor(99133, eff_pwr)
-- cam_inert xd
exec_console_cmd("cam_inert " .. eff_pwr)
end
function head_snd_off()
_G.amb_vol = math.max(get_console_cmd(2, "snd_volume_eff"), _G.amb_vol or 0)
exec_console_cmd("snd_volume_eff 0.01")
head_tbl.vol = _G.amb_vol
end
function head_snd_on()
exec_console_cmd("snd_volume_eff ".. (head_tbl.vol or tostring(_G.amb_vol)))
_G.amb_vol = 0
head_tbl.vol = 0
end
function actor_on_first_update()
-- for reloading during stage 1
if head_tbl.stage and head_tbl.stage == 1 then
head_tbl.stage = 2
head_snd_on()
end
exec_console_cmd("cam_inert 0")
end
------------------------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------
function get_body_state()
if not IsMoveState("mcCrouch") then
return "stand"
end
return IsMoveState("mcAccel") and "low_crouch" or "crouch"
end
function actor_on_update()
limp_speed_slow()
legs_limp_set()
torso_penalty()
head_concussion_update()
end
function on_option_change()
mcm_arms_penalty = zzz_player_injuries_mcm.get_config("arm_opt")
mcm_arms_min_hp = zzz_player_injuries_mcm.get_config("arm_pen_min_hp")
mcm_arms_cam_pwr = zzz_player_injuries_mcm.get_config("arm_anm_pwr")
mcm_legs_penalty = zzz_player_injuries_mcm.get_config("leg_opt")
mcm_legs_min_hp = zzz_player_injuries_mcm.get_config("leg_pen_min_hp")
mcm_legs_anm_pwr = zzz_player_injuries_mcm.get_config("leg_anm_pwr")
mcm_legs_dmg_min_hp = zzz_player_injuries_mcm.get_config("leg_dmg_min_hp")
mcm_legs_new_voice = zzz_player_injuries_mcm.get_config("new_voice_sounds")
mcm_torso_penalty = zzz_player_injuries_mcm.get_config("torso_opt")
mcm_head_penalty = zzz_player_injuries_mcm.get_config("head_opt")
mcm_head_min_dmg = zzz_player_injuries_mcm.get_config("head_pen_min_hp")
mcm_head_anm_pwr = zzz_player_injuries_mcm.get_config("head_anm_pwr")
end
function save_state(m_data)
m_data.bhs_head_tbl = head_tbl
end
function load_state(m_data)
head_tbl = m_data.bhs_head_tbl or {}
end
function on_game_start()
RegisterScriptCallback("actor_on_weapon_zoom_in", actor_on_weapon_zoom_in)
RegisterScriptCallback("actor_on_weapon_zoom_out", actor_on_weapon_zoom_out)
RegisterScriptCallback("actor_on_footstep", actor_on_footstep)
RegisterScriptCallback("actor_on_first_update", actor_on_first_update)
RegisterScriptCallback("actor_on_update", actor_on_update)
RegisterScriptCallback("on_option_change", on_option_change)
RegisterScriptCallback("save_state", save_state)
RegisterScriptCallback("load_state", load_state)
end
@@ -0,0 +1,99 @@
-- If you don't use MCM, change your defaults from here.
local defaults = {
["hud_type"] = "default",
["alt_mode_health"] = true,
["position_x"] = 5,
["position_y"] = 635,
["vanilla_bars"] = false,
["custom_colors"] = false,
["clr_main_r"] = 255,
["clr_main_g"] = 255,
["clr_main_b"] = 255,
["clr_timed_r"] = 255,
["clr_timed_g"] = 255,
["clr_timed_b"] = 255,
["regen"] = 60,
["damage_scale"] = 1,
["enable_display"] = true,
["numeric_at"] = 12,
["numeric_always"] = false,
["arm_opt"] = true,
["arm_pen_min_hp"] = 100,
["arm_anm_pwr"] = 1,
["leg_opt"] = true,
["leg_pen_min_hp"] = 100,
["leg_anm_pwr"] = 1.0,
["leg_dmg_min_hp"] = 60,
["new_voice_sounds"] = false,
["torso_opt"] = true,
["head_opt"] = true,
["head_pen_min_hp"] = 2,
["head_anm_pwr"] = 0.5,
}
function get_config(key)
if ui_mcm then return ui_mcm.get("body_health_system/"..key) else return defaults[key] end
end
function on_mcm_load()
op = { id= "body_health_system",sh=true ,gr={
{ id= "title",type= "slide",link= "ui_options_slider_player",text="ui_mcm_body_health_system_title",size= {512,50},spacing= 20 },
{ id= "title" ,type= "desc" ,text= "ui_mcm_body_health_system_header_hud" ,align= "c" ,clr= {255,190,190,190} },
{id = "hud_type", type= "list", val= 0, def= "default", content= { {"default", "bhs_default"} , {"eft", "bhs_eft"} , {"text", "bhs_text"} } },
{id = "alt_mode_health", type = "check", val = 1, def = true},
{id = "position_x", type = "input", val = 2, min=0, max=1000, def = 5},
{id = "position_y", type = "input", val = 2, min=0, max=1000, def = 635},
{id = "vanilla_bars", type = "check", val = 1, def = false},
{id="divider", type="line" },
{id = "custom_colors", type = "check", val = 1, def = false},
{id = "clr_main_r", type = "input", val = 2, min=0, max=255, def = 255},
{id = "clr_main_g", type = "input", val = 2, min=0, max=255, def = 255},
{id = "clr_main_b", type = "input", val = 2, min=0, max=255, def = 255},
{id = "clr_timed_r", type = "input", val = 2, min=0, max=255, def = 255},
{id = "clr_timed_g", type = "input", val = 2, min=0, max=255, def = 255},
{id = "clr_timed_b", type = "input", val = 2, min=0, max=255, def = 255},
{id="divider", type="line" },
{ id= "title" ,type= "desc" ,text= "ui_mcm_body_health_system_header_general" ,align= "c" ,clr= {255,190,190,190} },
{id = "regen", type = "track", val = 2, min=0, max=1000, step=5, def = 60},
{id = "damage_scale", type = "track", val = 2, min=0.1, max=3, step=0.1, def = 1},
{id = "enable_display", type = "check", val = 1, def = true},
{id = "numeric_at", type = "track", val = 2, min=1, max=30, step=1, def = 12},
{id = "numeric_always", type = "check", val = 1, def = false},
{id="divider", type="line" },
{ id= "title" ,type= "desc" ,text= "ui_mcm_body_health_system_header_arms" ,align= "c" ,clr= {255,190,190,190} },
{id = "arm_opt", type = "check", val = 1, def = true},
{id = "arm_pen_min_hp", type = "track", val = 2, min=2,max=100,step=2, def = 100},
{id = "arm_anm_pwr", type = "track", val = 2, min=0.1,max=2,step=0.1, def = 1},
{id="divider", type="line" },
{ id= "title" ,type= "desc" ,text= "ui_mcm_body_health_system_header_legs" ,align= "c" ,clr= {255,190,190,190} },
{id = "leg_opt", type = "check", val = 1, def = true},
{id = "leg_pen_min_hp", type = "track", val = 2, min=2,max=100,step=2, def = 100},
{id = "leg_anm_pwr", type = "track", val = 2, min=0.1,max=2,step=0.1, def = 1},
{id = "leg_dmg_min_hp", type = "track", val = 2, min=2,max=100,step=2, def = 60},
{id = "new_voice_sounds", type = "check", val = 1, def = false},
{id="divider", type="line" },
{ id= "title" ,type= "desc" ,text= "ui_mcm_body_health_system_header_torso" ,align= "c" ,clr= {255,190,190,190} },
{id = "torso_opt", type = "check", val = 1, def = true},
{id="divider", type="line" },
{ id= "title" ,type= "desc" ,text= "ui_mcm_body_health_system_header_head" ,align= "c" ,clr= {255,190,190,190} },
{id = "head_opt", type = "check", val = 1, def = true},
{id = "head_pen_min_hp", type = "track", val = 2, min=1,max=10,step=1, def = 2},
{id = "head_anm_pwr", type = "track", val = 2, min=0.1,max=2,step=0.1, def = 0.5},
}
}
return op
end