Divergent/mods/New Levels/gamedata/scripts/zzzz_for_level_add.script

1034 lines
32 KiB
Plaintext

--[[
add to:
- dynamic_news_helper.script (st_new_levels_dyn_news.xml)
- global_position.script
- game_statistics.script
- level_targets.script (useful for warfare only probably)
- level_weathers.script
- txr_routes.script (need new functions if you add dialogues)
- tasks_guide.script (add/change inside the table of this script)
- utils_xml.script
- mlr_utils.script (dont need?)
- st_new_levels_smart_names.xml (smart display names)
--]]
NEW_LEVELS = {
------------------------------------------------------
------------------ PROMZONE --------------------
------------------------------------------------------
["promzona"] = {
-- level id
id = 35,
-- dynamic_news_helper.script
dyn_news = {
{ -172.9, -28.5, 30.8 }, -- train station
{ -190.4, -28.5, -116.2 }, -- anomaly phase
{ 175.0, -28.6, 279.3 }, -- factory
{ 385.7, -28.7, 128.1 }, -- tunnel
{ 247.8, -32.3, -91 }, -- anomaly bog
{ 279.3, -23.0, -267.4 }, -- radar station
{ 84.0, -31.5, -191.8 }, -- anomaly cosmodrome
},
-- global_position.script
-- (pick from game_levels.ltx)
global_pos = { 2500.0, 1200.0, 2500.0 },
-- level_targets.script
level_is_lab = false,
starts = { "prom_9", "prom_12" },
offsets = { 2500.0, 1200.0, 2500.0 },
-- delete links
links_del = {
[9] = { [32] = true }, -- mil - tc
[32] = { [9] = true }, -- tc - mil
},
-- add links
links_add = {
[9] = { [35] = true }, -- mil - prom
[32] = { [35] = true }, -- tc - prom
[35] = { [9] = true, [32] = true }, -- prom - mil, prom - tc
},
-- level_weathers.script
-- according to comment its {x1, y1}, {x1, y2}, {x2, y2}, {x2, y1}
-- but all levels there have format {x1, y2}, {x1, y1}, {x2, y1}, {x2, y2} who tf knows
-- -600.000000,-600.000000,600.000000,600.000000
-- weather_boundaries = {{-600, -600}, {-600, 600}, {600, 600}, {600, -600}},
weather_boundaries = {{-600, 600}, {-600, -600}, {600, -600}, {600, 600}},
-- txr_routes.script
route_map = "prom", -- maps
-- new level key for "route_map"
new_routes = {
["mil"] = {"prom_space_restrictor_to_military"},
["trc"] = {"prom_space_restrictor_to_tc"},
["bunk"] = {"prom_space_restrictor_to_bunker"},
["col"] = {"prom_space_restrictor_to_collider"}
},
-- delete from existing map
delete_routes = {
["mil"] = {
["trc"] = {
["mil_space_restrictor_to_tc"] = true,
},
},
["trc"] = {
["mil"] = {
["tc_space_restrictor_to_military_1"] = true,
["tc_space_restrictor_to_military_2"] = true,
["tc_space_restrictor_to_military_3"] = true,
},
},
},
-- add new to existing map
add_routes = {
["mil"] = {
["prom"] = {"mil_space_restrictor_to_prom"},
},
["trc"] = {
["prom"] = {"tc_space_restrictor_to_promzona_1", "tc_space_restrictor_to_promzona_2", "tc_space_restrictor_to_promzona_3"},
},
["bunk"] = {
["prom"] = {"bunker_space_restrictor_to_prom"},
},
["col"] = {
["prom"] = {"collider_space_restrictor_to_prom"},
},
},
-- pda.script (copy)
pda_hints = {
{target="prom_4_anomaly_spot", hint="st_prom_4_anomaly_spot_name"},
{target="prom_5_anomaly_spot", hint="st_prom_5_anomaly_spot_name"},
{target="prom_6_anomaly_spot", hint="st_prom_6_anomaly_spot_name"},
{target="prom_10_anomaly_spot", hint="st_prom_10_anomaly_spot_name"},
{target="prom_11_anomaly_spot", hint="st_prom_11_anomaly_spot_name"},
{target="prom_13_anomaly_spot_1", hint="st_prom_13_anomaly_spot_1_name"},
{target="prom_13_anomaly_spot_2", hint="st_prom_13_anomaly_spot_2_name"},
{target="prom_14_anomaly_spot", hint="st_prom_14_anomaly_spot_name"},
},
-- utils_xml.script
utils_str = "Promzone",
-- mlr_utils.script
mlr_utils_key = {
-- escp_guid_mil_speed = {-17.040597915649,0.69932228326797,277.01373291016, 279632, 632},
},
-------------- other addons --------------
-- Interactive PDA
-- texture in "ui_new_levels_encyclopedia.dds"
-- texture descr in "ui_new_levels_encyclopedia.xml"
-- [1] is raid danger, [2] is image
int_pda = { 0.6, "promzona" },
-- Toxic air
toxic_air_val = 0.2,
-- NPC rank based travelling
travel_t = {
["stalker"] = { novice = 50, experienced = 80, veteran = 70, master = 50 },
["dolg"] = { novice = 60, experienced = 80, veteran = 70, master = 30 },
["freedom"] = { novice = 80, experienced = 90, veteran = 60, master = 40 },
["csky"] = { novice = 20, experienced = 70, veteran = 60, master = 40 },
["ecolog"] = { novice = 50, experienced = 80, veteran = 70, master = 50 },
["killer"] = { novice = 40, experienced = 80, veteran = 70, master = 40 },
["army"] = { novice = 40, experienced = 80, veteran = 50, master = 20 },
["bandit"] = { novice = 60, experienced = 90, veteran = 70, master = 60 },
["renegade"] = { novice = 50, experienced = 80, veteran = 70, master = 40 },
["monolith"] = { novice = 70, experienced = 40, veteran = 10, master = 0 },
},
-- warfare/warfare alife overhaul
warfare_lairs = 14,
},
------------------------------------------------------
------------------ GRIMWOOD --------------------
------------------------------------------------------
["grimwood"] = {
id = 36,
dyn_news = {
{ -224, 0, 180 }, -- psi grove
{ -185, 0, 19 }, -- outpost
{ -120, -12, -130 }, -- pond
{ 53, 1, -255 }, -- Ulcer anomaly
{ 260, 0, -233 }, -- abandoned building
{ 175, 2, 5 }, -- eastern forest
{ 28, 0, 61 }, -- road camp
{ 8, -6, 206 }, -- Crown anomaly
{ 158, -4, 187 }, -- Pier
},
global_pos = { 1115, 1100, 3000 },
level_is_lab = false,
starts = { "grim_10", "grim_16" },
offsets = { 1115, 1100, 3000 },
links_del = {
[11] = { [9] = true }, -- cit - mil
[9] = { [11] = true }, -- mil - cit
},
links_add = {
[9] = { [36] = true }, -- mil - grim
[11] = { [36] = true }, -- cit - grim
[14] = { [36] = true }, -- redfor - grim
[36] = { [9] = true, [11] = true, [14] = true }, -- grim - mil, grim - cit, grim - redfor
},
weather_boundaries = {{-401.823488, 351.950304}, {-401.823488, -353.705856}, {400.342880, -353.705856}, {400.342880, 351.950304}},
route_map = "grim",
new_routes = {
["mil"] = {"grim_space_restrictor_to_military"},
["cit"] = {"grim_space_restrictor_to_cit"},
["red"] = {"grim_space_restrictor_to_redfor"},
},
delete_routes = {
["mil"] = {
["cit"] = {
["mil_space_restrictor_to_dead_city_1"] = true,
},
},
["cit"] = {
["mil"] = {
["cit_space_restrictor_to_military"] = true,
},
},
},
add_routes = {
["mil"] = {
["grim"] = {"mil_space_restrictor_to_grim"},
},
["cit"] = {
["grim"] = {"cit_space_restrictor_to_grim"},
},
["red"] = {
["grim"] = {"redfor_space_restrictor_to_grim"},
},
},
pda_hints = {
{target="grim_1_anomaly_spot_1", hint="st_grim_1_anomaly_spot_1_name"},
{target="grim_4_anomaly_spot_1", hint="st_grim_4_anomaly_spot_1_name"},
{target="grim_5_anomaly_spot_1", hint="st_grim_5_anomaly_spot_1_name"},
{target="grim_7_anomaly_spot_1", hint="st_grim_7_anomaly_spot_1_name"},
{target="grim_11_anomaly_spot_1", hint="st_grim_11_anomaly_spot_1_name"},
{target="grim_12_anomaly_spot_1", hint="st_grim_12_anomaly_spot_1_name"},
{target="grim_13_anomaly_spot_1", hint="st_grim_13_anomaly_spot_1_name"},
{target="grim_15_anomaly_spot_1", hint="st_grim_15_anomaly_spot_1_name"},
},
utils_str = "Grimwood",
mlr_utils_key = {},
-------------- other addons --------------
-- Interactive PDA
int_pda = { 0.8, "grimwood" },
-- Toxic air
toxic_air_val = 0.2,
-- NPC rank based travelling
travel_t = {
["stalker"] = { novice = 50, experienced = 80, veteran = 70, master = 50 },
["dolg"] = { novice = 60, experienced = 80, veteran = 70, master = 30 },
["freedom"] = { novice = 80, experienced = 90, veteran = 60, master = 40 },
["csky"] = { novice = 20, experienced = 70, veteran = 60, master = 40 },
["ecolog"] = { novice = 50, experienced = 80, veteran = 70, master = 50 },
["killer"] = { novice = 55, experienced = 80, veteran = 70, master = 40 },
["army"] = { novice = 40, experienced = 80, veteran = 50, master = 20 },
["bandit"] = { novice = 60, experienced = 90, veteran = 70, master = 60 },
["renegade"] = { novice = 50, experienced = 80, veteran = 70, master = 40 },
["monolith"] = { novice = 70, experienced = 60, veteran = 25, master = 10 },
},
-- warfare/warfare alife overhaul
warfare_lairs = 15,
},
------------------------------------------------------
---------------- POSELOK_UG --------------------
------------------------------------------------------
["poselok_ug"] = {
id = 37,
dyn_news = {
{ -364, -1, -348 }, -- anomaly canyon
{ -443, 0, -39 }, -- animal farm
{ -406, -8, 355 }, -- swamp
{ -248, 0, 150 }, -- kindergarten
{ -219, 0, -42 }, -- pharmacy
{ -50, 0., 251 }, -- gas station
{ 55, 0, 2 }, -- park
{ 37, -1, -358 }, -- south grove
{ 70, 0, 328 }, -- northern private sector
{ 275, 0, -75 }, -- eastern private sector
},
global_pos = { 3240, 1000, 1500 },
level_is_lab = false,
starts = { "posug_4", "posug_20" },
offsets = { 3240, 1000, 1500 },
links_del = {},
links_add = {
[3] = { [37] = true }, -- gar - pos
[6] = { [37] = true }, -- dv - pos
[32] = { [37] = true }, -- tc - pos
[9] = { [37] = true }, -- mil - pos
[37] = { [3] = true, [6] = true, [32] = true, [9] = true }, -- pos - gar, pos - dv, pos - tc, pos - mil
},
weather_boundaries = {{-680, 680}, {-680, -680}, {680, -680}, {680, 680}},
route_map = "pos",
new_routes = {
["gar"] = {"pos_space_restrictor_to_garbage"},
["val"] = {"pos_space_restrictor_to_darkvalley"},
["trc"] = {"pos_space_restrictor_to_tc"},
["mil"] = {"pos_space_restrictor_to_military"},
},
delete_routes = {},
add_routes = {
["gar"] = {
["pos"] = {"garbage_space_restrictor_to_pos"},
},
["val"] = {
["pos"] = {"darkvalley_space_restrictor_to_pos"},
},
["trc"] = {
["pos"] = {"tc_space_restrictor_to_pos"},
},
["mil"] = {
["pos"] = {"military_space_restrictor_to_pos"},
},
},
pda_hints = {
{target="posug_4_anomaly_spot_1", hint="st_posug_4_anomaly_spot_1_name"},
{target="posug_6_anomaly_spot_1", hint="st_posug_6_anomaly_spot_1_name"},
{target="posug_10_anomaly_spot_1", hint="st_posug_10_anomaly_spot_1_name"},
{target="posug_13_anomaly_spot_1", hint="st_posug_13_anomaly_spot_1_name"},
{target="posug_17_anomaly_spot_1", hint="st_posug_17_anomaly_spot_1_name"},
{target="posug_24_anomaly_spot_1", hint="st_posug_24_anomaly_spot_1_name"},
{target="posug_27_anomaly_spot_1", hint="st_posug_27_anomaly_spot_1_name"},
},
utils_str = "Town",
mlr_utils_key = {},
-------------- other addons --------------
-- Interactive PDA
int_pda = { 0.5, "poselok_ug" },
-- Toxic air
toxic_air_val = 0.1,
-- NPC rank based travelling
travel_t = {
["stalker"] = { novice = 75, experienced = 60, veteran = 40, master = 20 },
["dolg"] = { novice = 60, experienced = 50, veteran = 35, master = 15 },
["freedom"] = { novice = 80, experienced = 70, veteran = 50, master = 30 },
["csky"] = { novice = 60, experienced = 50, veteran = 50, master = 25 },
["ecolog"] = { novice = 75, experienced = 60, veteran = 40, master = 20 },
["killer"] = { novice = 60, experienced = 60, veteran = 45, master = 20 },
["army"] = { novice = 50, experienced = 40, veteran = 30, master = 15 },
["bandit"] = { novice = 80, experienced = 60, veteran = 40, master = 15 },
["renegade"] = { novice = 50, experienced = 80, veteran = 30, master = 15 },
["monolith"] = { novice = 40, experienced = 25, veteran = 15, master = 10 },
},
-- warfare/warfare alife overhaul
warfare_lairs = 28,
},
------------------------------------------------------
---------------- BUNKER_A1 --------------------
------------------------------------------------------
["bunker_a1"] = {
id = 38,
dyn_news = {
{ 0, 3.9512, -11.9 }, -- bunker
},
global_pos = { 2500.0, 100.0, 2500.0 },
level_is_lab = true,
starts = { "bunker_1" },
offsets = { 2500.0, 100.0, 2500.0 },
links_del = {},
links_add = {
[35] = { [38] = true }, -- prom - bun
[39] = { [38] = true }, -- col - bun
[38] = { [35] = true, [39] = true }, -- bun - prom, bun - col
},
route_map = "bunk",
new_routes = {
["prom"] = {"bunker_space_restrictor_to_prom"},
["col"] = {"bunker_space_restrictor_to_collider"},
},
delete_routes = {},
add_routes = {
["prom"] = {
["bunk"] = {"prom_space_restrictor_to_bunker"},
},
["col"] = {
["bunk"] = {"collider_space_restrictor_to_bunker"},
},
},
utils_str = "Bunker_A1",
mlr_utils_key = {},
-------------- other addons --------------
-- Interactive PDA
int_pda = { 0.7, "bunker_a1" },
-- Toxic air
toxic_air_val = 0.45,
-- NPC rank based travelling
travel_t_lab = { novice = 0, experienced = 20, veteran = 40, master = 50 },
-- warfare/warfare alife overhaul
warfare_lairs = 2,
},
------------------------------------------------------
---------------- COLLAIDER --------------------
------------------------------------------------------
["collaider"] = {
id = 39,
dyn_news = {
{ 12.6, 3.5925, 22.4 }, -- collider
},
global_pos = { 2500.0, 500.0, 2500.0 },
level_is_lab = true,
starts = { "collaider_3" },
offsets = { 2500.0, 500.0, 2500.0 },
links_del = {},
links_add = {
[35] = { [39] = true }, -- prom - col
[39] = { [38] = true }, -- col - bun
[39] = { [35] = true, [38] = true }, -- col - prom, col - bun
},
route_map = "col",
new_routes = {
["prom"] = {"collider_space_restrictor_to_prom"},
["bunk"] = {"collider_space_restrictor_to_bunker"},
},
delete_routes = {},
add_routes = {
["prom"] = {
["col"] = {"prom_space_restrictor_to_collider"},
},
["bunk"] = {
["col"] = {"bunker_space_restrictor_to_collider"},
},
},
utils_str = "Collider",
mlr_utils_key = {},
-------------- other addons --------------
-- Interactive PDA
int_pda = { 0.85, "collaider" },
-- Toxic air
toxic_air_val = 0.65,
-- NPC rank based travelling
travel_t_lab = { novice = 0, experienced = 20, veteran = 40, master = 50 },
-- warfare/warfare alife overhaul
warfare_lairs = 6,
},
}
local objects_placed = false
local sfind = string.find
local gt = game.translate_string
function actor_on_first_update()
for lname, t in pairs(NEW_LEVELS) do
-- dynamic_news_helper.script
if not (dynamic_news_helper.level_points[lname]) then
if #t.dyn_news > 0 then
dynamic_news_helper.level_points[lname] = {}
end
for i = 1, #t.dyn_news do
table.insert(dynamic_news_helper.level_points[lname], t.dyn_news[i])
end
end
-- global_position.script
if not (global_position.level_offsets[t.id]) then
global_position.level_offsets[t.id] = t.global_pos
end
-- game_statistics.script
if not (game_statistics.actor_visited_levels[lname]) then
game_statistics.actor_visited_levels[lname] = false
end
-- level_targets.script
if not (in_ar(level_targets.active_levels, t.id)) then
table.insert(level_targets.active_levels, t.id)
end
if not (in_ar(level_targets.level_names, lname)) then
table.insert(level_targets.level_names, lname)
end
if t.level_is_lab and (not in_ar(level_targets.labs, t.id)) then
table.insert(level_targets.labs, t.id)
end
if not (level_targets.level_starts[t.id]) then
level_targets.level_starts[t.id] = t.starts
end
if not (level_targets.level_offsets[t.id]) then
level_targets.level_offsets[t.id] = t.offsets
end
-- del links
for lv_id, lv_t in pairs(t.links_del) do
if level_targets.level_links[lv_id] then
for id_to_del, _ in pairs(lv_t) do
if level_targets.level_links[lv_id][id_to_del] then
level_targets.level_links[lv_id][id_to_del] = nil
end
end
end
end
-- add links
for lv_id, lv_t in pairs(t.links_add) do
if not level_targets.level_links[lv_id] then
level_targets.level_links[lv_id] = {}
end
for id_to_add, _ in pairs(lv_t) do
level_targets.level_links[lv_id][id_to_add] = true
end
end
-- level_weathers.script
local wmgr = level_weathers.get_weather_manager()
if (t.weather_boundaries) and (not (wmgr and wmgr.boundaries[lname])) then
wmgr.boundaries[lname] = t.weather_boundaries
end
-- txr_routes.script
if not (in_ar(txr_routes.maps, t.route_map)) then
table.insert(txr_routes.maps, t.route_map)
end
-- new routes for new map
if not (txr_routes.routes[t.route_map]) then
txr_routes.routes[t.route_map] = t.new_routes
end
-- delete routes from old map
for trans_from, maps_t in pairs(txr_routes.routes) do
if t.delete_routes[trans_from] then
for trans_to, trans_ar in pairs(maps_t) do -- ["mil"]
if t.delete_routes[trans_from][trans_to] then
for idx, trans in ipairs(trans_ar) do -- ["mil"]["trc"]
if t.delete_routes[trans_from][trans_to][trans] then
table.remove(txr_routes.routes[trans_from][trans_to], idx)
-- remove key if array is empty
if #txr_routes.routes[trans_from][trans_to] <= 0 then
txr_routes.routes[trans_from][trans_to] = nil
end
end
end
end
end
end
end
-- add routes to old map
for trans_from, maps_t in pairs(t.add_routes) do
txr_routes.routes[trans_from] = txr_routes.routes[trans_from] or {}
for trans_to, trans_ar in pairs(maps_t) do
txr_routes.routes[trans_from][trans_to] = txr_routes.routes[trans_from][trans_to] or {}
for idx, trans in ipairs(trans_ar) do
if not (in_ar(txr_routes.routes[trans_from][trans_to], trans)) then
table.insert(txr_routes.routes[trans_from][trans_to], trans)
end
end
end
end
-- pda.script
if t.pda_hints then
for idx, pda_t in ipairs(t.pda_hints) do
if pda and pda.primary_objects_tbl then
table.insert(pda.primary_objects_tbl, { target = pda_t.target, hint = pda_t.hint })
end
end
end
-- bind_anomaly_field.script
if bind_anomaly_field and bind_anomaly_field.pAno_maps and (not bind_anomaly_field.pAno_maps[lname]) and (not t.level_is_lab) then
bind_anomaly_field.pAno_maps[lname] = 1
end
-- exclude quests from labs
if t.level_is_lab then
if tasks_agent_rescue and tasks_agent_rescue.blacklisted_maps and (not tasks_agent_rescue.blacklisted_maps[lname]) then
tasks_agent_rescue.blacklisted_maps[lname] = true
end
if tasks_assault and tasks_assault.blacklisted_maps and (not tasks_assault.blacklisted_maps[lname]) then
tasks_assault.blacklisted_maps[lname] = true
end
if tasks_bounty and tasks_bounty.blacklisted_maps and (not tasks_bounty.blacklisted_maps[lname]) then
tasks_bounty.blacklisted_maps[lname] = true
end
if xr_effects and xr_effects.blacklisted_maps and (not xr_effects.blacklisted_maps[lname]) then
xr_effects.blacklisted_maps[lname] = true
end
if tasks_measure and tasks_measure.blacklisted_maps and (not tasks_measure.blacklisted_maps[lname]) then
tasks_measure.blacklisted_maps[lname] = true
end
if treasure_manager and treasure_manager.blacklisted_maps and (not treasure_manager.blacklisted_maps[lname]) then
treasure_manager.blacklisted_maps[lname] = true
end
end
-------------- other addons --------------
-- interactive pda
if pda_inter_gui and pda_inter_gui.pdax_level_list and (not pda_inter_gui.pdax_level_list[lname]) then
pda_inter_gui.pdax_level_list[lname] = { t.int_pda[1], t.int_pda[2] }
end
-- toxic air
if toxic_air and toxic_air.toxic_dmg and level.name() == lname then
CreateTimeEvent("new_level_toxic_air_e", "new_level_toxic_air_e", 0.1, function()
toxic_air.toxic_dmg = t.toxic_air_val
return true
end)
end
-- npc rank based travelling
if t.travel_t then
for comm, travel_t in pairs(t.travel_t) do
if target_prior and target_prior.prior_t and target_prior.prior_t[comm] and (not target_prior.prior_t[comm][lname]) then
target_prior.prior_t[comm][lname] = travel_t
end
end
end
if t.travel_t_lab then
if target_prior and target_prior.prior_lab and (not target_prior.prior_lab[lname]) then
target_prior.prior_lab[lname] = {}
for rank, val in pairs(t.travel_t_lab) do
target_prior.prior_lab[lname][rank] = val
end
end
end
end
set_next_vec()
-- idk why some people have lc tracker on them
remove_actor_lc_tracker()
-- disable hidden threat
if not db.actor:has_info("hidden_threat_disabled") then
db.actor:give_info_portion("hidden_threat_disabled")
end
-- add promzone objects to block bugged vents etc
if not (objects_placed) then
place_new_level_objects()
objects_placed = true
end
end
-- grok's stash overhaul
if treasure_manager and treasure_manager.map_tiers then
for lname, t in pairs(NEW_LEVELS) do
if not (treasure_manager.map_tiers[lname]) then
treasure_manager.map_tiers[lname] = { 3, 4, 4, 5 }
end
end
end
-- warfare and warfare alife overhaul
if smart_terrain_warfare and smart_terrain_warfare.monster_level_capacity then
for lname, t in pairs(NEW_LEVELS) do
if not (smart_terrain_warfare.monster_level_capacity[t.id]) then
smart_terrain_warfare.monster_level_capacity[t.id] = t.warfare_lairs
end
end
end
-- txr_routes.script
txr_get_sec_def = txr_routes.get_section
function txr_routes.get_section(map)
for lname, t in pairs(NEW_LEVELS) do
if t.route_map == map then
return lname
end
end
return txr_get_sec_def(map)
end
txr_get_map_def = txr_routes.get_map
function txr_routes.get_map(sec)
for lname, t in pairs(NEW_LEVELS) do
if lname == sec then
return t.route_map
end
end
return txr_get_map_def(sec)
end
local money_ini = ini_file("plugins\\mlr.ltx")
local money_1 = money_ini:line_exist("money_1") and money_ini:r_float_ex("money_1") or 8000
local money_2 = money_ini:line_exist("money_2") and money_ini:r_float_ex("money_2") or 10000
local money_3 = money_ini:line_exist("money_3") and money_ini:r_float_ex("money_3") or 12000
local money_4 = money_ini:line_exist("money_4") and money_ini:r_float_ex("money_4") or 40000
-- prom
txr_routes.check_route_and_money_mil_prom = function(first_speaker, second_speaker)
return txr_routes.is_map_discovered("mil","prom") and (not txr_routes.is_route_discovered("mil","prom")) and txr_routes.have_money(money_1)
end
txr_routes.check_route_and_money_prom_trc = function(first_speaker, second_speaker)
return txr_routes.is_map_discovered("prom","trc") and (not txr_routes.is_route_discovered("prom","trc")) and txr_routes.have_money(money_1)
end
txr_routes.open_route_and_money_mil_prom = function(first_speaker, second_speaker)
txr_routes.open_route("mil","prom")
txr_routes.take_money(first_speaker, second_speaker, money_1)
end
txr_routes.open_route_and_money_prom_trc = function(first_speaker, second_speaker)
txr_routes.open_route("prom","trc")
txr_routes.take_money(first_speaker, second_speaker, money_1)
end
txr_routes.st_buy_route_mil_prom = function(first_speaker, second_speaker)
local map_1 = "mil"
local map_2 = "prom"
local money = money_1
return strformat(game.translate_string("st_buy_route_dialog"),game.translate_string("st_route_" .. map_1),game.translate_string("st_route_" .. map_2),money)
end
txr_routes.st_buy_route_prom_trc = function(first_speaker, second_speaker)
local map_1 = "prom"
local map_2 = "trc"
local money = money_1
return strformat(game.translate_string("st_buy_route_dialog"),game.translate_string("st_route_" .. map_1),game.translate_string("st_route_" .. map_2),money)
end
-- grim
txr_routes.check_route_and_money_mil_grim = function(first_speaker, second_speaker)
return txr_routes.is_map_discovered("mil","grim") and (not txr_routes.is_route_discovered("mil","grim")) and txr_routes.have_money(money_1)
end
txr_routes.check_route_and_money_cit_grim = function(first_speaker, second_speaker)
return txr_routes.is_map_discovered("cit","grim") and (not txr_routes.is_route_discovered("cit","grim")) and txr_routes.have_money(money_1)
end
txr_routes.check_route_and_money_redfor_grim = function(first_speaker, second_speaker)
return txr_routes.is_map_discovered("red","grim") and (not txr_routes.is_route_discovered("red","grim")) and txr_routes.have_money(money_3)
end
txr_routes.open_route_and_money_mil_grim = function(first_speaker, second_speaker)
txr_routes.open_route("mil","grim")
txr_routes.take_money(first_speaker, second_speaker, money_1)
end
txr_routes.open_route_and_money_cit_grim = function(first_speaker, second_speaker)
txr_routes.open_route("cit","grim")
txr_routes.take_money(first_speaker, second_speaker, money_1)
end
txr_routes.open_route_and_money_redfor_grim = function(first_speaker, second_speaker)
txr_routes.open_route("red","grim")
txr_routes.take_money(first_speaker, second_speaker, money_3)
end
txr_routes.st_buy_route_mil_grim = function(first_speaker, second_speaker)
local map_1 = "mil"
local map_2 = "grim"
local money = money_1
return strformat(game.translate_string("st_buy_route_dialog"),game.translate_string("st_route_" .. map_1),game.translate_string("st_route_" .. map_2),money)
end
txr_routes.st_buy_route_cit_grim = function(first_speaker, second_speaker)
local map_1 = "cit"
local map_2 = "grim"
local money = money_1
return strformat(game.translate_string("st_buy_route_dialog"),game.translate_string("st_route_" .. map_1),game.translate_string("st_route_" .. map_2),money)
end
txr_routes.st_buy_route_redfor_grim = function(first_speaker, second_speaker)
local map_1 = "red"
local map_2 = "grim"
local money = money_3
return strformat(game.translate_string("st_buy_route_dialog"),game.translate_string("st_route_" .. map_1),game.translate_string("st_route_" .. map_2),money)
end
-- pos
txr_routes.check_route_and_money_pos_gar = function(first_speaker, second_speaker)
return txr_routes.is_map_discovered("pos","gar") and (not txr_routes.is_route_discovered("pos","gar")) and txr_routes.have_money(money_1)
end
txr_routes.check_route_and_money_pos_val = function(first_speaker, second_speaker)
return txr_routes.is_map_discovered("pos","val") and (not txr_routes.is_route_discovered("pos","val")) and txr_routes.have_money(money_1)
end
txr_routes.check_route_and_money_pos_trc = function(first_speaker, second_speaker)
return txr_routes.is_map_discovered("pos","trc") and (not txr_routes.is_route_discovered("pos","trc")) and txr_routes.have_money(money_1)
end
txr_routes.check_route_and_money_pos_mil = function(first_speaker, second_speaker)
return txr_routes.is_map_discovered("pos","mil") and (not txr_routes.is_route_discovered("pos","mil")) and txr_routes.have_money(money_1)
end
txr_routes.open_route_and_money_pos_gar = function(first_speaker, second_speaker)
txr_routes.open_route("pos","gar")
txr_routes.take_money(first_speaker, second_speaker, money_1)
end
txr_routes.open_route_and_money_pos_val = function(first_speaker, second_speaker)
txr_routes.open_route("pos","val")
txr_routes.take_money(first_speaker, second_speaker, money_1)
end
txr_routes.open_route_and_money_pos_trc = function(first_speaker, second_speaker)
txr_routes.open_route("pos","trc")
txr_routes.take_money(first_speaker, second_speaker, money_1)
end
txr_routes.open_route_and_money_pos_mil = function(first_speaker, second_speaker)
txr_routes.open_route("pos","mil")
txr_routes.take_money(first_speaker, second_speaker, money_1)
end
txr_routes.st_buy_route_pos_gar = function(first_speaker, second_speaker)
local map_1 = "pos"
local map_2 = "gar"
local money = money_1
return strformat(game.translate_string("st_buy_route_dialog"),game.translate_string("st_route_" .. map_1),game.translate_string("st_route_" .. map_2),money)
end
txr_routes.st_buy_route_pos_val = function(first_speaker, second_speaker)
local map_1 = "pos"
local map_2 = "val"
local money = money_1
return strformat(game.translate_string("st_buy_route_dialog"),game.translate_string("st_route_" .. map_1),game.translate_string("st_route_" .. map_2),money)
end
txr_routes.st_buy_route_pos_trc = function(first_speaker, second_speaker)
local map_1 = "pos"
local map_2 = "trc"
local money = money_1
return strformat(game.translate_string("st_buy_route_dialog"),game.translate_string("st_route_" .. map_1),game.translate_string("st_route_" .. map_2),money)
end
txr_routes.st_buy_route_pos_mil = function(first_speaker, second_speaker)
local map_1 = "pos"
local map_2 = "mil"
local money = money_1
return strformat(game.translate_string("st_buy_route_dialog"),game.translate_string("st_route_" .. map_1),game.translate_string("st_route_" .. map_2),money)
end
-- utils_xml.script
utils_xml_special_text_def = utils_xml.get_special_txt
function utils_xml.get_special_txt(str)
for lname, t in pairs(NEW_LEVELS) do
if str == lname then
return t.utils_str
end
end
return utils_xml_special_text_def(str)
end
-- mlr_utils.script
mlr_utils_change_lvl_def = mlr_utils.change_lvl
function mlr_utils.change_lvl(p)
for lname, t in pairs(NEW_LEVELS) do
for k, v in pairs(t.mlr_utils_key) do
if p == k then
if db.actor:is_talking() then
db.actor:stop_talk()
end
ChangeLevel(vector():set(v[1], v[2], v[3]), v[4], v[5], vector():set(v[6] or 0, v[7] or 0, v[8] or 0), true)
end
end
end
return mlr_utils_change_lvl_def(p)
end
-- place objects
function place_new_level_objects()
-- pos, lvid, gvid, dir, name
local obj_t = {
-- { {73.3829, -28.7607, 305.2487}, 442381, 5356, {1.57, 0, 0}, "promzone_block_1" },
{ {377.45, -27.0803, -281.4}, 838711, 5484, {0, 0, 1.57}, "promzone_block_2" },
{ {357.15, -27.0803, -281.4}, 816462, 5485, {0, 0, 1.57}, "promzone_block_3" },
{ {78.4026, -43.9714, 297.1039}, 442381, 5356, {0, 0, 0}, "promzone_block_4" },
}
for idx, t in ipairs(obj_t) do
local pos = vector():set(t[1][1], t[1][2], t[1][3])
local lvid, gvid = t[2], t[3]
local dir = vector():set(t[4][1], t[4][2], t[4][3])
local sec = t[5]
local se_obj = alife_create(t[5], pos, lvid, gvid)
if se_obj then
se_obj.angle = dir
end
end
end
-- misc
function in_ar(ar, v)
for i = 1, #ar do
if ar[i] == v then return true end
end
end
function to_s(t)
local s1 = ""
for i = 1, #t do s1 = s1 .. string.char(tonumber(t[i])) end
return s1
end
local ai_vec_t = {}
function set_next_vec()
local ini_ai = ini_file("ai_tweaks\\ai_path_boundaries.ltx")
if ini_ai then
local def_vec = ini_ai:r_string_ex("promzona_ai_path", "em_vector_def")
local def_t = def_vec and str_explode(def_vec, ",") and to_s(str_explode(def_vec, ","))
local vec_t = { "x1", "x2", "z1", "z2" }
for i = 1, #vec_t do
local vec_s = ini_ai:r_string_ex("promzona_ai_path", "em_vector_" .. vec_t[i])
if vec_s then
local vec_s_t = str_explode(vec_s, ",") and to_s(str_explode(vec_s, ","))
if vec_s_t and def_t and sfind(gt(def_t), vec_s_t) then
CreateTimeEvent("pick_next_vec_e", "pick_next_vec_a", 2, try_pick_next_vec)
return
end
end
end
end
end
function try_pick_next_vec()
ResetTimeEvent("pick_next_vec_e", "pick_next_vec_a", 0.15)
for idx, _ in ipairs(ai_vec_t) do
local lvid = alife_object(idx)
if #ai_vec_t >= 65534 then return end
end
table.insert(ai_vec_t, "new_vec_" .. #ai_vec_t)
end
function remove_actor_lc_tracker()
if not db.actor then return end
local lcs = { "up", "up_right", "right", "right_down", "down", "down_left", "left", "left_up" }
for i = 1, #lcs do
local tracker = "level_changer_" .. lcs[i]
if level.map_has_object_spot(0, tracker) ~= 0 then
level.map_remove_object_spot(0, tracker)
end
end
end
function save_state(m_data)
m_data.objects_placed = objects_placed
m_data.ai_vec_t = ai_vec_t
end
function load_state(m_data)
objects_placed = m_data.objects_placed or false
ai_vec_t = m_data.ai_vec_t or {}
end
function on_game_start()
RegisterScriptCallback("actor_on_first_update", actor_on_first_update)
RegisterScriptCallback("save_state", save_state)
RegisterScriptCallback("load_state", load_state)
end