onAddThing

Getting triggered a thing is added to the tile.

Prototypes
onAddThing(callback) -- callback = function(tile, thing)
Parameters
    • function(tile, thing): callback function
      • tile: tile object.
      • thing: thing object. can be creature, item, effect or text.
Usage
local playerTile = g_map.getTile(pos()) -- get current position tile
onAddThing(function(tile, thing)
    if thing and thing:isStackable() then
      if thing:getId() == 3031 then -- found gold under character
        g_game.move(thing, { x = posx() + 1, y = posy(), z = posz() }, 1) -- push it away +1 x
      end
    end
end)