Added, Updated and Removed Mods; Updated Readme
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
|
||||
local psy_extra_levels = {
|
||||
["l10_radar"] = true,
|
||||
["l10_red_forest"] = true,
|
||||
["l11_pripyat"] = 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("bar_deactivate_radar_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
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
local to_del = {
|
||||
["red_space_restrictor_to_limansk"] = true,
|
||||
["lim_space_restrictor_to_red_forest"] = true,
|
||||
}
|
||||
|
||||
function actor_on_first_update()
|
||||
for i = 1, 65534 do
|
||||
local se_obj = alife_object(i)
|
||||
if se_obj and se_obj.name and se_obj:name() and to_del[se_obj:name()] then
|
||||
alife_release(se_obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function on_game_start()
|
||||
RegisterScriptCallback("actor_on_first_update", actor_on_first_update)
|
||||
end
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
function actor_on_first_update()
|
||||
local lc_pool = {
|
||||
["lc_red01_limansk01"] = {
|
||||
pos = vector():set(-205,0,-332),
|
||||
smart = "red_bridge_bandit_smart_skirmish",
|
||||
spot = "level_changer_left",
|
||||
hint = "space_restrictor_to_limansk_desc",
|
||||
},
|
||||
["lc_limansk01_red01"] = {
|
||||
pos = vector():set(13,0,-388),
|
||||
smart = "lim_smart_terrain_1",
|
||||
spot = "level_changer_right_down",
|
||||
hint = "mil_space_restrictor_to_red_1_descr",
|
||||
}
|
||||
}
|
||||
|
||||
for sec,v in pairs(lc_pool) do
|
||||
local se = get_story_se_item(sec)
|
||||
if not (se) then
|
||||
local pos = v.pos
|
||||
local vid = level.vertex_id(pos)
|
||||
local gid = SIMBOARD.smarts_by_names[v.smart].m_game_vertex_id
|
||||
se = alife():create(sec,pos,vid,gid)
|
||||
end
|
||||
|
||||
if (se.position:distance_to_sqr(v.pos) > 0.1) then
|
||||
local pos = v.pos
|
||||
local vid = level.vertex_id(pos)
|
||||
local gid = SIMBOARD.smarts_by_names[v.smart].m_game_vertex_id
|
||||
TeleportObject(se.id,pos,vid,gid)
|
||||
end
|
||||
|
||||
if (level.map_has_object_spot(se.id,v.spot) == 0) then
|
||||
level.map_add_object_spot_ser(se.id,v.spot,game.translate_string(v.hint))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function check_name(actor,obj,p)
|
||||
return p and p[1] and obj and string.find(obj:name(),p[1]) and true
|
||||
end
|
||||
|
||||
function teleport_actor(actor,obj)
|
||||
local p = {
|
||||
["lc_red01_limansk01"] = {
|
||||
pos = vector():set(7.2615,-0.009,-380.5515),
|
||||
w_p = vector():set(-201.9342,0.1365,-320.1596),
|
||||
smart = "lim_smart_terrain_1",
|
||||
},
|
||||
["lc_limansk01_red01"] = {
|
||||
pos = vector():set(-201.9342,0.1365,-320.1596),
|
||||
w_p = vector():set(7.2615,-0.009,-380.5515),
|
||||
smart = "red_bridge_bandit_smart_skirmish",
|
||||
},
|
||||
}
|
||||
|
||||
local sec = obj and obj:section()
|
||||
local v = sec and p[sec]
|
||||
|
||||
if (v and v.w_p and v.pos and v.smart) then
|
||||
db.actor:set_actor_position(v.w_p)
|
||||
|
||||
local pos = v.pos
|
||||
local vid = level.vertex_id(pos)
|
||||
local gid = SIMBOARD.smarts_by_names[v.smart].m_game_vertex_id
|
||||
ChangeLevel(pos,vid,gid,VEC_ZERO,true)
|
||||
end
|
||||
end
|
||||
|
||||
function on_game_start()
|
||||
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
|
||||
end
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
|
||||
local dynamic_object_storage = {}
|
||||
|
||||
function dynamic_object(actor,obj,p)
|
||||
local ini = p and p[1] and ini_file(p[1])
|
||||
local smart_name = ini and ini:r_string_ex("dynamic_object_configs","smart")
|
||||
local smart = smart_name and SIMBOARD.smarts_by_names[smart_name]
|
||||
|
||||
if not (smart) then
|
||||
return
|
||||
end
|
||||
|
||||
if not (dynamic_object_storage[smart_name]) then
|
||||
dynamic_object_storage[smart_name] = {}
|
||||
end
|
||||
|
||||
local lst = dynamic_object_storage[smart_name]
|
||||
|
||||
local n = ini:line_count("exclusive")
|
||||
for k=0,n-1 do
|
||||
local r,i,v = ini:r_line("exclusive",k)
|
||||
local s = get_object_config(v)
|
||||
if (i and s) then
|
||||
local idx = lst[i]
|
||||
local sec = s.sec
|
||||
local pos = s.pos
|
||||
local ang = s.ang
|
||||
local con = s.con and ini:r_string_to_condlist("dynamic_object_configs",s.con,"true")
|
||||
if (xr_logic.pick_section_from_condlist(db.actor,obj,con) == "true") then
|
||||
local se = idx and tonumber(idx.id) and alife():object(tonumber(idx.id))
|
||||
if (se and string.find(se:name(),sec)) then
|
||||
-- Correct. Update object.
|
||||
se.position = vector():set(pos)
|
||||
se.angle = vector():set(ang)
|
||||
else
|
||||
-- Wrong object or doesn't exit. Try to delete the old object and create a new one.
|
||||
if (se and idx.sec and string.find(se:name(),idx.sec)) then
|
||||
alife_release(se)
|
||||
end
|
||||
local new_se = alife():create(sec,pos,smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||||
if (new_se) then
|
||||
new_se.angle = vector():set(ang)
|
||||
lst[i] = {id = tonumber(new_se.id),sec = tostring(sec)}
|
||||
--printf("GhenTuong: dynamic_object create %s [%s]",new_se.id,new_se:name())
|
||||
end
|
||||
end
|
||||
else
|
||||
if (idx) then
|
||||
local se = tonumber(idx.id) and alife():object(tonumber(idx.id))
|
||||
if (se and idx.sec and string.find(se:name(),idx.sec)) then
|
||||
--printf("GhenTuong: dynamic_object delete %s [%s]",se.id,se:name())
|
||||
alife_release(se)
|
||||
end
|
||||
lst[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i,idx in pairs(lst) do
|
||||
if (i and idx) then
|
||||
if not (ini:line_exist("exclusive",i)) then
|
||||
local se = idx and tonumber(idx.id) and alife():object(tonumber(idx.id))
|
||||
if (se and idx.sec and string.find(se:name(),idx.sec)) then
|
||||
--printf("GhenTuong: dynamic_object delete %s [%s]",se.id,se:name())
|
||||
alife_release(se)
|
||||
end
|
||||
lst[i] = nil
|
||||
end
|
||||
else
|
||||
lst[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
--[[
|
||||
if not (ini:section_exist("exclusive") and ini:line_exist("exclusive",i)) then
|
||||
return
|
||||
end
|
||||
|
||||
local v = ini:r_string_ex("exclusive",i)
|
||||
--]]
|
||||
|
||||
function get_object_config(v)
|
||||
local str = v and str_explode(v,"|")
|
||||
local sec = str[1] and (str[1] ~= "") and (str[1] ~= "nil") and tostring(str[1])
|
||||
|
||||
local tp = str[2] and str_explode(str[2],",") or nil
|
||||
local td = str[3] and str_explode(str[3],",") or nil
|
||||
local pox = tp and tonumber(tp[1])
|
||||
local poy = tp and tonumber(tp[2])
|
||||
local poz = tp and tonumber(tp[3])
|
||||
local rox = td and tonumber(td[1]) and math.rad(tonumber(td[1]))
|
||||
local roy = td and tonumber(td[2]) and math.rad(tonumber(td[2]))
|
||||
local roz = td and tonumber(td[3]) and math.rad(tonumber(td[3]))
|
||||
local con = str[4] or "nil"
|
||||
|
||||
if not (pox and poy and poz and rox and roy and roz and con) then
|
||||
return
|
||||
end
|
||||
return {sec = sec, pos = vector():set(pox,poy,poz), ang = vector():set(rox,roy,roz), con = con}
|
||||
end
|
||||
|
||||
function get_object(smart_name,index)
|
||||
local idx = dynamic_object_storage_loaded and dynamic_object_storage[smart_name] and dynamic_object_storage[smart_name][index]
|
||||
return idx and {id = tonumber(idx.id),sec = tostring(idx.sec)}
|
||||
end
|
||||
|
||||
function save_state(m_data)
|
||||
m_data.xr_dynamic_object_storage = dynamic_object_storage
|
||||
end
|
||||
|
||||
function load_state(m_data)
|
||||
dynamic_object_storage = m_data.xr_dynamic_object_storage or {}
|
||||
end
|
||||
|
||||
function on_game_start()
|
||||
RegisterScriptCallback("save_state",save_state)
|
||||
RegisterScriptCallback("load_state",load_state)
|
||||
end
|
||||
Reference in New Issue
Block a user