fix:egg dissapears while holding a full stack of the same eggs; eggs max stack set to 64

master
root 2022-06-12 09:28:16 +02:00
parent 87e20a0f80
commit d2d3cedf05
4 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,3 @@
local _id = 0
function kitz.logon_mob(self)
table.insert(kitz.active_mobs, self.object)
end

View File

@ -42,7 +42,8 @@ end
petz.extract_egg_from_nest = function(pos, player, itemstack, egg_type)
local inv = player:get_inventory()
if inv:room_for_item("main", egg_type) then
if itemstack:get_name() == egg_type or itemstack:get_name() == "" then
if ((itemstack:get_name() == egg_type) and not(itemstack:get_count() >= itemstack:get_stack_max()))
or (itemstack:get_name() == "") then
itemstack:add_item(egg_type)
else
inv:add_item("main", egg_type) --add the egg to the player's inventory

View File

@ -6,6 +6,7 @@ minetest.register_craftitem("petz:ducky_egg", {
description = S("Ducky Egg"),
inventory_image = "petz_ducky_egg.png",
wield_image = "petz_ducky_egg.png",
stack_max = 64,
on_use = minetest.item_eat(2),
groups = {flammable = 2, food = 2, food_egg = 1},
})
@ -14,6 +15,7 @@ minetest.register_craftitem("petz:chicken_egg", {
description = S("Chicken Egg"),
inventory_image = "petz_chicken_egg.png",
wield_image = "petz_chicken_egg.png",
stack_max = 64,
on_use = minetest.item_eat(2),
groups = {flammable = 2, food = 2, food_egg = 1},
})