Guest User

Untitled

a guest
Jul 19th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. script.on_event(defines.events.on_player_built_tile, function(event)
  2.     -- there seems to be an inconsistency in the surface_index, https://forums.factorio.com/viewtopic.php?t=46502
  3.     if event.surface_index + 1 == game.surfaces["nauvis"].index then
  4.         local tiles = {}
  5.         for i = 1, #event.positions do
  6.             if game.surfaces["nauvis"].get_tile(event.positions[i].x, event.positions[i].y).name == "cave-ground" then
  7.                 table.insert(tiles, {name="grass", position = event.positions[i] })
  8.             end
  9.         end
  10.         game.surfaces["nauvis"].set_tiles(tiles, true)
  11.     end
  12. end)
Add Comment
Please, Sign In to add comment