forked from VoxeLibre/VoxeLibre
Food entities don't turn back to mutton when leaving a re-joining now
This commit is contained in:
parent
4616b6c3ec
commit
61f489e71f
|
@ -9,12 +9,10 @@ local function drop_items(pos, node, oldmeta)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
drop_inventory(pos, node, oldmeta)
|
drop_inventory(pos, node, oldmeta)
|
||||||
local entites = minetest.get_objects_inside_radius(pos, 0.5)
|
local entites = minetest.get_objects_inside_radius(pos, 0.5)
|
||||||
minetest.chat_send_all("found entity")
|
|
||||||
if entites then
|
if entites then
|
||||||
for _, food_entity in ipairs(entites) do
|
for _, food_entity in ipairs(entites) do
|
||||||
if food_entity then
|
if food_entity then
|
||||||
if food_entity:get_luaentity().name == "mcl_campfires:food_entity" then
|
if food_entity:get_luaentity().name == "mcl_campfires:food_entity" then
|
||||||
minetest.chat_send_all("removed entity")
|
|
||||||
food_entity:remove()
|
food_entity:remove()
|
||||||
for i = 1, 4 do
|
for i = 1, 4 do
|
||||||
meta:set_string("food_x_"..tostring(i), nil)
|
meta:set_string("food_x_"..tostring(i), nil)
|
||||||
|
@ -93,8 +91,7 @@ function mcl_campfires.cook_item(pos, elapsed)
|
||||||
local food_y = tonumber(meta:get_string("food_y_"..tostring(i)))
|
local food_y = tonumber(meta:get_string("food_y_"..tostring(i)))
|
||||||
local food_z = tonumber(meta:get_string("food_z_"..tostring(i)))
|
local food_z = tonumber(meta:get_string("food_z_"..tostring(i)))
|
||||||
if food_x and food_y and food_z then
|
if food_x and food_y and food_z then
|
||||||
minetest.chat_send_all("X: "..food_x.." Y: "..food_y.." Z: "..food_z)
|
local entites = minetest.get_objects_inside_radius({x = food_x, y = food_y, z = food_z}, 0)
|
||||||
local entites = minetest.get_objects_inside_radius({x = food_x, y = food_y, z = food_z}, 1)
|
|
||||||
if entites then
|
if entites then
|
||||||
for _, entity in ipairs(entites) do
|
for _, entity in ipairs(entites) do
|
||||||
if entity then
|
if entity then
|
||||||
|
@ -103,6 +100,9 @@ function mcl_campfires.cook_item(pos, elapsed)
|
||||||
name = luaentity.name
|
name = luaentity.name
|
||||||
if name == "mcl_campfires:food_entity" then
|
if name == "mcl_campfires:food_entity" then
|
||||||
food_entity = entity
|
food_entity = entity
|
||||||
|
luaentity.wield_item = inv:get_stack("main", i):get_name()
|
||||||
|
luaentity.wield_image = "mcl_mobitems_"..string.sub(inv:get_stack("main", i):get_name(), 14).."_raw.png"
|
||||||
|
food_entity:set_properties(luaentity)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue