Code: Select all
set_tiles({"grass",{1,1}},{"grass",{2,2}},{"grass",{3,3}})
Code: Select all
set_tiles({"grass",{1,1}},{"grass",{2,2}},{"grass",{3,3}})
Code: Select all
set_tiles{{name="grass",position={1,1}},{name="grass",position={2,2}},{name="grass",position={3,3}}}
Code: Select all
for x = 1,10 do
for y = 1,10 do
set_tiles({"grass",{x,y}})
end
end
From LuaSurface::set_tiles:Eliont wrote:Emmm...
using them in cycle will not work?
Code: Select all
for x = 1,10 do for y = 1,10 do set_tiles({"grass",{x,y}}) end end
Note: It is recommended to call this method once for all the tiles you want to change rather than calling it individually for every tile. As the tile correction is used after every step, calling it one by one could cause the tile correction logic to redo some of the changes, and it is also much performance heavy.
Code: Select all
local tiles = {}
for x = 1,10 do
for y = 1,10 do
table.insert(tiles, {"grass",{x,y}}
end
end
set_tiles(tiles)
That still won't work without "name" and "position" as keys.DaveMcW wrote:Code: Select all
local tiles = {} for x = 1,10 do for y = 1,10 do table.insert(tiles, {"grass",{x,y}} end end set_tiles(tiles)
Are you sure about that ?prg wrote:That still won't work without "name" and "position" as keys.DaveMcW wrote:Code: Select all
local tiles = {} for x = 1,10 do for y = 1,10 do table.insert(tiles, {"grass",{x,y}} end end set_tiles(tiles)
Code: Select all
can_place_entity{name=…, position=…, direction=…, force=…}
Code: Select all
find_entity(entity, position)
If it have right position.vtx wrote: without "=..." seem to accept shorthand.
vtx wrote:Are you sure about that ?
Code: Select all
/c game.player.surface.set_tiles{{name="grass", position={1,1}}}
Code: Select all
/c game.player.surface.set_tiles{{"grass", {1,1}}}
Code: Select all
can_place_entity{name=…, position=…, direction=…, force=…}
Code: Select all
can_place_entity({name=…, position=…, direction=…, force=…})