cows can be milked using both wooden bucket mods

This commit is contained in:
tenplus1 2023-05-01 10:00:03 +01:00
parent 1a3a38b59e
commit 9c00204154
1 changed files with 16 additions and 8 deletions

24
cow.lua
View File

@ -93,7 +93,8 @@ mobs:register_mob("mobs_animal:cow", {
-- milk cow with empty bucket -- milk cow with empty bucket
if item == "bucket:bucket_empty" if item == "bucket:bucket_empty"
or item == "wooden_bucket:bucket_wood_empty" then or item == "wooden_bucket:bucket_wood_empty"
or item == "bucket_wooden:bucket_empty" then
--if self.gotten == true --if self.gotten == true
if self.child == true then if self.child == true then
@ -115,7 +116,8 @@ mobs:register_mob("mobs_animal:cow", {
-- which bucket are we using -- which bucket are we using
local ret_item = "mobs:bucket_milk" local ret_item = "mobs:bucket_milk"
if item == "wooden_bucket:bucket_wood_empty" then if item == "wooden_bucket:bucket_wood_empty"
or item == "bucket_wooden:bucket_empty" then
ret_item = "mobs:wooden_bucket_milk" ret_item = "mobs:wooden_bucket_milk"
end end
@ -270,14 +272,20 @@ minetest.register_craft({
}) })
-- check for wooden bucket mod and add compatibility -- check for either of the wood bucket mods and add compatibility
if minetest.get_modpath("wooden_bucket") then local wb = minetest.get_modpath("wooden_bucket")
local bw = minetest.get_modpath("bucket_wooden")
if wb or bw then
local return_item = wb and "wooden_bucket:bucket_wood_empty"
or "bucket_wooden:bucket_empty"
minetest.register_craftitem(":mobs:wooden_bucket_milk", { minetest.register_craftitem(":mobs:wooden_bucket_milk", {
description = S("Wooden Bucket of Milk"), description = S("Wooden Bucket of Milk"),
inventory_image = "mobs_wooden_bucket_milk.png", inventory_image = "mobs_wooden_bucket_milk.png",
stack_max = 1, stack_max = 1,
on_use = minetest.item_eat(8, "wooden_bucket:bucket_wood_empty"), on_use = minetest.item_eat(8, return_item),
groups = {food_milk = 1, flammable = 3, drink = 1} groups = {food_milk = 1, flammable = 3, drink = 1}
}) })
@ -288,7 +296,7 @@ if minetest.get_modpath("wooden_bucket") then
{"vessels:drinking_glass", "vessels:drinking_glass"}, {"vessels:drinking_glass", "vessels:drinking_glass"},
{"mobs:wooden_bucket_milk", ""} {"mobs:wooden_bucket_milk", ""}
}, },
replacements = {{"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"}} replacements = {{"mobs:wooden_bucket_milk", return_item}}
}) })
minetest.register_craft({ minetest.register_craft({
@ -296,7 +304,7 @@ if minetest.get_modpath("wooden_bucket") then
recipe = { recipe = {
{"group:food_milk_glass", "group:food_milk_glass"}, {"group:food_milk_glass", "group:food_milk_glass"},
{"group:food_milk_glass", "group:food_milk_glass"}, {"group:food_milk_glass", "group:food_milk_glass"},
{"wooden_bucket:bucket_wood_empty", ""} {return_item, ""}
}, },
replacements = { replacements = {
{"group:food_milk_glass", "vessels:drinking_glass 4"} {"group:food_milk_glass", "vessels:drinking_glass 4"}
@ -306,6 +314,6 @@ if minetest.get_modpath("wooden_bucket") then
minetest.register_craft({ minetest.register_craft({
output = "mobs:butter", output = "mobs:butter",
recipe = {{"mobs:wooden_bucket_milk", salt_item}}, recipe = {{"mobs:wooden_bucket_milk", salt_item}},
replacements = {{"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"}} replacements = {{"mobs:wooden_bucket_milk", return_item}}
}) })
end end