Divergent/mods/Redone Limansk and Hospital/gamedata/scripts/extended_da_psy_field_redon...

55 lines
1.2 KiB
Plaintext
Raw Normal View History

2024-03-17 20:18:03 -04:00
local psy_extra_levels = {
["l10_limansk"] = true,
}
local psy_immune_factions = {
["monolith"] = true,
["greh"] = true,
["zombied"] = true,
}
local function actor_on_first_update()
local lvl_name = level.name()
local faction = get_actor_true_community()
psy_damage = 0
if (psy_immune_factions[faction] or has_alife_info("lim_deactivate_duga_done") or has_alife_info("living_legend_psy_helmet")) then
return
end
if (psy_extra_levels[lvl_name]) then
actor_menu.set_msg(1, game.translate_string("st_psy_danger"),7)
psy_damage = 1
end
end
trigger = 0
delay = 8500
function actor_on_update()
tg = time_global()
if trigger == 0 then
redone_delay = tg + delay
trigger = 1
end
if (trigger == 1 and tg > redone_delay and psy_damage == 1) then
damage = 0.08
local m_data = alife_storage_manager.get_state()
arszi_psy.save_state(m_data)
local psy_table = m_data.psy_table
psy_table.actor_psy_health = psy_table.actor_psy_health - damage
actor_menu.set_msg(1, game.translate_string("st_psy_danger"),5)
trigger = 0
end
end
function on_game_start()
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
RegisterScriptCallback("actor_on_update",actor_on_update)
end