Divergent/mods/Redone Pripyat and Juipiter/gamedata/scripts/redone_lc_jup_transition_zo...

83 lines
2.3 KiB
Plaintext

function actor_on_first_update()
local lc_pool = {
["lc_jupiter01_to_limansk01"] = {
pos = vector():set(-226,21,-497),
smart = "jup_sim_2",
spot = "level_changer_down_left",
hint = "space_restrictor_to_limansk_desc",
},
["lc_jupiter01_to_limansk01.1"] = {
pos = vector():set(-206,3,-426),
smart = "jup_sim_2",
spot = "level_changer_spot_mini",
hint = "space_restrictor_to_limansk_desc",
},
["lc_limansk01_to_jupiter01"] = {
pos = vector():set(1,-4,-136),
smart = "lim_smart_terrain_4",
spot = "level_changer_right",
hint = "space_restrictor_to_jupiter_desc",
}
}
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_jupiter01_to_limansk01"] = {
pos = vector():set(-2.5950,-5.0593,-130.5251),
w_p = vector():set(-208.8593,3.3455,-421.7572),
smart = "lim_smart_terrain_4",
},
["lc_jupiter01_to_limansk01.1"] = {
pos = vector():set(-2.5950,-5.0593,-130.5251),
w_p = vector():set(-208.8593,3.3455,-421.7572),
smart = "lim_smart_terrain_4",
},
["lc_limansk01_to_jupiter01"] = {
pos = vector():set(-208.8593,3.3455,-421.7572),
w_p = vector():set(-2.5950,-5.0593,-130.5251),
smart = "jup_sim_2",
},
}
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