2017-05-16 04:48:28 +02:00
|
|
|
|
2017-07-25 22:28:40 +02:00
|
|
|
-- Sheep by PilzAdam; tweaked for Pixture by KaadmY
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2019-08-28 17:31:41 +02:00
|
|
|
local S = minetest.get_translator("mobs")
|
|
|
|
|
2015-09-01 17:15:24 +02:00
|
|
|
mobs:register_mob(
|
|
|
|
"mobs:sheep",
|
|
|
|
{
|
|
|
|
type = "animal",
|
|
|
|
passive = true,
|
2015-10-23 19:34:09 +02:00
|
|
|
hp_min = 10,
|
2015-09-01 17:15:24 +02:00
|
|
|
hp_max = 14,
|
2019-09-25 13:43:57 +02:00
|
|
|
breath_max = 5,
|
2015-09-01 17:15:24 +02:00
|
|
|
armor = 200,
|
2015-10-25 02:12:37 +02:00
|
|
|
collisionbox = {-0.5, -1, -0.5, 0.5, 0.1, 0.5},
|
2015-09-01 17:15:24 +02:00
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_sheep.x",
|
|
|
|
visual_size = {x = 1, y = 1},
|
|
|
|
textures = {
|
|
|
|
{"mobs_sheep.png"},
|
|
|
|
},
|
|
|
|
gotten_texture = {"mobs_sheep_shaved.png"},
|
2017-05-16 04:48:28 +02:00
|
|
|
-- gotten_mesh = "mobs_sheep.x",
|
2015-09-01 17:15:24 +02:00
|
|
|
makes_footstep_sound = true,
|
|
|
|
sounds = {
|
|
|
|
random = "mobs_sheep",
|
2019-09-03 20:01:56 +02:00
|
|
|
death = "mobs_sheep",
|
2019-09-22 13:39:16 +02:00
|
|
|
damage = "mobs_sheep",
|
2015-09-06 03:38:44 +02:00
|
|
|
distance = 16,
|
2015-09-01 17:15:24 +02:00
|
|
|
},
|
|
|
|
walk_velocity = 1,
|
|
|
|
walk_chance = 150,
|
2016-02-27 20:10:02 +01:00
|
|
|
jump = false,
|
2015-09-01 17:15:24 +02:00
|
|
|
jump_height = 5,
|
|
|
|
drops = {
|
|
|
|
{name = "mobs:meat_raw",
|
|
|
|
chance = 1, min = 2, max = 4},
|
|
|
|
{name = "mobs:wool",
|
|
|
|
chance = 1, min = 1, max = 2},
|
|
|
|
},
|
2019-09-25 13:43:57 +02:00
|
|
|
water_damage = 0,
|
2015-09-01 17:15:24 +02:00
|
|
|
lava_damage = 5,
|
|
|
|
light_damage = 0,
|
|
|
|
animation = {
|
|
|
|
speed_normal = 15,
|
|
|
|
speed_run = 25,
|
|
|
|
stand_start = 0,
|
|
|
|
stand_end = 60,
|
|
|
|
walk_start = 61,
|
|
|
|
walk_end = 80,
|
|
|
|
},
|
|
|
|
follow = "farming:wheat",
|
|
|
|
view_range = 5,
|
|
|
|
replace_rate = 50,
|
2017-05-16 04:48:28 +02:00
|
|
|
replace_what = {
|
|
|
|
"default:grass",
|
|
|
|
"default:tall_grass",
|
|
|
|
"farming:wheat_3",
|
|
|
|
"farming:wheat_4"
|
|
|
|
},
|
2015-09-01 17:15:24 +02:00
|
|
|
replace_with = "air",
|
|
|
|
replace_offset = -1,
|
2017-05-16 04:48:28 +02:00
|
|
|
|
2015-09-01 17:15:24 +02:00
|
|
|
on_replace = function(self, pos)
|
2017-05-16 04:48:28 +02:00
|
|
|
minetest.set_node(pos, {name = self.replace_with})
|
|
|
|
|
|
|
|
if mobs:feed_tame(self, self.follow, 8, true) then
|
|
|
|
if self.gotten == false then
|
|
|
|
self.object:set_properties(
|
|
|
|
{
|
|
|
|
textures = {"mobs_sheep.png"},
|
|
|
|
mesh = "mobs_sheep.x",
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
2015-09-01 17:15:24 +02:00
|
|
|
on_rightclick = function(self, clicker)
|
2017-05-16 04:48:28 +02:00
|
|
|
-- Are we feeding?
|
|
|
|
|
|
|
|
if mobs:feed_tame(self, clicker, 8, true) then
|
|
|
|
-- If full grow, add fuzz
|
|
|
|
|
|
|
|
if self.gotten == false then
|
|
|
|
self.object:set_properties(
|
|
|
|
{
|
|
|
|
textures = {"mobs_sheep.png"},
|
|
|
|
mesh = "mobs_sheep.x",
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local item = clicker:get_wielded_item()
|
|
|
|
local itemname = item:get_name()
|
|
|
|
|
|
|
|
-- Are we giving a haircut?
|
|
|
|
|
2019-09-24 03:05:06 +02:00
|
|
|
if minetest.get_item_group(itemname, "shears") > 0 then
|
2017-05-16 04:48:28 +02:00
|
|
|
if self.gotten == false and self.child == false then
|
|
|
|
self.gotten = true -- shaved
|
2019-03-20 15:04:20 +01:00
|
|
|
local pos = self.object:get_pos()
|
2017-05-16 04:48:28 +02:00
|
|
|
pos.y = pos.y + 0.5
|
|
|
|
local obj = minetest.add_item(pos, ItemStack("mobs:wool"))
|
|
|
|
if obj then
|
2019-03-20 15:04:20 +01:00
|
|
|
obj:set_velocity(
|
2017-05-16 04:48:28 +02:00
|
|
|
{
|
|
|
|
x = math.random(-1,1),
|
|
|
|
y = 5,
|
|
|
|
z = math.random(-1,1)
|
|
|
|
})
|
|
|
|
end
|
2019-08-31 00:07:26 +02:00
|
|
|
if not minetest.settings:get_bool("creative_mode") then
|
2019-09-24 03:48:27 +02:00
|
|
|
local def = item:get_definition()
|
|
|
|
local cuts = minetest.get_item_group(itemname, "sheep_cuts")
|
|
|
|
if cuts > 0 then
|
|
|
|
item:add_wear(math.floor(65535 / cuts))
|
|
|
|
else
|
|
|
|
item:add_wear(math.floor(65535 / def.tool_capabilities.snappy.uses))
|
|
|
|
end
|
2019-08-31 00:07:26 +02:00
|
|
|
end
|
2017-05-16 04:48:28 +02:00
|
|
|
clicker:set_wielded_item(item)
|
|
|
|
self.object:set_properties(
|
|
|
|
{
|
|
|
|
textures = {"mobs_sheep_shaved.png"},
|
|
|
|
mesh = "mobs_sheep.x",
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Are we capturing?
|
|
|
|
|
|
|
|
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
|
|
|
|
end,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
mobs:register_spawn(
|
|
|
|
"mobs:sheep",
|
|
|
|
{
|
|
|
|
"default:dirt_with_grass"
|
|
|
|
},
|
|
|
|
20,
|
|
|
|
10,
|
|
|
|
15000,
|
|
|
|
1,
|
|
|
|
31000
|
|
|
|
)
|
2015-09-01 17:15:24 +02:00
|
|
|
|
2019-08-28 17:31:41 +02:00
|
|
|
mobs:register_egg("mobs:sheep", S("Sheep"), "mobs_sheep_inventory.png")
|