Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1311 lines (1233 sloc) 30.9 KB
dofile(minetest.get_modpath("mobs").."/api.lua")
mobs:register_mob("mobs:dirt_monster", {
type = "monster",
hp_max = 5,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_stone_monster.x",
textures = {"mobs_dirt_monster.png"},
visual_size = {x=3, y=2.6},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 2,
drops = {
{name = "default:dirt",
chance = 1,
min = 3,
max = 5,},
},
armor = 100,
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 2,
on_rightclick = nil,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
}
})
-- mobs:register_spawn("mobs:dirt_monster", {"default:dirt_with_grass"}, 3, -1, 7000, 3, 31000)
mobs:register_mob("mobs:stone_monster", {
type = "monster",
hp_max = 10,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_stone_monster.x",
textures = {"mobs_stone_monster.png"},
visual_size = {x=3, y=2.6},
makes_footstep_sound = true,
view_range = 10,
walk_velocity = 0.5,
run_velocity = 2,
damage = 3,
drops = {
{name = "default:mossycobble",
chance = 1,
min = 3,
max = 5,},
},
light_resistant = true,
armor = 80,
drawtype = "front",
water_damage = 0,
lava_damage = 0,
light_damage = 0,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
}
})
-- mobs:register_spawn("mobs:stone_monster", {"default:stone"}, 3, -1, 7000, 3, 0)
mobs:register_mob("mobs:sand_monster", {
type = "monster",
hp_max = 3,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_sand_monster.x",
textures = {"mobs_sand_monster.png"},
visual_size = {x=8,y=8},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1.5,
run_velocity = 4,
damage = 1,
drops = {
{name = "default:sand",
chance = 1,
min = 3,
max = 5,},
},
light_resistant = true,
armor = 100,
drawtype = "front",
water_damage = 3,
lava_damage = 1,
light_damage = 0,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 39,
walk_start = 41,
walk_end = 72,
run_start = 74,
run_end = 105,
punch_start = 74,
punch_end = 105,
},
})
-- mobs:register_spawn("mobs:sand_monster", {"default:desert_sand"}, 20, -1, 7000, 3, 31000)
mobs:register_mob("mobs:tree_monster", {
type = "monster",
hp_max = 5,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_tree_monster.x",
textures = {"mobs_tree_monster.png"},
visual_size = {x=4.5,y=4.5},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 2,
drops = {
{name = "default:sapling",
chance = 3,
min = 1,
max = 2,},
{name = "default:junglesapling",
chance = 3,
min = 1,
max = 2,},
},
light_resistant = true,
armor = 100,
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 2,
disable_fall_damage = true,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 24,
walk_start = 25,
walk_end = 47,
run_start = 48,
run_end = 62,
punch_start = 48,
punch_end = 62,
},
})
-- mobs:register_spawn("mobs:tree_monster", {"default:leaves", "default:jungleleaves"}, 3, -1, 7000, 3, 31000)
mobs:register_mob("mobs:sheep", {
type = "animal",
hp_max = 25,
collisionbox = {-0.5, -0.01, -0.5, 0.5, 1.5, 0.5},
textures = {"sheep.png"},
visual = "mesh",
mesh = "sheep.x",
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mobs:mutton_raw",
chance = 1,
min = 1,
max = 2,},
{name = "wool:white",
chance = 1,
min = 1,
max = 1,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
sounds = {
random = "Sheep3",
death = "Sheep3",
hurt = "Sheep3",
},
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,
},
follow = "farming:wheat",
view_range = 5,
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "farming:wheat" then
if not self.tamed then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.tamed = true
elseif self.naked then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.food = (self.food or 0) + 1
if self.food >= 4 then
self.food = 0
self.naked = false
self.object:set_properties({
textures = {"sheep.png"},
})
end
end
return
end
if item:get_name() == "shears:shears" and not self.naked then
self.naked = true
local pos = self.object:getpos()
minetest.sound_play("shears", {pos = pos})
pos.y = pos.y + 0.5
if not self.color then
minetest.add_item(pos, ItemStack("wool:white "..math.random(1,3)))
else
minetest.add_item(pos, ItemStack("wool:"..self.color.." "..math.random(1,3)))
end
self.object:set_properties({
textures = {"sheep_sheared.png"},
})
if not minetest.setting_getbool("creative_mode") then
item:add_wear(300)
clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
end
end
if minetest.get_item_group(item:get_name(), "dye") == 1 and not self.naked then
print(item:get_name(), minetest.get_item_group(item:get_name(), "dye"))
local name = item:get_name()
local pname = name:split(":")[2]
self.object:set_properties({
textures = {"sheep_"..pname..".png"},
})
self.color = pname
self.drops = {
{name = "mobs:mutton_raw",
chance = 1,
min = 1,
max = 2,},
{name = "wool:"..self.color,
chance = 1,
min = 1,
max = 1,},
}
end
end,
})
mobs:register_spawn("mobs:sheep", {"default:dirt_with_grass"}, 20, 12, 5000, 8, 31000)
mobs:register_mob("mobs:pig", {
type = "animal",
hp_max = 25,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
textures = {"pig.png"},
visual = "mesh",
mesh = "pig.x",
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mobs:porkchop_raw",
chance = 1,
min = 1,
max = 3,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
sounds = {
random = "Pig2",
death = "Pigdeath",
hurt = "Pig2",
},
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,
},
follow = "farming_plus:carrot_item",
view_range = 5,
on_rightclick = function(self, clicker)
if not clicker or not clicker:is_player() then
return
end
local item = clicker:get_wielded_item()
if item:get_name() == "mobs:saddle" and self.saddle ~= "yes" then
self.object:set_properties({
textures = {"pig_with_saddle.png"},
})
self.saddle = "yes"
self.tamed = true
self.drops = {
{name = "mobs:porkchop_raw",
chance = 1,
min = 1,
max = 3,},
{name = "mobs:saddle",
chance = 1,
min = 1,
max = 1,},
}
if not minetest.setting_getbool("creative_mode") then
local inv = clicker:get_inventory()
local stack = inv:get_stack("main", clicker:get_wield_index())
stack:take_item()
inv:set_stack("main", clicker:get_wield_index(), stack)
end
return
end
-- from boats mod
local name = clicker:get_player_name()
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
default.player_attached[name] = false
default.player_set_animation(clicker, "stand" , 30)
elseif not self.driver and self.saddle == "yes" then
self.driver = clicker
clicker:set_attach(self.object, "", {x = 0, y = 19, z = 0}, {x = 0, y = 0, z = 0})
default.player_attached[name] = true
minetest.after(0.2, function()
default.player_set_animation(clicker, "sit" , 30)
end)
--self.object:setyaw(clicker:get_look_yaw() - math.pi / 2)
end
end,
})
mobs:register_spawn("mobs:pig", {"default:dirt_with_grass"}, 20, 12, 5000, 8, 31000)
mobs:register_mob("mobs:cow", {
type = "animal",
hp_max = 28,
collisionbox = {-0.6, -0.01, -0.6, 0.6, 1.8, 0.6},
textures = {"cow.png"},
visual = "mesh",
mesh = "cow.x",
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mobs:beef_raw",
chance = 1,
min = 1,
max = 3,},
{name = "mobs:leather",
chance = 1,
min = 0,
max = 2,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
sounds = {
random = "Cow1",
death = "Cowhurt1",
hurt = "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,
},
follow = "farming:wheat",
view_range = 5,
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "bucket:bucket_empty" and clicker:get_inventory() then
local inv = clicker:get_inventory()
inv:remove_item("main", "bucket:bucket_empty")
-- if room add bucket of milk to inventory, otherwise drop as item
if inv:room_for_item("main", {name="bucket:bucket_milk"}) then
clicker:get_inventory():add_item("main", "bucket:bucket_milk")
else
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "bucket:bucket_milk"})
end
end
end,
})
mobs:register_spawn("mobs:cow", {"default:dirt_with_grass"}, 20, 8, 7000, 7, 31000)
mobs:register_mob("mobs:chicken", {
type = "animal",
hp_max = 24,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
textures = {"chicken.png"},
visual = "mesh",
mesh = "chicken.x",
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mobs:chicken_raw",
chance = 1,
min = 1,
max = 1,},
{name = "mobs:feather",
chance = 1,
min = 0,
max = 2,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
sounds = {
random = "Chicken1",
death = "Chickenhurt1",
hurt = "Chickenhurt1",
},
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,
fly_start = 181,
fly_end = 187,
},
follow = "farming:seed_wheat",
view_range = 5,
on_rightclick = function(self, clicker)
if clicker:get_inventory() then
if minetest.registered_items["food:egg"] then
clicker:get_inventory():add_item("main", ItemStack("food:egg 1"))
end
end
end,
})
mobs:register_spawn("mobs:chicken", {"default:dirt_with_grass"}, 20, 8, 7000, 7, 31000)
mobs:register_mob("mobs:creeper", {
type = "monster",
hp_max = 30,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.6, 0.4},
textures = {"creeper.png"},
visual = "mesh",
visual_size = {x=.75, y=.75, z=.75},
mesh = "creeper.x",
makes_footstep_sound = false,
sounds = {
approach = "Fuse",
death = "Creeperdeath",
hurt = "Creeper4",
attack = "damage",
},
walk_velocity = 1.5,
run_velocity = 3,
damage = 1,
armor = 200,
maxdrops = 3,
drops = {
{name = "tnt:gunpowder",
chance = 1,
min = 0,
max = 2,},
{name = "farorb:farorb",
chance = 1,
min = 0,
max = 1,},
{name = "jdukebox:disc_1",
chance = 10,
min = 1,
max = 1,},
{name = "jdukebox:disc_2",
chance = 10,
min = 1,
max = 1,},
{name = "jdukebox:disc_3",
chance = 10,
min = 1,
max = 1,},
{name = "jdukebox:disc_4",
chance = 10,
min = 1,
max = 1,},
{name = "jdukebox:disc_5",
chance = 10,
min = 1,
max = 1,},
{name = "jdukebox:disc_6",
chance = 10,
min = 1,
max = 1,},
},
animation = {
speed_normal = 24,
speed_run = 48,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
run_start = 24,
run_end = 49,
hurt_start = 110,
hurt_end = 139,
death_start = 140,
death_end = 189,
look_start = 50,
look_end = 108,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
view_range = 16,
attack_type = "bomb",
})
mobs:register_spawn("mobs:creeper", {"group:crumbly", "group:cracky", "group:choppy", "group:snappy"}, 7, -1, 5000, 4, 31000)
mobs:register_mob("mobs:skeleton", {
type = "monster",
hp_max = 30,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
textures = {"skeleton.png"},
visual = "mesh",
mesh = "skeleton.x",
makes_footstep_sound = true,
sounds = {
random = "skeleton1",
death = "skeletondeath",
hurt = "skeletonhurt1",
},
walk_velocity = 1.2,
run_velocity = 2.4,
damage = 1,
armor = 200,
drops = {
{name = "throwing:arrow",
chance = 1,
min = 0,
max = 2,},
{name = "throwing:bow_wood",
chance = 11,
min = 1,
max = 1,},
{name = "bones:single_bone",
chance = 1,
min = 0,
max = 2,},
},
animation = {
speed_normal = 30,
speed_run = 60,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
run_start = 24,
run_end = 49,
hurt_start = 85,
hurt_end = 115,
death_start = 117,
death_end = 145,
shoot_start = 50,
shoot_end = 82,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 1,
view_range = 16,
attack_type = "shoot",
arrow = "throwing:arrow_entity",
shoot_interval = 2.5,
})
mobs:register_spawn("mobs:skeleton", {"group:crumbly", "group:cracky", "group:choppy", "group:snappy"}, 7, -1, 5000, 4, 31000)
mobs:register_mob("mobs:zombie", {
type = "monster",
hp_max = 35,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
textures = {"zombie.png"},
visual = "mesh",
mesh = "zombie.x",
makes_footstep_sound = true,
sounds = {
random = "zombie1",
death = "zombiedeath",
hurt = "zombiehurt1",
attack = "damage",
},
walk_velocity = .8,
run_velocity = 1.6,
damage = 1,
armor = 200,
drops = {
{name = "mobs:rotten_flesh",
chance = 1,
min = 1,
max = 1,},
{name = "default:steel_ingot",
chance = 3,
min = 0,
max = 2,},
{name = "default:shovel_steel",
chance = 4,
min = 1,
max = 1,},
{name = "default:sword_steel",
chance = 8,
min = 1,
max = 1,},
{name = "farming_plus:carrot_item",
chance = 10,
min = 1,
max = 1,},
{name = "farming_plus:potato_item",
chance = 10,
min = 1,
max = 1,},
},
animation = {
speed_normal = 24,
speed_run = 48,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 47,
run_start = 48,
run_end = 62,
hurt_start = 64,
hurt_end = 86,
death_start = 88,
death_end = 118,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 1,
view_range = 16,
attack_type = "dogfight",
})
mobs:register_spawn("mobs:zombie", {"group:crumbly", "group:cracky", "group:choppy", "group:snappy"}, 7, -1, 5000, 4, 31000)
mobs:register_mob("mobs:pigman", {
type = "monster",
hp_max = 35,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
textures = {"zombie_pigman.png"},
visual = "mesh",
mesh = "zombie.x",
makes_footstep_sound = true,
walk_velocity = .8,
run_velocity = 1.6,
damage = 2,
armor = 400,
drops = {
{name = "mobs:rotten_flesh",
chance = 1,
min = 1,
max = 1,},
{name = "default:gold_ingot",
chance = 13,
min = 0,
max = 2,},
{name = "default:sword_gold",
chance = 8,
min = 1,
max = 1,},
},
animation = {
speed_normal = 24,
speed_run = 48,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 47,
run_start = 48,
run_end = 62,
hurt_start = 64,
hurt_end = 86,
death_start = 88,
death_end = 118,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 1,
view_range = 16,
attack_type = "dogfight",
})
mobs:register_spawn("mobs:pigman", {"nether:rack"}, 15, -1, 5000, 4, -5000)
mobs:register_spawn("mobs:pigman", {"nether:portal"}, 15, -1, 15000, 4, 31000)
-- from throwing mod by PilzAdam:
minetest.register_node("mobs:arrow_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Schaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow.png", "throwing_arrow.png", "throwing_arrow_back.png", "throwing_arrow_front.png", "throwing_arrow_2.png", "throwing_arrow.png"},
groups = {not_in_creative_inventory=1},
})
-- generic meat
minetest.register_craftitem("mobs:meat_raw", {
description = "Raw Meat",
inventory_image = "mobs_meat_raw.png",
})
minetest.register_craftitem("mobs:meat", {
description = "Meat",
inventory_image = "mobs_meat.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
type = "cooking",
output = "mobs:meat",
recipe = "mobs:meat_raw",
cooktime = 5,
})
minetest.register_craftitem("mobs:rotten_flesh", {
description = "Rotten Flesh",
inventory_image = "mobs_rotten_flesh.png",
on_use = minetest.item_eat(4),
})
-- beef
minetest.register_craftitem("mobs:beef_raw", {
description = "Raw Beef",
inventory_image = "beef_raw.png",
on_use = minetest.item_eat(3),
})
minetest.register_craftitem("mobs:beef_cooked", {
description = "Steak",
inventory_image = "beef_cooked.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
type = "cooking",
output = "mobs:beef_cooked",
recipe = "mobs:beef_raw",
cooktime = 5,
})
-- pork
minetest.register_craftitem("mobs:porkchop_raw", {
description = "Raw Porkchop",
inventory_image = "porkchop_raw.png",
on_use = minetest.item_eat(3),
})
minetest.register_craftitem("mobs:porkchop_cooked", {
description = "Cooked Porkchop",
inventory_image = "porkchop_cooked.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
type = "cooking",
output = "mobs:porkchop_cooked",
recipe = "mobs:porkchop_raw",
cooktime = 5,
})
--mutton
minetest.register_craftitem("mobs:mutton_raw", {
description = "Raw Mutton",
inventory_image = "mutton_raw.png",
on_use = minetest.item_eat(2),
})
minetest.register_craftitem("mobs:mutton_cooked", {
description = "Cooked Mutton",
inventory_image = "mutton_cooked.png",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
type = "cooking",
output = "mobs:mutton_cooked",
recipe = "mobs:mutton_raw",
cooktime = 5,
})
-- chicken
minetest.register_craftitem("mobs:chicken_raw", {
description = "Raw Chicken",
inventory_image = "chicken_raw.png",
on_use = minetest.item_eat(2),
})
minetest.register_craftitem("mobs:chicken_cooked", {
description = "Cooked Chicken",
inventory_image = "chicken_cooked.png",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
type = "cooking",
output = "mobs:chicken_cooked",
recipe = "mobs:chicken_raw",
cooktime = 5,
})
-- leather, feathers, etc.
minetest.register_craftitem("mobs:leather", {
description = "Leather",
inventory_image = "mobs_leather.png",
})
minetest.register_craftitem("mobs:feather", {
description = "Feather",
inventory_image = "mobs_feather.png",
})
minetest.register_craftitem("mobs:saddle", {
description = "Saddle",
inventory_image = "saddle.png",
})
minetest.register_tool("mobs:carrotstick", {
description = "Carrot on a Stick",
inventory_image = "carrot_on_a_stick.png",
stack_max = 1,
})
minetest.register_craft({
type = "shapeless",
output = "mobs:carrotstick",
recipe = {"fishing:pole", "farming_plus:carrot_item"},
})
mobs:register_mob("mobs:rat", {
type = "animal",
hp_max = 1,
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.2, 0.2},
visual = "mesh",
mesh = "mobs_rat.x",
textures = {"mobs_rat.png"},
makes_footstep_sound = false,
walk_velocity = 1,
armor = 200,
drops = {},
drawtype = "front",
water_damage = 0,
lava_damage = 1,
light_damage = 0,
on_rightclick = function(self, clicker)
if clicker:is_player() and clicker:get_inventory() then
clicker:get_inventory():add_item("main", "mobs:rat")
self.object:remove()
end
end,
})
-- mobs:register_spawn("mobs:rat", {"default:dirt_with_grass", "default:stone"}, 20, -1, 7000, 1, 31000)
mobs:register_mob("mobs:oerkki", {
type = "monster",
hp_max = 8,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_oerkki.x",
textures = {"mobs_oerkki.png"},
visual_size = {x=5, y=5},
makes_footstep_sound = false,
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 4,
drops = {},
armor = 100,
drawtype = "front",
light_resistant = true,
water_damage = 1,
lava_damage = 1,
light_damage = 0,
attack_type = "dogfight",
animation = {
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 36,
run_start = 37,
run_end = 49,
punch_start = 37,
punch_end = 49,
speed_normal = 15,
speed_run = 15,
},
})
-- mobs:register_spawn("mobs:oerkki", {"default:stone"}, 2, -1, 7000, 3, -10)
mobs:register_mob("mobs:dungeon_master", {
type = "monster",
hp_max = 10,
collisionbox = {-0.7, -0.01, -0.7, 0.7, 2.6, 0.7},
visual = "mesh",
mesh = "mobs_dungeon_master.x",
textures = {"mobs_dungeon_master.png"},
visual_size = {x=8, y=8},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
damage = 4,
drops = {
{name = "default:mese",
chance = 100,
min = 1,
max = 2,},
},
armor = 60,
drawtype = "front",
water_damage = 1,
lava_damage = 1,
light_damage = 0,
on_rightclick = nil,
attack_type = "shoot",
arrow = "mobs:fireball",
shoot_interval = 2.5,
sounds = {
attack = "mobs_fireball",
},
animation = {
stand_start = 0,
stand_end = 19,
walk_start = 20,
walk_end = 35,
punch_start = 36,
punch_end = 48,
speed_normal = 15,
speed_run = 15,
},
})
-- mobs:register_spawn("mobs:dungeon_master", {"default:stone"}, 2, -1, 7000, 1, -50)
mobs:register_mob("mobs:villager", {
type = "animal",
hp_max = 30,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.95, 0.4},
textures = {"farmer.png"},
visual = "mesh",
mesh = "villager.x",
makes_footstep_sound = true,
walk_velocity = 1.2,
run_velocity = 2.4,
damage = 1,
drops = {
{name = "default:apple",
chance = 100,
min = 1,
max = 2,},
},
armor = 200,
sounds = {
random = "Villager1",
death = "Villagerdead",
hurt = "Villagerhurt1",
},
animation = {
speed_normal = 30,
speed_run = 60,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
run_start = 24,
run_end = 49,
hurt_start = 85,
hurt_end = 115,
death_start = 117,
death_end = 145,
shoot_start = 50,
shoot_end = 82,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
view_range = 16,
on_rightclick = function(self, clicker)
local inv
inv = minetest.get_inventory({type="detached", name="trading_inv"})
if not inv then
inv = minetest.create_detached_inventory("trading_inv", {
allow_take = function(inv, listname, index, stack, player)
if listname == "output" then
inv:remove_item("input", inv:get_stack("wanted", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
end
if listname == "input" or listname == "output" then
return 1000
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
if listname == "input" then
return 1000
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
on_take = function(inv, listname, index, stack, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
})
end
inv:set_size("input", 1)
inv:set_size("output", 1)
inv:set_size("wanted", 1)
inv:set_size("offered", 1)
local trades = {
{"default:apple 12", "default:emerald 1"},
{"default:coal_lump 20", "default:emerald 1"},
{"default:paper 30", "default:emerald 1"},
{"mobs:leather 10", "default:emerald 1"},
{"default:book 2", "default:emerald 1"},
{"default:diamond 3", "default:emerald 1"},
{"farming_plus:potato_item 15", "default:emerald 1"},
{"farming:wheat 20", "default:emerald 1"},
{"farming_plus:carrot_item 15", "default:emerald 1"},
{"crops:melon 8", "default:emerald 1"},
{"mobs:rotten_flesh 40", "default:emerald 1"},
{"default:gold_ingot 10", "default:emerald 1"},
{"farming:cotton 10", "default:emerald 1"},
{"wool:white 15", "default:emerald 1"},
{"farming:pumpkin 8", "default:emerald 1"},
{"default:emerald 1", "mobs:beef_cooked 5"},
{"default:emerald 1", "mobs:chicken_cooked 7"},
{"default:emerald 1", "farming:cookie 6"},
{"default:emerald 1", "farming:pumpkin_bread 3"},
{"default:emerald 1", "throwing:arrow 10"},
{"default:emerald 3", "throwing:bow_wood 1"},
{"default:emerald 8", "fishing:pole 1"},
{"default:emerald 4", "potionspack:healthii 1"},
{"default:emerald 1", "cake:cake 1"},
{"default:emerald 10", "mobs:saddle 1"},
{"default:emerald 10", "clock:1 1"},
{"default:emerald 10", "compass:0 1"},
{"default:emerald 1", "default:glass 5"},
{"default:emerald 1", "nether:glowstone 3"},
{"default:emerald 3", "shears:shears 1"},
{"default:emerald 10", "default:sword_diamond 1"},
{"default:emerald 20", "3d_armor:chestplate_diamond 1"},
}
local tradenum = math.random(#trades)
inv:set_stack("wanted", 1, ItemStack(trades[tradenum][1]))
inv:set_stack("offered", 1, ItemStack(trades[tradenum][2]))
local formspec =
"size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;trading_formspec_bg.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"
.."list[detached:trading_inv;wanted;2,1;1,1;]"
.."list[detached:trading_inv;offered;5.75,1;1,1;]"
.."list[detached:trading_inv;input;2,2.5;1,1;]"
.."list[detached:trading_inv;output;5.75,2.5;1,1;]"
minetest.sound_play("Villagertrade", {to_player = clicker:get_player_name()})
minetest.show_formspec(clicker:get_player_name(), "tradespec", formspec)
end,
})
mobs:register_spawn("mobs:villager", {"default:gravel"}, 20, 8, 50, 8, 31000)
mobs:register_arrow("mobs:fireball", {
visual = "sprite",
visual_size = {x=1, y=1},
--textures = {{name="mobs_fireball.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.5}}}, FIXME
textures = {"mobs_fireball.png"},
velocity = 5,
hit_player = function(self, player)
local s = self.object:getpos()
local p = player:getpos()
local vec = {x=s.x-p.x, y=s.y-p.y, z=s.z-p.z}
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=4},
}, vec)
local pos = self.object:getpos()
for dx=-1,1 do
for dy=-1,1 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.get_node(pos).name
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 30 then
minetest.set_node(p, {name="fire:basic_flame"})
else
minetest.remove_node(p)
end
end
end
end
end,
hit_node = function(self, pos, node)
for dx=-1,1 do
for dy=-2,1 do
for dz=-1,1 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.get_node(pos).name
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 30 then
minetest.set_node(p, {name="fire:basic_flame"})
else
minetest.remove_node(p)
end
end
end
end
end
})
mobs:register_arrow("mobs:arrow", {
--[[ visual = "wielditem",
visual_size = {x=.1, y=.1},
textures = {"mobs:arrow_box"}, ]]
visual = "sprite",
visual_size = {x=1, y=1},
textures = {"mobs_fireball.png"},
velocity = 15,
hit_player = function(self, player)
local s = self.object:getpos()
local p = player:getpos()
local vec = {x=s.x-p.x, y=s.y-p.y, z=s.z-p.z}
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=2},
}, vec)
end,
hit_node = function(self, pos, node) end
})
-- Cobweb
minetest.register_node("mobs:cobweb", {
description = "Cobweb",
drawtype = "plantlike",
visual_scale = 1.1,
tiles = {"mobs_cobweb.png"},
inventory_image = "mobs_cobweb.png",
paramtype = "light",
sunlight_propagates = true,
liquid_viscosity = 11,
liquidtype = "source",
liquid_alternative_flowing = "mobs:cobweb",
liquid_alternative_source = "mobs:cobweb",
liquid_renewable = false,
liquid_range = 0,
walkable = false,
groups = {snappy=1,liquid=3},
drop = "farming:cotton",
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craft({
output = "mobs:cobweb",
recipe = {
{"farming:string", "", "farming:string"},
{"", "farming:string", ""},
{"farming:string", "", "farming:string"},
}
})
-- spawn eggs
mobs:register_egg("mobs:chicken", "Chicken", "spawn_egg_chicken.png")
mobs:register_egg("mobs:cow", "Cow", "spawn_egg_cow.png")
mobs:register_egg("mobs:creeper", "Creeper", "spawn_egg_creeper.png")
mobs:register_egg("mobs:pig", "Pig", "spawn_egg_pig.png")
mobs:register_egg("mobs:sheep", "Sheep", "spawn_egg_sheep.png")
mobs:register_egg("mobs:skeleton", "Skeleton", "spawn_egg_skeleton.png")
mobs:register_egg("mobs:zombie", "Zombie", "spawn_egg_zombie.png")
mobs:register_egg("mobs:pigman", "Zombie Pigman", "spawn_egg_zombie_pigman.png")
mobs:register_egg("mobs:villager", "Villager", "spawn_egg_villager.png")
if minetest.setting_get("log_mods") then
minetest.log("action", "mobs loaded")
end