Factorio+

by fishbus

A mod that builds upon and tweaks the vanilla experience with a little bit of everything: crafting, furnaces, resources, turrets, vehicles, enemies and weapons. [Built for base 2.0 Factorio - Works with Space Age]

Overhaul
7 hours ago
0.18 - 2.0
22.2K
Transportation Logistics Trains Combat Armor Enemies Environment Mining Fluids Logistic network Manufacturing Power Storage

g [Fixed][Alien Biomes]An error occurred while loading game mods

a month ago
(updated a month ago)

I don’t know if it’s a compatibility issue, because it works in 2.2.7, but it doesn’t work in 2.2.8 (by the way, I installed A LOT OF modules......including DLC)
The following is the error message


Failed to load game module:
[factorioplus/rocks.lua:64: attempt to index field 'autoplace' (a nil value)]

Stack traceback:
factorioplus/rocks.lua:64: in main chunk
[C]: in function 'require'
factorioplus/data.lua:25: in main chunk

(The above error message comes from ChatGPT’s image text extraction function)

My English is very poor, so the above words are all translated by Google.
Please forgive me if there are any mistakes.

a month ago

I believe it's because of Alien Biomes. It's a conflict with autoplace with both mods.

Replace the line of bugged code with this

local util = require("util") -- Make sure util is required at the top of your file

if data.raw["optimized-decorative"]["tiny-rock"] and
data.raw["optimized-decorative"]["tiny-rock"].autoplace and
data.raw["optimized-decorative"]["small-sand-rock"] and
data.raw["optimized-decorative"]["small-sand-rock"].autoplace then

-- Copy and modify tiny-rock
local water_rock = util.copy(data.raw["optimized-decorative"]["tiny-rock"])
water_rock.name = "water-rock"

-- Deepcopy autoplace including the noise expression, then safely add tile restriction
water_rock.autoplace = table.deepcopy(data.raw["optimized-decorative"]["tiny-rock"].autoplace)

-- Modify tile_restriction safely, preserving noise expressions
if water_rock.autoplace.tile_restriction then
    table.insert(water_rock.autoplace.tile_restriction, "water-shallow")
else
    water_rock.autoplace.tile_restriction = {"water-shallow"}
end

water_rock.collision_mask = {
    layers = {ground_tile = true},
    colliding_with_tiles_only = true
}

-- Copy and modify small-sand-rock similarly
local water_sand_rock = util.copy(data.raw["optimized-decorative"]["small-sand-rock"])
water_sand_rock.name = "water_sand_rock"

water_sand_rock.autoplace = table.deepcopy(data.raw["optimized-decorative"]["small-sand-rock"].autoplace)

if water_sand_rock.autoplace.tile_restriction then
    table.insert(water_sand_rock.autoplace.tile_restriction, "water-shallow")
else
    water_sand_rock.autoplace.tile_restriction = {"water-shallow"}
end

water_sand_rock.collision_mask = {
    layers = {ground_tile = true},
    colliding_with_tiles_only = true
}

-- Register the new decorative prototypes
data:extend({water_rock, water_sand_rock})

-- Add them to the planet autoplace settings as empty tables to avoid errors
data.raw["planet"]["nauvis"].map_gen_settings.autoplace_settings["decorative"].settings["water-rock"] = {}
data.raw["planet"]["nauvis"].map_gen_settings.autoplace_settings["decorative"].settings["water_sand_rock"] = {}

else
-- Base decorations or autoplace missing: log a warning or skip creating water-rocks
log("Warning: Base optimized-decorative 'tiny-rock' or 'small-sand-rock' or their autoplace data missing. Skipping water-rock creation.")
end

Thats what worked for me.

a month ago

I'm an idiot, and I am getting the same error, @ChRoNiC

Where do I replace that, where is the file, what line number etc.

a month ago
(updated a month ago)

Replace the line of bugged code with this

local util = require("util") -- Make sure util is required at the top of your file

if data.raw["optimized-decorative"]["tiny-rock"] and
data.raw["optimized-decorative"]["tiny-rock"].autoplace and
data.raw["optimized-decorative"]["small-sand-rock"] and
data.raw["optimized-decorative"]["small-sand-rock"].autoplace then

-- Copy and modify tiny-rock
local water_rock = util.copy(data.raw["optimized-decorative"]["tiny-rock"])
water_rock.name = "water-rock"

-- Deepcopy autoplace including the noise expression, then safely add tile restriction
water_rock.autoplace = table.deepcopy(data.raw["optimized-decorative"]["tiny-rock"].autoplace)

-- Modify tile_restriction safely, preserving noise expressions
if water_rock.autoplace.tile_restriction then
    table.insert(water_rock.autoplace.tile_restriction, "water-shallow")
else
    water_rock.autoplace.tile_restriction = {"water-shallow"}
end

water_rock.collision_mask = {
    layers = {ground_tile = true},
    colliding_with_tiles_only = true
}

-- Copy and modify small-sand-rock similarly
local water_sand_rock = util.copy(data.raw["optimized-decorative"]["small-sand-rock"])
water_sand_rock.name = "water_sand_rock"

water_sand_rock.autoplace = table.deepcopy(data.raw["optimized-decorative"]["small-sand-rock"].autoplace)

if water_sand_rock.autoplace.tile_restriction then
    table.insert(water_sand_rock.autoplace.tile_restriction, "water-shallow")
else
    water_sand_rock.autoplace.tile_restriction = {"water-shallow"}
end

water_sand_rock.collision_mask = {
    layers = {ground_tile = true},
    colliding_with_tiles_only = true
}

-- Register the new decorative prototypes
data:extend({water_rock, water_sand_rock})

-- Add them to the planet autoplace settings as empty tables to avoid errors
data.raw["planet"]["nauvis"].map_gen_settings.autoplace_settings["decorative"].settings["water-rock"] = {}
data.raw["planet"]["nauvis"].map_gen_settings.autoplace_settings["decorative"].settings["water_sand_rock"] = {}

else
-- Base decorations or autoplace missing: log a warning or skip creating water-rocks
log("Warning: Base optimized-decorative 'tiny-rock' or 'small-sand-rock' or their autoplace data missing. Skipping water-rock creation.")
end

Thats what worked for me.

Thanks for this, if you're able to, can you submit this via Github?

Otherwise I'll just modify the rock.lua in the next patch with this and credit you.

Cheers!

a month ago
(updated a month ago)

Thanks for this, if you're able to, can you submit this via Github?

Otherwise I'll just modify the rock.lua in the next patch with this and credit you.

Cheers!

I used to be good with computers/internet. I found the github for the mod, but I'm lost when it comes to uploading my copy of rocks.lua to the repository. Please lend assistance.
Update: I "forked" the code and uploaded my proposed change, hope I did it right.

Have a great day!

a month ago

Thanks for this, if you're able to, can you submit this via Github?

Otherwise I'll just modify the rock.lua in the next patch with this and credit you.

Cheers!

I used to be good with computers/internet. I found the github for the mod, but I'm lost when it comes to uploading my copy of rocks.lua to the repository. Please lend assistance.
Update: I "forked" the code and uploaded my proposed change, hope I did it right.

Have a great day!

That all worked, thanks again!

New response