1
0
Fork 0
MineClone2/mods/ENTITIES/mobs_mc/chicken.lua

167 lines
3.3 KiB
Lua
Raw Normal View History

2017-07-05 03:15:46 +02:00
--License for code WTFPL and otherwise stated in readmes
local S = minetest.get_translator("mobs_mc")
2017-07-05 03:15:46 +02:00
--###################
--################### CHICKEN
--###################
mcl_mobs.register_mob("mobs_mc:chicken", {
2021-04-25 17:30:15 +02:00
description = S("Chicken"),
2017-07-05 03:15:46 +02:00
type = "animal",
2020-04-11 02:46:03 +02:00
spawn_class = "passive",
passive = true,
runaway = true,
2017-07-05 03:15:46 +02:00
hp_min = 4,
hp_max = 4,
2020-12-06 15:46:42 +01:00
xp_min = 1,
xp_max = 3,
2017-07-05 03:15:46 +02:00
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.69, 0.2},
floats = 1,
head_swivel = "head.control",
bone_eye_height = 4,
head_eye_height = 1.5,
horrizonatal_head_height = -.3,
curiosity = 10,
head_yaw="z",
visual_size = {x=1,y=1},
2017-07-05 03:15:46 +02:00
visual = "mesh",
mesh = "mobs_mc_chicken.b3d",
textures = {
{"mobs_mc_chicken.png"},
},
2017-07-05 03:15:46 +02:00
makes_footstep_sound = true,
walk_velocity = 1,
drops = {
2022-05-25 23:25:15 +02:00
{name = "mcl_mobitems:chicken",
2017-07-05 03:15:46 +02:00
chance = 1,
min = 1,
2020-12-23 17:41:42 +01:00
max = 1,
looting = "common",},
2022-05-25 23:25:15 +02:00
{name = "mcl_mobitems:feather",
2017-07-05 03:15:46 +02:00
chance = 1,
min = 0,
2020-12-23 17:41:42 +01:00
max = 2,
looting = "common",},
2017-07-05 03:15:46 +02:00
},
fall_damage = 0,
fall_speed = -2.25,
sounds = {
2020-12-05 16:44:01 +01:00
random = "mobs_mc_chicken_buck",
damage = "mobs_mc_chicken_hurt",
death = "mobs_mc_chicken_hurt",
2020-12-05 23:37:12 +01:00
eat = "mobs_mc_animal_eat_generic",
2017-07-05 03:15:46 +02:00
distance = 16,
},
2019-12-09 12:17:51 +01:00
sounds_child = {
random = "mobs_mc_chicken_child",
damage = "mobs_mc_chicken_child",
death = "mobs_mc_chicken_child",
2020-12-05 23:37:12 +01:00
eat = "mobs_mc_animal_eat_generic",
2019-12-09 12:17:51 +01:00
distance = 16,
},
2017-07-05 03:15:46 +02:00
animation = {
2022-09-28 21:16:01 +02:00
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 20, walk_speed = 25,
run_start = 0, run_end = 20, run_speed = 50,
},
child_animations = {
stand_start = 31, stand_end = 31,
walk_start = 31, walk_end = 51, walk_speed = 37,
run_start = 31, run_end = 51, run_speed = 75,
2017-07-05 03:15:46 +02:00
},
2022-05-25 23:25:15 +02:00
follow = {
"mcl_farming:wheat_seeds",
"mcl_farming:melon_seeds",
"mcl_farming:pumpkin_seeds",
"mcl_farming:beetroot_seeds",
},
2017-07-05 03:15:46 +02:00
view_range = 16,
fear_height = 4,
on_rightclick = function(self, clicker)
2022-11-09 04:57:48 +01:00
if self:feed_tame(clicker, 1, true, false) then return end
2022-05-25 14:44:49 +02:00
if mcl_mobs:protect(self, clicker) then return end
if mcl_mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
2017-07-05 03:15:46 +02: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 06:33:07 +01:00
local pos = self.object:get_pos()
2017-07-05 03:15:46 +02:00
2022-05-25 23:25:15 +02:00
minetest.add_item(pos, "mcl_throwing:egg")
2017-07-05 03:15:46 +02:00
minetest.sound_play("mobs_mc_chicken_lay_egg", {
pos = pos,
gain = 1.0,
max_hear_distance = 16,
2020-04-07 00:55:45 +02:00
}, true)
2021-04-25 17:30:15 +02:00
end,
2017-07-05 03:15:46 +02:00
})
--spawn
2022-05-25 14:44:49 +02:00
mcl_mobs:spawn_specific(
2021-04-25 17:30:15 +02:00
"mobs_mc:chicken",
"overworld",
"ground",
{
"flat",
"IcePlainsSpikes",
"ColdTaiga",
"ColdTaiga_beach",
"ColdTaiga_beach_water",
"MegaTaiga",
"MegaSpruceTaiga",
"ExtremeHills",
"ExtremeHills_beach",
"ExtremeHillsM",
"ExtremeHills+",
"Plains",
"Plains_beach",
"SunflowerPlains",
"Taiga",
"Taiga_beach",
"Forest",
"Forest_beach",
"FlowerForest",
"FlowerForest_beach",
"BirchForest",
"BirchForestM",
"RoofedForest",
"Savanna",
"Savanna_beach",
"SavannaM",
"Jungle",
"Jungle_shore",
"JungleM",
"JungleM_shore",
"JungleEdge",
"JungleEdgeM",
"Swampland",
"Swampland_shore"
2021-04-08 13:39:18 +02:00
},
2021-04-25 17:30:15 +02:00
9,
minetest.LIGHT_MAX+1,
30, 17000,
3,
2022-05-25 23:25:15 +02:00
mobs_mc.water_level,
mcl_vars.mg_overworld_max)
2017-07-05 03:15:46 +02:00
-- spawn eggs
mcl_mobs.register_egg("mobs_mc:chicken", S("Chicken"), "#a1a1a1", "#ff0000", 0)