@@ -35,16 +35,19 @@ local origin = {0, 0}
3535-- issues because of the change to the behavior of entity prototype flags concerning automated interaction.
3636-- TODO: Open a new bug report for these issues once explored a bit more.
3737local limbo = setmetatable ({}, {
38- --- @param surface LuaSurface
38+ --- @param surface_index uint
3939 --- @return LuaEntity ?
40- __index = function (self , surface )
40+ __index = function (self , surface_index )
41+ local surface = game .surfaces [surface_index ]
42+ if not surface then return nil end
4143 local entity = surface .find_entity (" inventory-selector-limbo" , origin )
4244 if not entity then
4345 -- Any and all flags that can be set to make this entity as invisible and uninteractable as possible
4446 -- should be present here.
4547 entity = surface .create_entity {
4648 name = " inventory-selector-limbo" ,
4749 position = origin ,
50+ snap_to_grid = false ,
4851 force = game .forces .neutral ,
4952 create_build_effect_smoke = false ,
5053 preserve_ghosts_and_corpses = true ,
@@ -55,10 +58,9 @@ local limbo = setmetatable({}, {
5558 entity .active = false
5659 end
5760 -- Cache the reference for future lookups
58- self [surface ] = entity
61+ self [surface_index ] = entity
5962 return entity
6063 end ,
61- __mode = " k" ,
6264})
6365
6466return limbo
0 commit comments