animalworld/boar.lua

114 lines
2.8 KiB
Lua
Raw Normal View History

2021-02-03 16:37:16 +01:00
mobs:register_mob("animalworld:boar", {
2021-01-31 21:16:02 +01:00
stepheight = 1,
type = "animal",
passive = false,
attack_type = "dogfight",
group_attack = true,
owner_loyal = true,
attack_npcs = true,
reach = 2,
damage = 2,
hp_min = 5,
2021-02-03 16:37:16 +01:00
hp_max = 35,
2021-01-31 21:16:02 +01:00
armor = 200,
collisionbox = {-0.5, -0.01, -0.5, 0.5, 0.95, 0.5},
visual = "mesh",
mesh = "Boar.b3d",
textures = {
{"textureboar.png"},
},
makes_footstep_sound = true,
sounds = {
2021-02-03 16:37:16 +01:00
random = "animalworld_boar",
attack = "animalworld_boar",
2021-01-31 21:16:02 +01:00
},
walk_velocity = 1,
run_velocity = 2,
jump = true,
jump_height = 6,
pushable = true,
follow = {"default:apple", "farming:potato"},
view_range = 6,
drops = {
2021-02-03 16:37:16 +01:00
{name = "animalworld:pork_raw", chance = 1, min = 1, max = 3},
2021-01-31 21:16:02 +01:00
},
water_damage = 0,
lava_damage = 5,
light_damage = 0,
fear_height = 2,
animation = {
speed_normal = 100,
stand_start = 0,
stand_end = 100,
walk_start = 300,
walk_end = 450,
punch_start = 100,
punch_end = 300,
die_start = 1, -- we dont have a specific death animation so we will
die_end = 2, -- re-use 2 standing frames at a speed of 1 fps and
die_speed = 1, -- have mob rotate when dying.
die_loop = false,
die_rotate = true,
},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) then return end
end,
})
local spawn_on = {"default:dirt_with_coniferous_litter"}
if minetest.get_mapgen_setting("mg_name") ~= "v6" then
spawn_on = {"default:dirt_with_dry_grass", "default:dirt_with_coniferous_litter"}
end
if minetest.get_modpath("ethereal") then
spawn_on = {"ethereal:mushroom_dirt", "ethereal:bamboo_dirt"}
end
if not mobs.custom_spawn_animal then
mobs:spawn({
2021-02-03 16:37:16 +01:00
name = "animalworld:boar",
2021-01-31 21:16:02 +01:00
nodes = {"default:dirt_with_coniferous_litter", "default:dirt_gray"},
min_light = 14,
2021-02-01 10:05:00 +01:00
interval = 60,
2021-01-31 21:16:02 +01:00
chance = 8000, -- 15000
2021-02-08 17:33:07 +01:00
active_object_count = 3,
2021-01-31 21:16:02 +01:00
min_height = 1,
2021-02-03 16:37:16 +01:00
max_height = 80,
2021-01-31 21:16:02 +01:00
day_toggle = true,
})
end
2021-02-03 16:37:16 +01:00
mobs:register_egg("animalworld:boar", ("Boar"), "aboar.png")
2021-01-31 21:16:02 +01:00
2021-02-03 16:37:16 +01:00
mobs:alias_mob("animalworld:boar", "animalworld:boar") -- compatibility
2021-01-31 21:16:02 +01:00
-- raw porkchop
2021-02-03 16:37:16 +01:00
minetest.register_craftitem(":animalworld:pork_raw", {
2021-01-31 21:16:02 +01:00
description = ("Raw Pork"),
2021-02-03 16:37:16 +01:00
inventory_image = "animalworld_pork_raw.png",
2021-01-31 21:16:02 +01:00
on_use = minetest.item_eat(4),
groups = {food_meat_raw = 1, food_pork_raw = 1, flammable = 2},
})
-- cooked porkchop
2021-02-03 16:37:16 +01:00
minetest.register_craftitem(":animalworld:pork_cooked", {
2021-01-31 21:16:02 +01:00
description = ("Cooked Pork"),
2021-02-03 16:37:16 +01:00
inventory_image = "animalworld_pork_cooked.png",
2021-01-31 21:16:02 +01:00
on_use = minetest.item_eat(8),
groups = {food_meat = 1, food_pork = 1, flammable = 2},
})
minetest.register_craft({
type = "cooking",
2021-02-03 16:37:16 +01:00
output = "animalworld:pork_cooked",
recipe = "animalworld:pork_raw",
2021-01-31 21:16:02 +01:00
cooktime = 5,
})