mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2024-12-04 09:43:00 +02:00
Update changelog and fix migration bug where gleba_resources was missing in nauvis config.
This commit is contained in:
parent
f990292c9f
commit
e0e21da26f
@ -1,7 +1,10 @@
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 2.1.15
|
||||
Date: ????
|
||||
Bugfixes:
|
||||
- Fix crash when player spawns due to missing surface configuration due to a missing migration.
|
||||
Changes:
|
||||
- Images losslessly compressed to reduce mod size. (Thanks plexpt!)
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 2.1.14
|
||||
Date: 2024-11-21
|
||||
|
@ -431,38 +431,44 @@ function GenerateStartingResources(surface, position)
|
||||
local y_offset = storage.ocfg.resource_placement.distance_to_edge
|
||||
local fluid_ref_pos = { x = position.x, y = position.y + radius - y_offset }
|
||||
|
||||
for r_name, r_data in pairs(storage.ocfg.surfaces_config[surface.name].spawn_config.fluid_resources --[[@as table<string, OarcConfigFluidResource>]]) do
|
||||
local fluid_resources = storage.ocfg.surfaces_config[surface.name].spawn_config.fluid_resources
|
||||
if fluid_resources ~= nil then
|
||||
for r_name, r_data in pairs(fluid_resources) do
|
||||
|
||||
local spacing = r_data.spacing
|
||||
local oil_patch_x = fluid_ref_pos.x - (((r_data.num_patches-1) * spacing) / 2)
|
||||
local oil_patch_y = fluid_ref_pos.y
|
||||
local spacing = r_data.spacing
|
||||
local oil_patch_x = fluid_ref_pos.x - (((r_data.num_patches-1) * spacing) / 2)
|
||||
local oil_patch_y = fluid_ref_pos.y
|
||||
|
||||
for i = 1, r_data.num_patches do
|
||||
surface.create_entity({
|
||||
name = r_name,
|
||||
amount = r_data.amount,
|
||||
position = { oil_patch_x, oil_patch_y }
|
||||
})
|
||||
oil_patch_x = oil_patch_x + spacing
|
||||
for i = 1, r_data.num_patches do
|
||||
surface.create_entity({
|
||||
name = r_name,
|
||||
amount = r_data.amount,
|
||||
position = { oil_patch_x, oil_patch_y }
|
||||
})
|
||||
oil_patch_x = oil_patch_x + spacing
|
||||
end
|
||||
|
||||
fluid_ref_pos.y = fluid_ref_pos.y - spacing
|
||||
end
|
||||
|
||||
fluid_ref_pos.y = fluid_ref_pos.y - spacing
|
||||
end
|
||||
|
||||
-- This places using specified offsets if auto placement is disabled.
|
||||
else
|
||||
local fluid_ref_pos = { x = position.x, y = position.y + radius }
|
||||
for r_name, r_data in pairs(storage.ocfg.surfaces_config[surface.name].spawn_config.fluid_resources --[[@as table<string, OarcConfigFluidResource>]]) do
|
||||
local oil_patch_x = fluid_ref_pos.x + r_data.x_offset_start
|
||||
local oil_patch_y = fluid_ref_pos.y + r_data.y_offset_start
|
||||
for i = 1, r_data.num_patches do
|
||||
surface.create_entity({
|
||||
name = r_name,
|
||||
amount = r_data.amount,
|
||||
position = { oil_patch_x, oil_patch_y }
|
||||
})
|
||||
oil_patch_x = oil_patch_x + r_data.x_offset_next
|
||||
oil_patch_y = oil_patch_y + r_data.y_offset_next
|
||||
local fluid_resources = storage.ocfg.surfaces_config[surface.name].spawn_config.fluid_resources
|
||||
if fluid_resources ~= nil then
|
||||
for r_name, r_data in pairs(fluid_resources) do
|
||||
local oil_patch_x = fluid_ref_pos.x + r_data.x_offset_start
|
||||
local oil_patch_y = fluid_ref_pos.y + r_data.y_offset_start
|
||||
for i = 1, r_data.num_patches do
|
||||
surface.create_entity({
|
||||
name = r_name,
|
||||
amount = r_data.amount,
|
||||
position = { oil_patch_x, oil_patch_y }
|
||||
})
|
||||
oil_patch_x = oil_patch_x + r_data.x_offset_next
|
||||
oil_patch_y = oil_patch_y + r_data.y_offset_next
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -479,15 +485,22 @@ function PlaceResourcesInSemiCircle(surface, position, size_mod, amount_mod)
|
||||
-- Create list of resource tiles
|
||||
---@type table<string>
|
||||
local r_list = {}
|
||||
for r_name, _ in pairs(storage.ocfg.surfaces_config[surface.name].spawn_config.solid_resources) do
|
||||
if (r_name ~= "") then
|
||||
table.insert(r_list, r_name)
|
||||
local solid_resources = storage.ocfg.surfaces_config[surface.name].spawn_config.solid_resources
|
||||
if solid_resources ~= nil then
|
||||
for r_name, _ in pairs(solid_resources) do
|
||||
if (r_name ~= "") then
|
||||
table.insert(r_list, r_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for g_name,_ in pairs(storage.ocfg.surfaces_config[surface.name].spawn_config.gleba_resources) do
|
||||
if (g_name ~= "") then
|
||||
table.insert(r_list, g_name)
|
||||
-- Gleba style resources like plants
|
||||
local gleba_resources = storage.ocfg.surfaces_config[surface.name].spawn_config.gleba_resources
|
||||
if gleba_resources ~= nil then
|
||||
for g_name, _ in pairs(gleba_resources) do
|
||||
if (g_name ~= "") then
|
||||
table.insert(r_list, g_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
12
migrations/oarc-mod-v2.1.15.lua
Normal file
12
migrations/oarc-mod-v2.1.15.lua
Normal file
@ -0,0 +1,12 @@
|
||||
--Fix missing gleba_resources for the surfaces that I didn't update in 2.1.13.
|
||||
if (storage.ocfg.surfaces_config["nauvis"].spawn_config.gleba_resources == nil) then
|
||||
storage.ocfg.surfaces_config["nauvis"].spawn_config.gleba_resources = {}
|
||||
log("Fixing nauvis config with empty gleba_resources entry.")
|
||||
end
|
||||
|
||||
if script.active_mods["space-age"] ~= nil then
|
||||
if (storage.ocfg.surfaces_config["fulgora"].spawn_config.gleba_resources == nil) then
|
||||
storage.ocfg.surfaces_config["fulgora"].spawn_config.gleba_resources = {}
|
||||
log("Fixing fulgora config with empty gleba_resources entry.")
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user