Page 1 of 1

[SOLVED] Name of tile (mined, placed)

Posted: Sun Jun 03, 2018 12:57 am
by DeznekCZ
Hi developers,

I have found that function LuaSurface::get_tile(x,y) returns LuaTile without values in prototype and name. Booth are "nil"

Solved - be careful with events

Code: Select all

local function on_mined_tile(event)
  local surface = game.surfaces[event.surface_index]
  local tiles = event.tiles
  for _,tile in pairs(tiles) do
    set_tile(tile.position.x, tile.position.y, surface.get_tile(tile.position.x, tile.position.y))
  end
end
*fixed missing tile.name in localized sting, bud it makes no problem, proble makes that, tile.name returns nil

Re: Name of tile

Posted: Sun Jun 03, 2018 6:50 am
by Rseding91
What?

Re: Name of tile

Posted: Sun Jun 03, 2018 7:50 am
by steinio

Re: [SOLVED] Name of tile (mined, placed)

Posted: Sun Jun 03, 2018 8:41 am
by eradicator

Code: Select all

/c
script.on_event(defines.events.on_player_mined_tile,
  function(event)
    for _,t in pairs(event.tiles) do
      game.print(t.old_tile.name)
      end
    end)