VoxeLibre/mods/ENTITIES/mobs_mc/chicken.lua

135 lines
2.6 KiB
Lua
Raw Normal View History

2017-07-05 04:15:46 +03:00
--License for code WTFPL and otherwise stated in readmes
local S = minetest.get_translator("mobs_mc")
2017-07-05 04:15:46 +03:00
--###################
--################### CHICKEN
--###################
mobs:register_mob("mobs_mc:chicken", {
2021-04-25 18:30:15 +03:00
description = S("Chicken"),
2017-07-05 04:15:46 +03:00
type = "animal",
2020-04-11 03:46:03 +03:00
spawn_class = "passive",
2017-07-05 04:15:46 +03:00
hp_min = 4,
hp_max = 4,
2020-12-06 17:46:42 +03:00
xp_min = 1,
xp_max = 3,
2017-07-05 04:15:46 +03:00
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.69, 0.2},
runaway = true,
2017-07-05 04:15:46 +03:00
floats = 1,
visual = "mesh",
mesh = "mobs_mc_chicken.b3d",
textures = {
{"mobs_mc_chicken.png"},
},
visual_size = {x=2.2, y=2.2},
2017-07-05 04:15:46 +03:00
makes_footstep_sound = true,
walk_velocity = 1,
drops = {
{name = mobs_mc.items.chicken_raw,
chance = 1,
min = 1,
2020-12-23 19:41:42 +03:00
max = 1,
looting = "common",},
2017-07-05 04:15:46 +03:00
{name = mobs_mc.items.feather,
chance = 1,
min = 0,
2020-12-23 19:41:42 +03:00
max = 2,
looting = "common",},
2017-07-05 04:15:46 +03:00
},
fall_damage = 0,
fall_speed = -2.25,
sounds = {
2020-12-05 18:44:01 +03:00
random = "mobs_mc_chicken_buck",
damage = "mobs_mc_chicken_hurt",
death = "mobs_mc_chicken_hurt",
2020-12-06 01:37:12 +03:00
eat = "mobs_mc_animal_eat_generic",
2017-07-05 04:15:46 +03:00
distance = 16,
},
2019-12-09 14:17:51 +03:00
sounds_child = {
random = "mobs_mc_chicken_child",
damage = "mobs_mc_chicken_child",
death = "mobs_mc_chicken_child",
2020-12-06 01:37:12 +03:00
eat = "mobs_mc_animal_eat_generic",
2019-12-09 14:17:51 +03:00
distance = 16,
},
2017-07-05 04:15:46 +03:00
animation = {
stand_speed = 25, walk_speed = 25, run_speed = 50,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
follow = mobs_mc.follow.chicken,
2017-07-05 04:15:46 +03:00
view_range = 16,
fear_height = 4,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
2017-07-05 04:15:46 +03:00
end,
do_custom = function(self, dtime)
self.egg_timer = (self.egg_timer or 0) + dtime
if self.egg_timer < 10 then
return
end
self.egg_timer = 0
if self.child
or math.random(1, 100) > 1 then
return
end
2019-02-01 08:33:07 +03:00
local pos = self.object:get_pos()
2017-07-05 04:15:46 +03:00
minetest.add_item(pos, mobs_mc.items.egg)
minetest.sound_play("mobs_mc_chicken_lay_egg", {
pos = pos,
gain = 1.0,
max_hear_distance = 16,
2020-04-07 01:55:45 +03:00
}, true)
2021-04-25 18:30:15 +03:00
end,
2017-07-05 04:15:46 +03:00
})
--spawn
mobs:spawn_specific(
2021-04-25 18:30:15 +03:00
"mobs_mc:chicken",
"overworld",
"ground",
{
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"ColdTaiga",
"SunflowerPlains",
"RoofedForest",
"MesaPlateauFM_grasstop",
"ExtremeHillsM",
"BirchForestM",
2021-04-08 14:39:18 +03:00
},
2021-04-25 18:30:15 +03:00
9,
minetest.LIGHT_MAX+1,
30, 17000,
3,
2021-04-08 14:39:18 +03:00
mobs_mc.spawn_height.water,
mobs_mc.spawn_height.overworld_max)
2017-07-05 04:15:46 +03:00
-- spawn eggs
mobs:register_egg("mobs_mc:chicken", S("Chicken"), "mobs_mc_spawn_icon_chicken.png", 0)