Skip to content

Commit f1b1429

Browse files
author
notnotmelon
committed
fix: Fixed "This won't work here! This factory building is designed for Factory floor 1. Was instead Nauvis factory floor. ". Resolves #268
1 parent 1eb207e commit f1b1429

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

script/factory-buildings.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ local function which_surface_should_this_new_factory_be_placed_on(layout, buildi
7171
end
7272
end
7373

74-
local function is_legacy_factory_floor(surface)
75-
return surface.name:match("^%d+%-factory%-floor$") ~= nil
74+
local function is_legacy_factory_floor(surface_name)
75+
return surface_name:match("^%d+%-factory%-floor$") ~= nil
7676
end
7777

7878
local function set_factory_active_or_inactive(factory)
@@ -86,8 +86,11 @@ local function set_factory_active_or_inactive(factory)
8686

8787
local function can_place_factory_here()
8888
-- Check if a player is trying to cheat by moving factories between surfaces.
89-
if factory.inside_surface.valid and factory.inside_surface.name ~= which_surface_should_this_new_factory_be_placed_on(factory.layout, building) then
90-
if not is_legacy_factory_floor(factory.inside_surface) then
89+
local surface_name = factory.inside_surface.name
90+
-- https://github.com/notnotmelon/factorissimo-2-notnotmelon/issues/268
91+
local surface_name = surface_name:gsub("%-factory%-floor%-factory%-floor", "-factory-floor")
92+
if factory.inside_surface.valid and surface_name ~= which_surface_should_this_new_factory_be_placed_on(factory.layout, building) then
93+
if not is_legacy_factory_floor(surface_name) then
9194
flying_text = {"factory-connection-text.invalid-placement-surface", surface_localised_name(factory.inside_surface), surface_localised_name(surface)}
9295
return false, flying_text, true
9396
end

0 commit comments

Comments
 (0)