72 lines
1.9 KiB
Plaintext
72 lines
1.9 KiB
Plaintext
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 |