Factorissimo 2 - notnotmelon fork 🍴


A fork of Factorissimo 2 focused on improving performance by implementing several 1.1 features. Can improve performance by 10X or higher. Also fixes several bugs from the original version.

Content
1 year, 3 months ago
1.1
53.9K
Logistics

b About the layout.surface_override API

4 months ago
(updated 4 months ago)

[1.2.3]Bug in surface_override API
Hello! I'm trying to use this API in my mod:https://mods.factorio.com/mod/space-factorissimo-lizard
But seems there is a problem with this API:

local surface_name = 'factory-floor-' .. global.next_factory_surface
local surface = game.surfaces[layout.surface_override or surface_name]
if surface == nil then
surface = game.create_surface(surface_name, {width = 2, height = 2})
surface.daytime = 0.5
surface.freeze_daytime = true
end

the "layout.surface_override" will change the value "surface" rather than "surface_name",this will cause many issues.
For example,other two commands can't work properly in this function:

global.surface_factories[surface_name] = global.surface_factories[surface_name] or {}
global.surface_factories[surface_name][n+1] = factory

I'm tring to input "space-factory-1" but the function is still using "factory-floor-1" instead.

4 months ago
(updated 4 months ago)

For some trials:
local base_surface_name = 'factory-floor-' .. global.next_factory_surface
local surface_name = layout.surface_override or base_surface_name
local surface = game.surfaces[surface_name]
if surface == nil then
……
These changes will sovle this problem.
I would greatly appreciate it if you could fix this API!

4 months ago

Thanks! I will add it

Merry Christmas

4 months ago

Thanks! I will add it

Merry Christmas

Thank you and Merry Christmas to you!

New response