[SOLVED] Name of tile (mined, placed)

Things that already exist in the current mod API
DeznekCZ
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Sep 23, 2016 12:56 pm
Contact:

[SOLVED] Name of tile (mined, placed)

Post 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
Last edited by DeznekCZ on Sun Jun 03, 2018 8:24 am, edited 6 times in total.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14343
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Name of tile

Post by Rseding91 »

What?
If you want to get ahold of me I'm almost always on Discord.
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Name of tile

Post by steinio »

Last edited by steinio on Sun Jun 03, 2018 9:24 am, edited 2 times in total.
Image

Transport Belt Repair Man

View unread Posts
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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)
Post Reply

Return to “Already exists”