mirror of
https://github.com/minetest-mods/item_drop.git
synced 2024-12-22 22:02:26 +01:00
commit
1901524074
17
init.lua
17
init.lua
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user