|
@@ -1,5 +1,5 @@
|
|
|
|
|
|
-local S = mobs.intllib
|
|
|
+local S = mobs.intllib_animal
|
|
|
|
|
|
|
|
|
-- Cow by sirrobzeroone
|
|
@@ -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 = {
|
|
@@ -32,7 +32,7 @@ mobs:register_mob("mobs_animal:cow", {
|
|
|
pushable = true,
|
|
|
drops = {
|
|
|
{name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
|
|
|
- {name = "mobs:leather", chance = 1, min = 0, max = 2},
|
|
|
+ {name = "mobs:leather", chance = 1, min = 0, max = 2}
|
|
|
},
|
|
|
water_damage = 0,
|
|
|
lava_damage = 5,
|
|
@@ -56,7 +56,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",
|
|
@@ -70,6 +70,7 @@ mobs:register_mob("mobs_animal:cow", {
|
|
|
},
|
|
|
-- stay_near = {{"farming:straw", "group:grass"}, 10},
|
|
|
fear_height = 2,
|
|
|
+
|
|
|
on_rightclick = function(self, clicker)
|
|
|
|
|
|
-- feed or tame
|
|
@@ -88,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
|
|
@@ -98,8 +101,9 @@ mobs:register_mob("mobs_animal:cow", {
|
|
|
end
|
|
|
|
|
|
if self.gotten == true then
|
|
|
- minetest.chat_send_player(name,
|
|
|
- S("Cow already milked!"))
|
|
|
+
|
|
|
+ minetest.chat_send_player(name, S("Cow already milked!"))
|
|
|
+
|
|
|
return
|
|
|
end
|
|
|
|
|
@@ -108,12 +112,21 @@ 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
|
|
@@ -131,22 +144,23 @@ mobs:register_mob("mobs_animal:cow", {
|
|
|
self.food = 0
|
|
|
self.gotten = false
|
|
|
end
|
|
|
- end,
|
|
|
+ end
|
|
|
})
|
|
|
|
|
|
|
|
|
if not mobs.custom_spawn_animal then
|
|
|
-mobs:spawn({
|
|
|
- name = "mobs_animal:cow",
|
|
|
- nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
|
|
|
- neighbors = {"group:grass"},
|
|
|
- min_light = 14,
|
|
|
- interval = 60,
|
|
|
- chance = 8000, -- 15000
|
|
|
- min_height = 5,
|
|
|
- max_height = 200,
|
|
|
- day_toggle = true,
|
|
|
-})
|
|
|
+
|
|
|
+ mobs:spawn({
|
|
|
+ name = "mobs_animal:cow",
|
|
|
+ nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
|
|
|
+ neighbors = {"group:grass"},
|
|
|
+ min_light = 14,
|
|
|
+ interval = 60,
|
|
|
+ chance = 8000,
|
|
|
+ min_height = 5,
|
|
|
+ max_height = 200,
|
|
|
+ day_toggle = true
|
|
|
+ })
|
|
|
end
|
|
|
|
|
|
|
|
@@ -162,7 +176,7 @@ minetest.register_craftitem(":mobs:bucket_milk", {
|
|
|
inventory_image = "mobs_bucket_milk.png",
|
|
|
stack_max = 1,
|
|
|
on_use = minetest.item_eat(8, "bucket:bucket_empty"),
|
|
|
- groups = {food_milk = 1, flammable = 3, drink = 1},
|
|
|
+ groups = {food_milk = 1, flammable = 3, drink = 1}
|
|
|
})
|
|
|
|
|
|
-- glass of milk
|
|
@@ -170,22 +184,20 @@ minetest.register_craftitem(":mobs:glass_milk", {
|
|
|
description = S("Glass of Milk"),
|
|
|
inventory_image = "mobs_glass_milk.png",
|
|
|
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
|
|
|
- groups = {food_milk_glass = 1, flammable = 3, vessel = 1, drink = 1},
|
|
|
+ groups = {food_milk_glass = 1, flammable = 3, vessel = 1, drink = 1}
|
|
|
})
|
|
|
|
|
|
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"},
|
|
@@ -206,28 +218,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
|
|
|
+ salt_item = "farming:salt"
|
|
|
+end
|
|
|
+
|
|
|
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"}}
|
|
|
+ recipe = {{"mobs:bucket_milk", salt_item}},
|
|
|
+ replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
|
|
|
})
|
|
|
-end
|
|
|
|
|
|
-- 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({
|
|
@@ -235,7 +243,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
|
|
@@ -252,13 +260,52 @@ 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"}}
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
+-- 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
|