Skip to content

Commit e458ce4

Browse files
author
notnotmelon
committed
fix: Fixed message "This won't work here" appearing for legacy factory floor 1.
1 parent d52767f commit e458ce4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

script/factory-buildings.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ 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
76+
end
77+
7478
local function set_factory_active_or_inactive(factory)
7579
local building = factory.building
7680
if not building or not building.valid then
@@ -83,8 +87,10 @@ local function set_factory_active_or_inactive(factory)
8387
local function can_place_factory_here()
8488
-- Check if a player is trying to cheat by moving factories between surfaces.
8589
if factory.inside_surface.valid and factory.inside_surface.name ~= which_surface_should_this_new_factory_be_placed_on(factory.layout, building) then
86-
flying_text = {"factory-connection-text.invalid-placement-surface", surface_localised_name(factory.inside_surface), surface_localised_name(surface)}
87-
return false, flying_text, true
90+
if not is_legacy_factory_floor(factory.inside_surface) then
91+
flying_text = {"factory-connection-text.invalid-placement-surface", surface_localised_name(factory.inside_surface), surface_localised_name(surface)}
92+
return false, flying_text, true
93+
end
8894
end
8995

9096
if settings.global["Factorissimo2-free-recursion"].value then

0 commit comments

Comments
 (0)