forked from mtcontrib/mobs_animal
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
e7dc5350a6
102
cow.lua
102
cow.lua
@ -19,7 +19,7 @@ mobs:register_mob("mobs_animal:cow", {
|
||||
mesh = "mobs_cow.b3d",
|
||||
textures = {
|
||||
{"mobs_cow.png"},
|
||||
{"mobs_cow2.png"},
|
||||
{"mobs_cow2.png"}
|
||||
},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
@ -57,7 +57,7 @@ mobs:register_mob("mobs_animal:cow", {
|
||||
die_start = 165,
|
||||
die_end = 185,
|
||||
die_speed = 10,
|
||||
die_loop = false,
|
||||
die_loop = false
|
||||
},
|
||||
follow = {
|
||||
"farming:wheat", "default:grass_1", "farming:barley",
|
||||
@ -89,9 +89,11 @@ mobs:register_mob("mobs_animal:cow", {
|
||||
|
||||
local tool = clicker:get_wielded_item()
|
||||
local name = clicker:get_player_name()
|
||||
local item = tool:get_name()
|
||||
|
||||
-- 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.child == true then
|
||||
@ -109,12 +111,18 @@ mobs:register_mob("mobs_animal:cow", {
|
||||
tool:take_item()
|
||||
clicker:set_wielded_item(tool)
|
||||
|
||||
if inv:room_for_item("main", {name = "mobs:bucket_milk"}) then
|
||||
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
|
||||
-- which bucket are we using
|
||||
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
|
||||
local pos = self.object:get_pos()
|
||||
pos.y = pos.y + 0.5
|
||||
minetest.add_item(pos, {name = "mobs:bucket_milk"})
|
||||
minetest.add_item(pos, {name = ret_item})
|
||||
end
|
||||
|
||||
self.gotten = true -- milked
|
||||
@ -132,7 +140,7 @@ mobs:register_mob("mobs_animal:cow", {
|
||||
self.food = 0
|
||||
self.gotten = false
|
||||
end
|
||||
end,
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
@ -143,10 +151,10 @@ mobs:spawn({
|
||||
neighbors = {"group:grass"},
|
||||
min_light = 14,
|
||||
interval = 60,
|
||||
chance = 8000, -- 15000
|
||||
chance = 8000,
|
||||
min_height = 5,
|
||||
max_height = 200,
|
||||
day_toggle = true,
|
||||
day_toggle = true
|
||||
})
|
||||
end
|
||||
|
||||
@ -175,18 +183,16 @@ minetest.register_craftitem(":mobs:glass_milk", {
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
-- type = "shapeless",
|
||||
output = "mobs:glass_milk 4",
|
||||
recipe = {
|
||||
{"vessels:drinking_glass", "vessels:drinking_glass"},
|
||||
{"vessels:drinking_glass", "vessels:drinking_glass"},
|
||||
{"mobs:bucket_milk", ""}
|
||||
},
|
||||
replacements = { {"mobs:bucket_milk", "bucket:bucket_empty"} }
|
||||
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
-- type = "shapeless",
|
||||
output = "mobs:bucket_milk",
|
||||
recipe = {
|
||||
{"group:food_milk_glass", "group:food_milk_glass"},
|
||||
@ -207,28 +213,24 @@ minetest.register_craftitem(":mobs:butter", {
|
||||
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
|
||||
minetest.register_craft({
|
||||
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"}}
|
||||
})
|
||||
salt_item = "farming:salt"
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mobs:butter",
|
||||
recipe = {{"mobs:bucket_milk", salt_item}},
|
||||
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
|
||||
})
|
||||
|
||||
-- cheese wedge
|
||||
minetest.register_craftitem(":mobs:cheese", {
|
||||
description = S("Cheese"),
|
||||
inventory_image = "mobs_cheese.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
groups = {food_cheese = 1, flammable = 2},
|
||||
groups = {food_cheese = 1, flammable = 2}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
@ -236,7 +238,7 @@ minetest.register_craft({
|
||||
output = "mobs:cheese",
|
||||
recipe = "mobs:bucket_milk",
|
||||
cooktime = 5,
|
||||
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
|
||||
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
|
||||
})
|
||||
|
||||
-- cheese block
|
||||
@ -253,15 +255,13 @@ minetest.register_craft({
|
||||
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"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mobs:cheese 9",
|
||||
recipe = {
|
||||
{"mobs:cheeseblock"},
|
||||
}
|
||||
recipe = {{"mobs:cheeseblock"}}
|
||||
})
|
||||
|
||||
-- Dung (from factory's fertilizer)
|
||||
@ -292,3 +292,43 @@ minetest.register_craft({
|
||||
recipe = "mobs:dung",
|
||||
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
|
||||
|
BIN
textures/mobs_wooden_bucket_milk.png
Normal file
BIN
textures/mobs_wooden_bucket_milk.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 195 B |
Loading…
Reference in New Issue
Block a user