Make a train circle around your character so that the center of the circle is 0.0
The top left track should be x=-10, y=-4
Blueprint the circle and remove it and hold the blueprint in your hands
if you check the blueprint_entities all of the x,y coords will be off by 1
This builds correctly
Code: Select all
game.player.cursor_stack.build_blueprint({surface=game.player.surface, position = {0, 0}, force=game.player.force, force_build=true})
This fails misserably
Code: Select all
for _, track in pairs(game.player.cursor_stack.get_blueprint_entities()) do
local pos = {track.position.x, track.position.y}
game.player.surface.create_entity{name=track.name, position=pos, direction=track.direction, force=game.player.force}
end
Code: Select all
for _, track in pairs(game.player.cursor_stack.get_blueprint_entities()) do
local pos = {track.position.x +1 , track.position.y +1}
game.player.surface.create_entity{name=track.name, position=pos, direction=track.direction, force=game.player.force}
end