Custom dropped items for Minetest

tenplus1 2bdcdb930e Code tidy (thanks Gustavo6046) 6 months ago
sounds 06fcfa8d1a 1st commit 7 years ago
textures 06fcfa8d1a 1st commit 7 years ago
.gitignore 06fcfa8d1a 1st commit 7 years ago afe8f70945 change license to LGPLv2.1+ 6 months ago
depends.txt 43a3e7ad66 updated readme 5 years ago
init.lua 2bdcdb930e Code tidy (thanks Gustavo6046) 6 months ago
mod.conf e24812a834 update mod.conf info 1 year ago
settingtypes.txt 6eceac6e0e update water flow and split functions (thanks Gustavo 6046) 1 year ago

item_entity.lua replacement

edited by TenPlus1


  • Items are destroyed by lava
  • Items are pushed along by flowing water (thanks to QwertyMine3 and Gustavo6046)
  • Items are removed after 900 seconds or the time that is specified by remove_items in minetest.conf (-1 disables it)
  • Particle effects added
  • Dropped items slide on nodes with {slippery} groups
  • Items stuck inside solid nodes move to nearest empty space
  • Added 'dropped_step(self, pos, dtime, moveresult)' custom on_step for dropped items 'self.node_inside' contains node table that item is inside 'self.def_inside' contains node definition for above 'self.node_under' contains node table that is below item 'self.def_under' contains node definition for above 'self.age' holds age of dropped item in seconds 'self.itemstring' contains itemstring e.g. "default:dirt", "default:ice 20" 'self.is_moving' true if dropped item is moving 'pos' holds position of dropped item 'dtime' used for timers 'moveresult' table containing collision info

return false to skip further checks by builtin_item

License: LGPLv2.1+

dropped_step() examples:

-- if gunpowder dropped on burning tnt or gunpowder then remove

if minetest.registered_items["tnt:gunpowder"] then

minetest.override_item("tnt:gunpowder", {

    dropped_step = function(self, pos)

        if (self.node_inside
        and == "tnt:gunpowder_burning")
        or (self.node_under
        and == "tnt:tnt_burning") then

            minetest.sound_play("builtin_item_lava", {
                pos = pos,
                max_hear_distance = 6,
                gain = 0.5

            self.itemstring = ""

            return false -- return with no further action


-- if 2x mese crystal and 2x crystal spike dropped in pool of water_source -- then merge into a single crystal_ingot.

if minetest.registered_items["ethereal:crystal_spike"] then

minetest.override_item("ethereal:crystal_spike", {

    dropped_step = function(self, pos, dtime)

        self.ctimer = (self.ctimer or 0) + dtime
        if self.ctimer < 5.0 then return end
        self.ctimer = 0

        if self.node_inside
        and ~= "default:water_source" then

        local objs = core.get_objects_inside_radius(pos, 0.8)

        if not objs or #objs ~= 2 then return end

        local crystal, mese, ent = nil, nil, nil

        for k, obj in pairs(objs) do

            ent = obj:get_luaentity()

            if ent and == "__builtin:item" then

                if ent.itemstring == "default:mese_crystal 2"
                and not mese then

                    mese = obj

                elseif ent.itemstring == "ethereal:crystal_spike 2"
                and not crystal then

                    crystal = obj

        if mese and crystal then


            core.add_item(pos, "ethereal:crystal_ingot")

            return false -- return with no further action