Mineclonia/mods/ENTITIES/mobs_mc/cow.lua

106 lines
2.1 KiB
Lua
Raw Normal View History

--MCmobs v0.2
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
mobs:register_mob("mobs_mc:cow", {
type = "animal",
2017-01-20 20:24:56 +00:00
hp_min = 10,
2017-01-16 19:52:09 +00:00
hp_max = 10,
2017-02-23 16:19:06 +00:00
collisionbox = {-0.8, -0.01, -0.8, 0.8, 1.8, 0.8},
visual = "mesh",
mesh = "mobs_mc_cow.x",
textures = {
{"mobs_mc_cow.png"}
},
makes_footstep_sound = true,
walk_velocity = 1,
2017-01-16 19:52:09 +00:00
armor = 100,
drops = {
{name = "mcl_mobitems:beef",
chance = 1,
min = 1,
max = 3,},
2017-01-16 17:20:06 +00:00
{name = "mcl_mobitems:leather",
chance = 1,
min = 0,
max = 2,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
fear_height = 3,
sounds = {
2017-02-23 16:04:43 +00:00
random = "mobs_mc_cow",
death = "Cowhurt1",
damage = "Cowhurt1",
},
animation = {
speed_normal = 24,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
hurt_start = 118,
hurt_end = 154,
death_start = 154,
death_end = 179,
eat_start = 49,
eat_end = 78,
look_start = 78,
look_end = 108,
},
--from mobs_animals
follow = "mcl_farming:wheat_item",
view_range = 10,
fear_height = 2,
2017-02-23 16:46:37 +00:00
jump_height = 1.25,
on_rightclick = function(self, clicker)
-- feed or tame
if mobs:feed_tame(self, clicker, 1, true, true) then
return
end
local tool = clicker:get_wielded_item()
-- milk cow with empty bucket
if tool:get_name() == "bucket:bucket_empty" then
if self.child == true then
return
end
local inv = clicker:get_inventory()
inv:remove_item("main", "bucket:bucket_empty")
2017-01-17 00:09:11 +00:00
if inv:room_for_item("main", {name = "mcl_mobitems:milk_bucket"}) then
clicker:get_inventory():add_item("main", "mcl_mobitems:milk_bucket")
else
local pos = self.object:getpos()
pos.y = pos.y + 0.5
2017-01-17 00:09:11 +00:00
minetest.add_item(pos, {name = "mcl_mobitems:milk_bucket"})
end
return
end
end,
})
2017-02-23 16:46:37 +00:00
mobs:register_spawn("mobs_mc:cow", {"mcl_core:dirt_with_grass"}, 20, 9, 7000, 1, 31000)
-- compatibility
mobs:alias_mob("mobs:cow", "mobs_mc:cow")
-- spawn egg
mobs:register_egg("mobs_mc:cow", "Spawn Cow", "spawn_egg_cow.png")
if minetest.setting_get("log_mods") then
minetest.log("action", "MC Cow loaded")
end