1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00

mtn v3 - fixes

This commit is contained in:
Gerkiz 2022-04-07 16:11:18 +02:00
parent 38415cead9
commit 98d29e73da
11 changed files with 140 additions and 185 deletions

View File

@ -1,7 +1,7 @@
[mountain_fortress_v3]
map_info_main_caption=M O U N T A I N F O R T R E S S V3
map_info_sub_caption= ~~ diggy diggy choo choo ~~
map_info_text=[color=red]READ THIS!\nIf there are any code bugs or desyncs. Please report asap to @Gerkiz!\nIf there are any game breaking bugs then this map might be shutdown to hot-fix the issue.[/color]\n\nThe biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research will overhaul your mining equipment, increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause rocks to fall down the mountain, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nRPG GUI is disabled inside the locomotive.\nDisconnecting wagons is disabled.\nYou can't cancel crafting when standing inside the locomotive aura.\n\nDon't try to run north with your Spidertron if the train is not near you.\nYou have been warned.\n\nMining drills have great mining-bonus which also is increased after each research, use them when you can!\n\nThe mystical chest in the locomotive offers some rewards.\nOne must feed the chest to receive such rewards.\n\nGood luck on your journey!
map_info_text=[color=red]READ THIS!\nIf there are any code bugs or desyncs. Please report asap to @Gerkiz!\nIf there are any game breaking bugs then this map might be shutdown to hot-fix the issue.[/color]\n\nThe biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research will overhaul your mining equipment, increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause rocks to fall down the mountain, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nRadars do not generate new areas.\n\nRPG GUI is disabled inside the locomotive.\n\nDisconnecting wagons is disabled.\nYou can't cancel crafting when standing inside the locomotive aura.\n\nDon't try to run north with your Spidertron if the train is not near you.\nYou have been warned.\n\nMining drills have great mining-bonus which also is increased after each research, use them when you can!\n\nThe mystical chest in the locomotive offers some rewards.\nOne must feed the chest to receive such rewards.\n\nGood luck on your journey!
[breached_wall]
collapse_start=[color=blue]Mapkeeper:[/color]\nWarning, Collapse has begun!

View File

@ -125,8 +125,12 @@ end
local compare_player_pos = function(player)
local p = player.position
local index = player.index
local zone = floor((abs(p.y / zone_settings.zone_depth)) % zone_settings.size) + 1
local adjusted_zones = WPT.get('adjusted_zones')
if not adjusted_zones.size then
return
end
local zone = floor((abs(p.y / zone_settings.zone_depth)) % adjusted_zones.size) + 1
if adjusted_zones.scrap[zone] then
RPG.set_value_to_player(index, 'scrap_zone', true)

View File

@ -13,6 +13,7 @@ local Difficulty = require 'modules.difficulty_vote_by_amount'
local ICW_Func = require 'maps.mountain_fortress_v3.icw.functions'
local math2d = require 'math2d'
local Misc = require 'utils.commands.misc'
local Core = require 'utils.core'
local zone_settings = WPT.zone_settings
local this = {
@ -159,7 +160,7 @@ local function do_magic_crafters()
local index = magic_crafters.index
for i = 1, magic_crafters_per_tick do
for _ = 1, magic_crafters_per_tick do
if index > limit then
index = 1
end
@ -211,7 +212,7 @@ local function do_magic_fluid_crafters()
local index = magic_fluid_crafters.index
for i = 1, magic_fluid_crafters_per_tick do
for _ = 1, magic_fluid_crafters_per_tick do
if index > limit then
index = 1
end
@ -430,7 +431,7 @@ Public.disable_minable_and_ICW_callback =
function(entity)
if entity and entity.valid then
entity.minable = false
ICW.register_wagon(entity, true)
ICW.register_wagon(entity)
end
end
)
@ -791,12 +792,13 @@ local function calc_players()
return #players
end
local total = 0
for i = 1, #players do
local player = players[i]
if player.afk_time < 36000 then
total = total + 1
Core.iter_connected_players(
function(player)
if player.afk_time < 36000 then
total = total + 1
end
end
end
)
if total <= 0 then
total = #players
end

