Skip to content

Commit d052491

Browse files
committed
Take 3.
1 parent 224baba commit d052491

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

modules/landfill.lua

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local actions = require('actions')
77

88
local Landfill = {
99
ALIGNMENT_OVERRIDES = require("modules/snap").ALIGNMENT_OVERRIDES
10+
prototypes_computed = false
1011
}
1112

1213

@@ -15,6 +16,10 @@ local get_overlapping_tiles = Geom2D.get_overlapping_tiles
1516

1617

1718
function Landfill.compute_prototype_overrides()
19+
if Landfill.prototypes_computed then
20+
return
21+
end
22+
Landfill.prototypes_computed = true
1823
-- Some entities require special arguments when created. We skip those; they're unlikely to come up in blueprints
1924
-- anyways
2025
local type_blacklist = {
@@ -37,14 +42,8 @@ function Landfill.compute_prototype_overrides()
3742

3843
log("Computing collision box overrides...")
3944

40-
local surface = game.surfaces["_BPEX_Temp_Surface"]
41-
if surface then
42-
log("Old temporary surface existed for some reason, destroying it.")
43-
game.delete_surface(surface)
44-
end
45-
4645
-- Temporary surface.
47-
surface = game.create_surface("_BPEX_Temp_Surface")
46+
local surface = game.create_surface("_BPEX_Temp_Surface")
4847
local x, y
4948

5049
for name, proto in pairs(game.entity_prototypes) do

0 commit comments

Comments
 (0)