Code: Select all
surface.create_entity{name="reactor-"..tostring(dx).."x"..tostring(dy), position={left_top.position.x + dx/2 -1/2, left_top.position.y + dy/2 -1/2}, force=force}
Code: Select all
local new_reactor = surface.create_entity{name="reactor-"..tostring(dx).."x"..tostring(dy), position={left_top.position.x + dx/2 -1/2, left_top.position.y + dy/2 -1/2}, force=force}
game.players[1].print("1: x: " .. left_top.position.x + dx/2 -1/2 .. ", y: " .. left_top.position.y + dy/2 -1/2)
game.players[1].print("2: x: " .. new_reactor.position.x .. ", y: " .. new_reactor.position.y)


Smaller objects are placed in the correct position:

