Page 1 of 1

Local server crash on modified function

PostPosted: Mon Dec 10, 2012 11:39
by LorenzoVulcan
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    on_punch = function(self, hitter)

        if self.itemstring ~= '' then
        local items= minetest.env:get_objects_inside_radius(hitter:getpos(), 3)
        for _,item in ipairs(items) do
            if not item:is_player() and item:get_luaentity() then

                hitter:get_inventory():add_item("main", ItemStack(item:get_luaentity().itemstring)) end
                item:remove()
            end
        end
    end,


This works,but instantly makes the server crash.
Tested in a singleplayer world,all it's freezed.No node dropping,no world loading,no crafting.When i pickup a radius of 3 nodes,world crashes.

This is a modification to "__builtin:item" in "builtin/item_entity.lua".
Can anyone help me?

EDIT:Solved

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    on_punch = function(self, hitter)

        if self.itemstring ~= '' then

        local items= minetest.env:get_objects_inside_radius(self.object:getpos(), 2)

        for _,item in ipairs(items) do
            local ent=item:get_luaentity()
            if ent then

                hitter:get_inventory():add_item("main", ItemStack(ent.itemstring))

                item:remove() end
            end
        end

    end,