The food is now oriented the right direction when on the cooking on the campfire, and food entities are removed when the campfire is destroyed, still doesn't drop items though
parent
d92296712c
commit
4616b6c3ec
|
@ -8,31 +8,22 @@ local drop_inventory = mcl_util.drop_items_from_meta_container("main")
|
||||||
local function drop_items(pos, node, oldmeta)
|
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)
|
||||||
for i = 1, 4 do
|
local entites = minetest.get_objects_inside_radius(pos, 0.5)
|
||||||
local food_entity = nil
|
minetest.chat_send_all("found entity")
|
||||||
local food_x = tonumber(meta:get_string("food_x_"..tostring(i)))
|
if entites then
|
||||||
local food_y = tonumber(meta:get_string("food_y_"..tostring(i)))
|
for _, food_entity in ipairs(entites) do
|
||||||
local food_z = tonumber(meta:get_string("food_z_"..tostring(i)))
|
if food_entity then
|
||||||
if food_x and food_y and food_z then
|
if food_entity:get_luaentity().name == "mcl_campfires:food_entity" then
|
||||||
local entites = minetest.get_objects_inside_radius({x = food_x, y = food_y, z = food_z}, 1)
|
minetest.chat_send_all("removed entity")
|
||||||
minetest.chat_send_all("found entity")
|
food_entity:remove()
|
||||||
if entites then
|
for i = 1, 4 do
|
||||||
for _, food_entity in ipairs(entites) do
|
meta:set_string("food_x_"..tostring(i), nil)
|
||||||
if food_entity then
|
meta:set_string("food_y_"..tostring(i), nil)
|
||||||
if food_entity:get_luaentity().name == "mcl_campfires:food_entity" then
|
meta:set_string("food_z_"..tostring(i), nil)
|
||||||
food_entity = entity
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if food_entity then
|
|
||||||
minetest.chat_send_all("removed entity")
|
|
||||||
food_entity:remove()
|
|
||||||
meta:set_string("food_x_"..tostring(i), nil)
|
|
||||||
meta:set_string("food_y_"..tostring(i), nil)
|
|
||||||
meta:set_string("food_z_"..tostring(i), nil)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -56,7 +47,6 @@ function mcl_campfires.take_item(pos, node, player, itemstack)
|
||||||
vector.new( 0.25, -0.04, 0.25),
|
vector.new( 0.25, -0.04, 0.25),
|
||||||
vector.new(-0.25, -0.04, 0.25),
|
vector.new(-0.25, -0.04, 0.25),
|
||||||
}
|
}
|
||||||
minetest.chat_send_all("food added: pos = "..tostring(pos))
|
|
||||||
local food_entity = {nil,nil,nil,nil}
|
local food_entity = {nil,nil,nil,nil}
|
||||||
local is_creative = minetest.is_creative_enabled(player:get_player_name())
|
local is_creative = minetest.is_creative_enabled(player:get_player_name())
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
|
|
|
@ -53,6 +53,6 @@ minetest.register_entity("mcl_campfires:food_entity", {
|
||||||
pointable = false,
|
pointable = false,
|
||||||
},
|
},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.object:set_rotation({x = math.pi / 2, y = 0, z = 0})
|
self.object:set_rotation({x = math.pi / -2, y = 0, z = 0})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue