smart_mobs/warthog.lua

106 lines
2.3 KiB
Lua
Raw Normal View History

-- Warthog by KrupnoPavel
2014-11-09 11:13:11 -08:00
mobs:register_mob("mobs:pumba", {
type = "animal",
passive = false,
attack_type = "dogfight",
damage = 2,
2015-04-09 08:09:10 -07:00
hp_min = 5,
hp_max = 15,
armor = 200,
2014-11-09 11:13:11 -08:00
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
visual = "mesh",
mesh = "mobs_pumba.x",
textures = {
{"mobs_pumba.png"},
2014-12-03 11:45:18 -08:00
},
visual_size = {x=1,y=1},
2014-11-09 11:13:11 -08:00
makes_footstep_sound = true,
sounds = {
random = "mobs_pig",
attack = "mobs_pig_angry",
},
2014-11-09 11:13:11 -08:00
walk_velocity = 2,
2015-03-05 05:08:08 -08:00
run_velocity = 3,
jump = true,
follow = "default:apple",
view_range = 10,
2014-11-09 11:13:11 -08:00
drops = {
{name = "mobs:pork_raw",
chance = 1, min = 2, max = 3,},
2014-11-09 11:13:11 -08:00
},
water_damage = 1,
lava_damage = 5,
light_damage = 0,
animation = {
speed_normal = 15,
stand_start = 25, stand_end = 55,
walk_start = 70, walk_end = 100,
punch_start = 70, punch_end = 100,
2014-11-09 11:13:11 -08:00
},
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
2015-05-20 07:50:16 -07:00
local name = clicker:get_player_name()
if item:get_name() == "default:apple" then
2015-05-20 07:50:16 -07:00
-- take item
2014-11-09 11:13:11 -08:00
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
2015-05-20 07:50:16 -07:00
-- make child grow quicker
2015-04-09 08:09:10 -07:00
if self.child == true then
self.hornytimer = self.hornytimer + 10
return
end
2015-05-20 07:50:16 -07:00
-- feed and tame
2014-11-09 11:13:11 -08:00
self.food = (self.food or 0) + 1
2015-05-20 07:50:16 -07:00
if self.food > 7 then
2014-11-09 11:13:11 -08:00
self.food = 0
2015-04-09 08:09:10 -07:00
if self.hornytimer == 0 then
self.horny = true
end
2014-11-09 11:13:11 -08:00
self.tamed = true
2015-05-20 07:50:16 -07:00
-- make owner
if self.owner == "" then
2015-05-20 07:50:16 -07:00
self.owner = name
end
minetest.sound_play("mobs_pig", {
object = self.object,
gain = 1.0,
max_hear_distance = 16,
loop = false,
})
2014-11-09 11:13:11 -08:00
end
return
end
2015-04-11 09:40:13 -07:00
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
2014-11-09 11:13:11 -08:00
end,
})
2015-04-09 08:09:10 -07:00
2015-05-20 07:50:16 -07:00
mobs:register_spawn("mobs:pumba", {"ethereal:mushroom_dirt"}, 20, 10, 15000, 1, 31000)
2015-04-09 08:09:10 -07:00
2015-02-20 08:37:36 -08:00
mobs:register_egg("mobs:pumba", "Warthog", "wool_pink.png", 1)
2014-11-09 11:13:11 -08:00
2015-04-09 08:09:10 -07:00
-- porkchop (raw and cooked)
2014-11-09 11:13:11 -08:00
minetest.register_craftitem("mobs:pork_raw", {
description = "Raw Porkchop",
inventory_image = "mobs_pork_raw.png",
on_use = minetest.item_eat(4),
})
minetest.register_craftitem("mobs:pork_cooked", {
description = "Cooked Porkchop",
inventory_image = "mobs_pork_cooked.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
type = "cooking",
output = "mobs:pork_cooked",
recipe = "mobs:pork_raw",
cooktime = 5,
})