Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bri cassa 2022-05-27 18:41:43 +02:00
commit e7dc5350a6
2 changed files with 71 additions and 31 deletions

102
cow.lua
View File

@ -19,7 +19,7 @@ mobs:register_mob("mobs_animal:cow", {
mesh = "mobs_cow.b3d", mesh = "mobs_cow.b3d",
textures = { textures = {
{"mobs_cow.png"}, {"mobs_cow.png"},
{"mobs_cow2.png"}, {"mobs_cow2.png"}
}, },
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { sounds = {
@ -57,7 +57,7 @@ mobs:register_mob("mobs_animal:cow", {
die_start = 165, die_start = 165,
die_end = 185, die_end = 185,
die_speed = 10, die_speed = 10,
die_loop = false, die_loop = false
}, },
follow = { follow = {
"farming:wheat", "default:grass_1", "farming:barley", "farming:wheat", "default:grass_1", "farming:barley",
@ -89,9 +89,11 @@ mobs:register_mob("mobs_animal:cow", {
local tool = clicker:get_wielded_item() local tool = clicker:get_wielded_item()
local name = clicker:get_player_name() local name = clicker:get_player_name()
local item = tool:get_name()
-- milk cow with empty bucket -- milk cow with empty bucket
if tool:get_name() == "bucket:bucket_empty" then if item == "bucket:bucket_empty"
or item == "wooden_bucket:bucket_wood_empty" then
--if self.gotten == true --if self.gotten == true
if self.child == true then if self.child == true then
@ -109,12 +111,18 @@ mobs:register_mob("mobs_animal:cow", {
tool:take_item() tool:take_item()
clicker:set_wielded_item(tool) clicker:set_wielded_item(tool)
if inv:room_for_item("main", {name = "mobs:bucket_milk"}) then -- which bucket are we using
clicker:get_inventory():add_item("main", "mobs:bucket_milk") local ret_item = "mobs:bucket_milk"
if item == "wooden_bucket:bucket_wood_empty" then
ret_item = "mobs:wooden_bucket_milk"
end
if inv:room_for_item("main", {name = ret_item}) then
clicker:get_inventory():add_item("main", ret_item)
else else
local pos = self.object:get_pos() local pos = self.object:get_pos()
pos.y = pos.y + 0.5 pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "mobs:bucket_milk"}) minetest.add_item(pos, {name = ret_item})
end end
self.gotten = true -- milked self.gotten = true -- milked
@ -132,7 +140,7 @@ mobs:register_mob("mobs_animal:cow", {
self.food = 0 self.food = 0
self.gotten = false self.gotten = false
end end
end, end
}) })
@ -143,10 +151,10 @@ mobs:spawn({
neighbors = {"group:grass"}, neighbors = {"group:grass"},
min_light = 14, min_light = 14,
interval = 60, interval = 60,
chance = 8000, -- 15000 chance = 8000,
min_height = 5, min_height = 5,
max_height = 200, max_height = 200,
day_toggle = true, day_toggle = true
}) })
end end
@ -175,18 +183,16 @@ minetest.register_craftitem(":mobs:glass_milk", {
}) })
minetest.register_craft({ minetest.register_craft({
-- type = "shapeless",
output = "mobs:glass_milk 4", output = "mobs:glass_milk 4",
recipe = { recipe = {
{"vessels:drinking_glass", "vessels:drinking_glass"}, {"vessels:drinking_glass", "vessels:drinking_glass"},
{"vessels:drinking_glass", "vessels:drinking_glass"}, {"vessels:drinking_glass", "vessels:drinking_glass"},
{"mobs:bucket_milk", ""} {"mobs:bucket_milk", ""}
}, },
replacements = { {"mobs:bucket_milk", "bucket:bucket_empty"} } replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
}) })
minetest.register_craft({ minetest.register_craft({
-- type = "shapeless",
output = "mobs:bucket_milk", output = "mobs:bucket_milk",
recipe = { recipe = {
{"group:food_milk_glass", "group:food_milk_glass"}, {"group:food_milk_glass", "group:food_milk_glass"},
@ -207,28 +213,24 @@ minetest.register_craftitem(":mobs:butter", {
groups = {food_butter = 1, flammable = 2} groups = {food_butter = 1, flammable = 2}
}) })
local salt_item = "default:sapling" -- some saplings are high in sodium
if minetest.get_modpath("farming") and farming and farming.mod then if minetest.get_modpath("farming") and farming and farming.mod then
minetest.register_craft({ salt_item = "farming:salt"
type = "shapeless",
output = "mobs:butter",
recipe = {"mobs:bucket_milk", "farming:salt"},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
else -- some saplings are high in sodium so makes a good replacement item
minetest.register_craft({
type = "shapeless",
output = "mobs:butter",
recipe = {"mobs:bucket_milk", "default:sapling"},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
end end
minetest.register_craft({
output = "mobs:butter",
recipe = {{"mobs:bucket_milk", salt_item}},
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- cheese wedge -- cheese wedge
minetest.register_craftitem(":mobs:cheese", { minetest.register_craftitem(":mobs:cheese", {
description = S("Cheese"), description = S("Cheese"),
inventory_image = "mobs_cheese.png", inventory_image = "mobs_cheese.png",
on_use = minetest.item_eat(4), on_use = minetest.item_eat(4),
groups = {food_cheese = 1, flammable = 2}, groups = {food_cheese = 1, flammable = 2}
}) })
minetest.register_craft({ minetest.register_craft({
@ -236,7 +238,7 @@ minetest.register_craft({
output = "mobs:cheese", output = "mobs:cheese",
recipe = "mobs:bucket_milk", recipe = "mobs:bucket_milk",
cooktime = 5, cooktime = 5,
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}} replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
}) })
-- cheese block -- cheese block
@ -253,15 +255,13 @@ minetest.register_craft({
recipe = { recipe = {
{"group:food_cheese", "group:food_cheese", "group:food_cheese"}, {"group:food_cheese", "group:food_cheese", "group:food_cheese"},
{"group:food_cheese", "group:food_cheese", "group:food_cheese"}, {"group:food_cheese", "group:food_cheese", "group:food_cheese"},
{"group:food_cheese", "group:food_cheese", "group:food_cheese"}, {"group:food_cheese", "group:food_cheese", "group:food_cheese"}
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "mobs:cheese 9", output = "mobs:cheese 9",
recipe = { recipe = {{"mobs:cheeseblock"}}
{"mobs:cheeseblock"},
}
}) })
-- Dung (from factory's fertilizer) -- Dung (from factory's fertilizer)
@ -292,3 +292,43 @@ minetest.register_craft({
recipe = "mobs:dung", recipe = "mobs:dung",
burntime = "8", burntime = "8",
}) })
-- check for wooden bucket mod and add compatibility
if minetest.get_modpath("wooden_bucket") then
minetest.register_craftitem(":mobs:wooden_bucket_milk", {
description = S("Wooden Bucket of Milk"),
inventory_image = "mobs_wooden_bucket_milk.png",
stack_max = 1,
on_use = minetest.item_eat(8, "wooden_bucket:bucket_wood_empty"),
groups = {food_milk = 1, flammable = 3, drink = 1}
})
minetest.register_craft({
output = "mobs:glass_milk 4",
recipe = {
{"vessels:drinking_glass", "vessels:drinking_glass"},
{"vessels:drinking_glass", "vessels:drinking_glass"},
{"mobs:wooden_bucket_milk", ""}
},
replacements = {{"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"}}
})
minetest.register_craft({
output = "mobs:wooden_bucket_milk",
recipe = {
{"group:food_milk_glass", "group:food_milk_glass"},
{"group:food_milk_glass", "group:food_milk_glass"},
{"wooden_bucket:bucket_wood_empty", ""}
},
replacements = {
{"group:food_milk_glass", "vessels:drinking_glass 4"}
}
})
minetest.register_craft({
output = "mobs:butter",
recipe = {{"mobs:wooden_bucket_milk", salt_item}},
replacements = {{"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"}}
})
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B