Merge pull request #14 from minetest-mods/dev

Bug fixes
This commit is contained in:
texmex 2018-06-23 10:13:55 +02:00 committed by GitHub
commit 1901524074

@ -47,7 +47,7 @@ minetest.settings:get_bool("enable_item_pickup") ~= false then
if pickup_particle then if pickup_particle then
local item = minetest.registered_nodes[ent.itemstring:gsub("(.*)%s.*$","%1")] local item = minetest.registered_nodes[ent.itemstring:gsub("(.*)%s.*$","%1")]
local image = "" local image = ""
if minetest.registered_items[item.name] and minetest.registered_items[item.name].tiles then if item and minetest.registered_items[item.name] and minetest.registered_items[item.name].tiles then
if minetest.registered_items[item.name].tiles[1] then if minetest.registered_items[item.name].tiles[1] then
local dt = minetest.registered_items[item.name].drawtype local dt = minetest.registered_items[item.name].drawtype
if dt == "normal" or dt == "allfaces" or dt == "allfaces_optional" if dt == "normal" or dt == "allfaces" or dt == "allfaces_optional"
@ -64,18 +64,12 @@ minetest.settings:get_bool("enable_item_pickup") ~= false then
if not right then right = left end if not right then right = left end
if (type(right) == "table") then right = right.item end if (type(right) == "table") then right = right.item end
image = "[inventorycube{"..top.."{"..left.."{"..right image = minetest.inventorycube(top, left, right)
else else
image = minetest.registered_items[item.name].inventory_image image = minetest.registered_items[item.name].inventory_image
if not image then image = minetest.registered_items[item.name].tiles[1] end if not image then image = minetest.registered_items[item.name].tiles[1] end
end end
end end
end
if item then
local texture = item.tiles[1] or item.inventory_image or ""
if item.drawtype == "normal" then
texture = item.tiles
end
minetest.add_particle({ minetest.add_particle({
pos = {x = pos.x, y = pos.y + 1.5, z = pos.z}, pos = {x = pos.x, y = pos.y + 1.5, z = pos.z},
velocity = {x = 0, y = 1, z = 0}, velocity = {x = 0, y = 1, z = 0},
@ -266,10 +260,15 @@ and not minetest.settings:get_bool("creative_mode") then
name = item:get_name() name = item:get_name()
end end
if name == "" then
-- Sometimes nothing should be dropped
count = 0
end
for _ = 1,count do for _ = 1,count do
local obj = minetest.add_item(pos, name) local obj = minetest.add_item(pos, name)
if not obj then if not obj then
error("Couldn't spawn item") error("Couldn't spawn item " .. name .. ", drops: " .. dump(drops))
end end
local vel = obj:getvelocity() local vel = obj:getvelocity()