Cannot drop unknown items into world
This commit is contained in:
parent
2064cf27e1
commit
a28fa04534
7
init.lua
7
init.lua
@ -1,4 +1,4 @@
|
|||||||
-- Minetest: builtin/item_entity.lua (16th September 2015)
|
-- Minetest: builtin/item_entity.lua (30th September 2015)
|
||||||
|
|
||||||
-- water flow functions by QwertyMine3 and edited by TenPlus1
|
-- water flow functions by QwertyMine3 and edited by TenPlus1
|
||||||
local function to_unit_vector(dir_vector)
|
local function to_unit_vector(dir_vector)
|
||||||
@ -140,12 +140,15 @@ function core.spawn_item(pos, item)
|
|||||||
-- take item in any format
|
-- take item in any format
|
||||||
local stack = ItemStack(item)
|
local stack = ItemStack(item)
|
||||||
local obj = core.add_entity(pos, "__builtin:item")
|
local obj = core.add_entity(pos, "__builtin:item")
|
||||||
|
-- Don't use obj if it couldn't be added to the map.
|
||||||
|
if obj then
|
||||||
obj:get_luaentity():set_item(stack:to_string())
|
obj:get_luaentity():set_item(stack:to_string())
|
||||||
|
end
|
||||||
return obj
|
return obj
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if item_entity_ttl is not set, enity will have default life time
|
-- if item_entity_ttl is not set, enity will have default life time
|
||||||
-- or setting to -1 disables the feature
|
-- setting to -1 disables the feature
|
||||||
local time_to_live = tonumber(core.setting_get("item_entity_ttl")) or 900
|
local time_to_live = tonumber(core.setting_get("item_entity_ttl")) or 900
|
||||||
|
|
||||||
-- if destroy_item is 1 then dropped items will burn inside lava
|
-- if destroy_item is 1 then dropped items will burn inside lava
|
||||||
|
Loading…
x
Reference in New Issue
Block a user