1
0
Fork 0

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

This commit is contained in:
DinoNuggies4665 2023-06-05 17:12:57 -06:00 committed by ancientmarinerdev
parent d92296712c
commit 4616b6c3ec
2 changed files with 13 additions and 23 deletions

View File

@ -8,32 +8,23 @@ local drop_inventory = mcl_util.drop_items_from_meta_container("main")
local function drop_items(pos, node, oldmeta)
local meta = minetest.get_meta(pos)
drop_inventory(pos, node, oldmeta)
for i = 1, 4 do
local food_entity = nil
local food_x = tonumber(meta:get_string("food_x_"..tostring(i)))
local food_y = tonumber(meta:get_string("food_y_"..tostring(i)))
local food_z = tonumber(meta:get_string("food_z_"..tostring(i)))
if food_x and food_y and food_z then
local entites = minetest.get_objects_inside_radius({x = food_x, y = food_y, z = food_z}, 1)
local entites = minetest.get_objects_inside_radius(pos, 0.5)
minetest.chat_send_all("found entity")
if entites then
for _, food_entity in ipairs(entites) do
if food_entity then
if food_entity:get_luaentity().name == "mcl_campfires:food_entity" then
food_entity = entity
end
end
end
end
end
if food_entity then
minetest.chat_send_all("removed entity")
food_entity:remove()
for i = 1, 4 do
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
end
local function on_blast(pos)
@ -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),
}
minetest.chat_send_all("food added: pos = "..tostring(pos))
local food_entity = {nil,nil,nil,nil}
local is_creative = minetest.is_creative_enabled(player:get_player_name())
local inv = player:get_inventory()

View File

@ -53,6 +53,6 @@ minetest.register_entity("mcl_campfires:food_entity", {
pointable = false,
},
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,
})