View File

@ -85,7 +85,7 @@ local function validate_player(player)
return true
end
local function property_boost(data)
local function give_passive_xp(data)
local xp_floating_text_color = {r = 188, g = 201, b = 63}
local visuals_delay = 1800
local loco_surface = WPT.get('loco_surface')
@ -430,7 +430,7 @@ function Public.boost_players_around_train()
locomotive_surface = locomotive_surface,
rpg = rpg
}
property_boost(data)
give_passive_xp(data)
end
function Public.is_around_train(entity)

View File

@ -553,6 +553,7 @@ local function redraw_market_items(gui, player, search_text)
frame.add(
{
type = 'sprite-button',
---@diagnostic disable-next-line: ambiguity-1
sprite = data.sprite or 'item/' .. item,
number = item_count,
name = item,
@ -611,6 +612,7 @@ local function redraw_market_items(gui, player, search_text)
frame.add(
{
type = 'sprite-button',
---@diagnostic disable-next-line: ambiguity-1
sprite = data.sprite or 'item/' .. item,
number = item_count,
name = item,

View File

@ -72,6 +72,7 @@ local set_loco_tiles =
local p = {}
---@diagnostic disable-next-line: count-down-loop
for x = position.x - 5, 1, 3 do
for y = 1, position.y + 5, 2 do
if random(1, 4) == 1 then

View File

@ -313,7 +313,8 @@ end
local is_player_valid = function()
local players = game.connected_players
for _, player in pairs(players) do
for i = 1, #players do
local player = players[i]
if player.connected and player.controller_type == 2 then
player.set_controller {type = defines.controllers.god}
player.create_character()
@ -467,9 +468,11 @@ end
local on_tick = function()
local update_gui = Gui_mf.update_gui
local tick = game.tick
local players = game.connected_players
if tick % 40 == 0 then
for _, player in pairs(game.connected_players) do
for i = 1, #players do
local player = players[i]
update_gui(player)
end
lock_locomotive_positions()
@ -537,5 +540,24 @@ end
Event.on_nth_tick(10, on_tick)
Event.on_init(on_init)
Event.add(WPT.events.reset_map, Public.reset_map)
Event.add(
defines.events.on_sector_scanned,
function(event)
local radar = event.radar
if not radar or not radar.valid then
return
end
local radars_reveal_new_chunks = WPT.get('radars_reveal_new_chunks')
if radars_reveal_new_chunks then
return
end
local pos = event.chunk_position
radar.force.cancel_charting(radar.surface.index)
radar.force.unchart_chunk(pos, radar.surface.index)
end
)
return Public

View File

@ -177,7 +177,7 @@ local function create_particles(surface, name, position, amount, cause_position)
d2 = (cause_position.y - position.y) * 0.025
end
for i = 1, amount, 1 do
for _ = 1, amount, 1 do
local m = random(4, 10)
local m2 = m * 0.005

View File

@ -1,7 +1,6 @@
local Color = require 'utils.color_presets'
local Event = require 'utils.event'
local WPT = require 'maps.mountain_fortress_v3.table'
local WD = require 'modules.wave_defense.table'
local RPG = require 'modules.rpg.main'
local Alert = require 'utils.alert'
local Task = require 'utils.task'
@ -265,17 +264,6 @@ local function roll_item_stacks(remaining_budget, max_slots, blacklist)
return item_stack_set, item_stack_set_worth
end
local pause_wd_token =
Token.register(
function()
WD.pause(false)
local mc_rewards = WPT.get('mc_rewards')
mc_rewards.temp_boosts.wave_defense = nil
local message = ({'locomotive.wd_resumed'})
Alert.alert_all_players(15, message, nil, 'achievement/tech-maniac')
end
)
local restore_mining_speed_token =
Token.register(
function()
@ -379,19 +367,6 @@ local mc_random_rewards = {
end),
512
},
{
name = 'Inventory Bonus',
color = {r = 0.00, g = 0.00, b = 0.25},
tooltip = 'Selecting this will grant the team permanent inventory bonus!',
func = (function(player)
local force = game.forces.player
force.character_inventory_slots_bonus = force.character_inventory_slots_bonus + 1
local message = ({'locomotive.inventory_bonus', player.name})
Alert.alert_all_players(15, message, nil, 'achievement/tech-maniac')
return true
end),
512
},
{
name = 'Heal Locomotive',
color = {r = 0.00, g = 0.00, b = 0.25},
@ -404,26 +379,6 @@ local mc_random_rewards = {
return true
end),
256
},
{
name = 'Wave Defense',
str = 'wave_defense',
color = {r = 0.35, g = 0.00, b = 0.00},
tooltip = 'Selecting this will pause the wave defense for 5 minutes. Ideal if you want to take a break!',
func = (function(player)
local mc_rewards = WPT.get('mc_rewards')
if mc_rewards.temp_boosts.wave_defense then
return false, '[Rewards] Wave Defense break is already applied. Please choose another reward.'
end
mc_rewards.temp_boosts.wave_defense = true
WD.pause(true)
Task.set_timeout_in_ticks(18000, pause_wd_token)
local message = ({'locomotive.wd_paused', player.name})
Alert.alert_all_players(15, message, nil, 'achievement/tech-maniac')
return true
end),
64
}
}

View File

@ -19,8 +19,7 @@ Global.register(
Public.zone_settings = {
zone_depth = 704,
zone_width = 510,
size = nil
zone_width = 510
}
Public.pickaxe_upgrades = {
@ -230,9 +229,12 @@ function Public.reset_table()
}
this.adjusted_zones = {
scrap = {},
forest = {}
forest = {},
size = nil,
shuffled_zones = nil
}
this.alert_zone_1 = false -- alert the players
this.radars_reveal_new_chunks = false -- allows for the player to explore the map instead
for k, _ in pairs(this.players) do
this.players[k] = {}
@ -270,10 +272,6 @@ function Public.remove(key, sub_key)
end
end
local on_init = function()
Public.reset_table()
end
Event.on_init(on_init)
Event.on_init(Public.reset_table)
return Public

View File

@ -144,7 +144,7 @@ local function is_position_near(area, table_to_check)
end
for i = 1, #table_to_check do
if inside(table_to_check[i], area) then
if inside(table_to_check[i]) then
status = true
end
end
@ -152,7 +152,7 @@ local function is_position_near(area, table_to_check)
return status
end
local function place_wagon(data)
local function place_wagon(data, adjusted_zones)
local placed_trains_in_zone = WPT.get('placed_trains_in_zone')
if not placed_trains_in_zone.randomized then
placed_trains_in_zone.limit = random(1, 2)
@ -164,11 +164,11 @@ local function place_wagon(data)
data.new_zone = 1
end
if data.new_zone == zone_settings.size then
if data.new_zone == adjusted_zones.size then
data.new_zone = 1
end
if data.current_zone == zone_settings.size then
if data.current_zone == adjusted_zones.size then
local new_zone = placed_trains_in_zone.zones[data.new_zone]
if new_zone then
new_zone.placed = 0
@ -215,6 +215,7 @@ local function place_wagon(data)
local location
local direction
local r1 = random(2, 4) * 2
local r2 = random(2, 4) * 2
@ -226,7 +227,7 @@ local function place_wagon(data)
direction = 2
end
for k, tile in pairs(location) do
for _, tile in pairs(location) do
tiles[#tiles + 1] = {name = 'nuclear-ground', position = tile.position}
if tile.position.y % 1 == 0 and tile.position.x % 1 == 0 then
entities[#entities + 1] = {
@ -458,7 +459,7 @@ local function wall(p, data)
end
end
local function generate_zone_14(x, y, data)
local function zone_14(x, y, data, _, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -510,7 +511,7 @@ local function generate_zone_14(x, y, data)
if small_caves > -0.41 and small_caves < 0.41 then
if noise_cave_ponds > 0.35 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -538,7 +539,7 @@ local function generate_zone_14(x, y, data)
tiles[#tiles + 1] = {name = 'water-shallow', position = p}
end
local function generate_zone_13(x, y, data)
local function zone_13(x, y, data, _, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -590,7 +591,7 @@ local function generate_zone_13(x, y, data)
if small_caves > -0.40 and small_caves < 0.40 then
if noise_cave_ponds > 0.35 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -618,7 +619,7 @@ local function generate_zone_13(x, y, data)
tiles[#tiles + 1] = {name = 'water-shallow', position = p}
end
local function generate_zone_12(x, y, data, void_or_lab)
local function zone_12(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -653,7 +654,7 @@ local function generate_zone_12(x, y, data, void_or_lab)
end
if noise_1 < -0.72 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -704,7 +705,7 @@ local function generate_zone_12(x, y, data, void_or_lab)
tiles[#tiles + 1] = {name = 'tutorial-grid', position = p}
end
local function generate_zone_11(x, y, data)
local function zone_11(x, y, data, _, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -767,7 +768,7 @@ local function generate_zone_11(x, y, data)
}
end
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -800,7 +801,7 @@ local function generate_zone_11(x, y, data)
end
end
local function generate_zone_10(x, y, data)
local function zone_10(x, y, data, _, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -844,7 +845,7 @@ local function generate_zone_10(x, y, data)
return
end
if abs(scrapyard) > 0.25 and abs(scrapyard) < 0.40 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -914,7 +915,7 @@ local function generate_zone_10(x, y, data)
tiles[#tiles + 1] = {name = 'grass-2', position = p}
end
local function generate_zone_9(x, y, data)
local function zone_9(x, y, data, _, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -949,7 +950,7 @@ local function generate_zone_9(x, y, data)
end
if maze_noise > 0 and maze_noise < 0.45 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -987,7 +988,7 @@ local function generate_zone_9(x, y, data)
end
--SCRAPYARD
local function process_zone_scrap_2(x, y, data, void_or_lab)
local function zone_scrap_2(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -1033,7 +1034,7 @@ local function process_zone_scrap_2(x, y, data, void_or_lab)
return
end
if scrapyard_modified < -0.28 or scrapyard_modified > 0.28 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -1116,7 +1117,7 @@ local function process_zone_scrap_2(x, y, data, void_or_lab)
end
--SCRAPYARD
local function process_zone_scrap_1(x, y, data, void_or_lab)
local function zone_scrap_1(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -1162,7 +1163,7 @@ local function process_zone_scrap_1(x, y, data, void_or_lab)
return
end
if scrapyard < -0.28 or scrapyard > 0.28 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -1244,7 +1245,7 @@ local function process_zone_scrap_1(x, y, data, void_or_lab)
end
end
local function generate_zone_7(x, y, data, void_or_lab)
local function zone_7(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -1304,7 +1305,7 @@ local function generate_zone_7(x, y, data, void_or_lab)
if cave_rivers_4 > -0.20 and cave_rivers_4 < 0.20 then
tiles[#tiles + 1] = {name = 'grass-' .. floor(cave_rivers_4 * 32) % 3 + 1, position = p}
if cave_rivers_4 > -0.10 and cave_rivers_4 < 0.10 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -1361,7 +1362,7 @@ local function generate_zone_7(x, y, data, void_or_lab)
end
end
local function generate_zone_forest_2(x, y, data, void_or_lab)
local function zone_forest_2(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -1418,7 +1419,7 @@ local function generate_zone_forest_2(x, y, data, void_or_lab)
end
local noise_forest_location = get_perlin('forest_location', p, seed)
if cave_rivers > -0.1 and cave_rivers < 0.1 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -1497,7 +1498,7 @@ local function generate_zone_forest_2(x, y, data, void_or_lab)
end
end
local function generate_zone_5(x, y, data, void_or_lab)
local function zone_5(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -1561,7 +1562,7 @@ local function generate_zone_5(x, y, data, void_or_lab)
if small_caves > -0.40 and small_caves < 0.40 then
if noise_cave_ponds > 0.35 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -1589,7 +1590,7 @@ local function generate_zone_5(x, y, data, void_or_lab)
tiles[#tiles + 1] = {name = void_or_lab, position = p}
end
local function generate_zone_4(x, y, data, void_or_lab)
local function zone_4(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -1632,7 +1633,7 @@ local function generate_zone_4(x, y, data, void_or_lab)
note = true
}
end
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -1720,7 +1721,7 @@ local function generate_zone_4(x, y, data, void_or_lab)
tiles[#tiles + 1] = {name = void_or_lab, position = p}
end
local function generate_zone_3(x, y, data, void_or_lab)
local function zone_3(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -1857,7 +1858,7 @@ local function generate_zone_3(x, y, data, void_or_lab)
--Main Rock Terrain
local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 75000)
if no_rocks_2 > 0.80 or no_rocks_2 < -0.80 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -1886,7 +1887,7 @@ local function generate_zone_3(x, y, data, void_or_lab)
end
end
local function generate_zone_2(x, y, data, void_or_lab)
local function zone_2(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local tiles = data.tiles
@ -2005,7 +2006,7 @@ local function generate_zone_2(x, y, data, void_or_lab)
--Main Rock Terrain
local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 75000)
if no_rocks_2 > 0.80 or no_rocks_2 < -0.80 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -2030,7 +2031,7 @@ local function generate_zone_2(x, y, data, void_or_lab)
tiles[#tiles + 1] = {name = void_or_lab, position = p}
end
local function generate_zone_forest_1(x, y, data, void_or_lab)
local function zone_forest_1(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local buildings = data.buildings
@ -2149,7 +2150,7 @@ local function generate_zone_forest_1(x, y, data, void_or_lab)
--Main Rock Terrain
local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 5000)
if no_rocks_2 > 0.64 or no_rocks_2 < -0.64 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -2214,7 +2215,7 @@ local function generate_zone_forest_1(x, y, data, void_or_lab)
end
end
local function generate_zone_1(x, y, data, void_or_lab)
local function zone_1(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local buildings = data.buildings
@ -2331,7 +2332,7 @@ local function generate_zone_1(x, y, data, void_or_lab)
--Main Rock Terrain
local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 75000)
if no_rocks_2 > 0.66 or no_rocks_2 < -0.66 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -2378,7 +2379,7 @@ local function generate_zone_1(x, y, data, void_or_lab)
end
end
local function starting_zone(x, y, data, void_or_lab)
local function starting_zone(x, y, data, void_or_lab, adjusted_zones)
local p = {x = x, y = y}
local seed = data.seed
local buildings = data.buildings
@ -2492,7 +2493,7 @@ local function starting_zone(x, y, data, void_or_lab)
--Main Rock Terrain
if no_rocks_2 > 0.334 and no_rocks_2 < 0.544 then
local success = place_wagon(data)
local success = place_wagon(data, adjusted_zones)
if success then
return
end
@ -2517,78 +2518,27 @@ local function starting_zone(x, y, data, void_or_lab)
end
local zones = {
generate_zone_1,
generate_zone_forest_1,
generate_zone_3,
generate_zone_5,
generate_zone_11,
generate_zone_forest_2,
process_zone_scrap_1,
process_zone_scrap_2,
generate_zone_9,
generate_zone_4,
process_zone_scrap_1,
generate_zone_2,
generate_zone_3,
process_zone_scrap_2,
generate_zone_3,
generate_zone_forest_2,
generate_zone_4,
generate_zone_forest_1,
generate_zone_forest_2,
generate_zone_2,
generate_zone_4,
process_zone_scrap_2,
generate_zone_5,
generate_zone_1,
generate_zone_forest_2,
generate_zone_7,
process_zone_scrap_1,
generate_zone_9,
generate_zone_10,
generate_zone_11,
generate_zone_12,
generate_zone_forest_2,
process_zone_scrap_2,
process_zone_scrap_1,
generate_zone_11,
generate_zone_12,
process_zone_scrap_1,
generate_zone_13,
generate_zone_14,
process_zone_scrap_1,
generate_zone_forest_1,
generate_zone_14,
process_zone_scrap_2
['zone_1'] = zone_1,
['zone_2'] = zone_2,
['zone_3'] = zone_3,
['zone_4'] = zone_4,
['zone_5'] = zone_5,
['zone_forest_1'] = zone_forest_1,
['zone_forest_2'] = zone_forest_2,
['zone_scrap_1'] = zone_scrap_1,
['zone_scrap_2'] = zone_scrap_2,
['zone_7'] = zone_7,
['zone_9'] = zone_9,
['zone_10'] = zone_10,
['zone_11'] = zone_11,
['zone_12'] = zone_12,
['zone_13'] = zone_13,
['zone_14'] = zone_14
}
--[[ local zones_non_raffled = {
generate_zone_1,
generate_zone_2,
generate_zone_3,
generate_zone_4,
generate_zone_5,
generate_zone_forest_1,
generate_zone_forest_2,
process_zone_scrap_1,
process_zone_scrap_2,
generate_zone_7,
generate_zone_9,
generate_zone_11,
generate_zone_10,
generate_zone_11,
generate_zone_12,
generate_zone_13,
generate_zone_14
} ]]
zone_settings.size = #zones
local function shuffle_terrains(new_zone)
local adjusted_zones = WPT.get('adjusted_zones')
local function shuffle_terrains(adjusted_zones, new_zone)
if not adjusted_zones.shuffled_terrains then
shuffle(zones)
shuffle(adjusted_zones.shuffled_zones)
adjusted_zones.shuffled_terrains = new_zone
end
@ -2605,25 +2555,43 @@ local function is_out_of_map(p)
return true
end
local function process_bits(p, data)
local function init_terrain(adjusted_zones)
if adjusted_zones.init_terrain then
return
end
local count = 1
local shuffled_zones = {}
for zone_name, _ in pairs(zones) do
shuffled_zones[count] = zone_name
count = count + 1
end
adjusted_zones.size = count
adjusted_zones.shuffled_zones = shuffled_zones
adjusted_zones.init_terrain = true
end
local function process_bits(p, data, adjusted_zones)
local left_top_y = data.area.left_top.y
local index = floor((abs(left_top_y / zone_settings.zone_depth)) % zone_settings.size) + 1
shuffle_terrains(index)
local index = floor((abs(left_top_y / zone_settings.zone_depth)) % adjusted_zones.size) + 1
shuffle_terrains(adjusted_zones, index)
local generate_zone
if left_top_y >= -zone_settings.zone_depth then
generate_zone = starting_zone
else
generate_zone = zones[index]
generate_zone = zones[adjusted_zones.shuffled_zones[index]]
if not generate_zone then
generate_zone = zones[zone_settings.size]
generate_zone = zones[adjusted_zones.shuffled_zones[adjusted_zones.size]]
end
end
data.current_zone = index
local adjusted_zones = WPT.get('adjusted_zones')
if data.forest_zone and not adjusted_zones.forest[index] then
adjusted_zones.forest[index] = true
end
@ -2637,7 +2605,7 @@ local function process_bits(p, data)
local x = p.x
local y = p.y
generate_zone(x, y, data, void_or_tile)
generate_zone(x, y, data, void_or_tile, adjusted_zones)
end
local function border_chunk(p, data)
@ -2729,6 +2697,9 @@ function Public.heavy_functions(data)
local p = data.position
local get_tile = surface.get_tile(p)
local adjusted_zones = WPT.get('adjusted_zones')
init_terrain(adjusted_zones)
local map_name = 'mountain_fortress_v3'
if string.sub(surface.name, 0, #map_name) ~= map_name then
@ -2749,7 +2720,7 @@ function Public.heavy_functions(data)
end
if top_y < 0 then
return process_bits(p, data)
return process_bits(p, data, adjusted_zones)
end
if top_y > 120 then