Add a function that adds monsters
parent
8fdef6890d
commit
6eae6dee2e
32
init.lua
32
init.lua
|
@ -1,18 +1,20 @@
|
|||
minetest.register_entity("mobs:dirt_monster", {
|
||||
hp_max = 5,
|
||||
physical = true,
|
||||
collisionbox = {-0.4, -1, -0.4, 0.4, 1, 0.4},
|
||||
visual = "upright_sprite",
|
||||
visual_size = {x=1, y=2},
|
||||
textures = {"mobs_dirt_monster.png", "mobs_dirt_monster_back.png"},
|
||||
makes_footstep_sound = true,
|
||||
local mobs = {}
|
||||
function mobs:register_monster(name, def)
|
||||
minetest.register_entity(name, {
|
||||
hp_max = def.hp_max,
|
||||
physical = def.physical,
|
||||
collisionbox = def.collisionbox,
|
||||
visual = def.visual,
|
||||
visual_size = def.visual_size,
|
||||
textures = def.textures,
|
||||
makes_footstep_sound = def.makes_footstep_sound,
|
||||
|
||||
timer = 0,
|
||||
attack = {player=nil, dist=nil},
|
||||
state = "stand",
|
||||
v_start = false,
|
||||
|
||||
VIEW_RANGE = 15,
|
||||
VIEW_RANGE = def.VIEW_RANGE,
|
||||
|
||||
set_velocity = function(self, v)
|
||||
local yaw = self.object:getyaw()
|
||||
|
@ -196,6 +198,18 @@ minetest.register_entity("mobs:dirt_monster", {
|
|||
end,
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
mobs:register_monster("mobs:dirt_monster", {
|
||||
hp_max = 5,
|
||||
physical = true,
|
||||
collisionbox = {-0.4, -1, -0.4, 0.4, 1, 0.4},
|
||||
visual = "upright_sprite",
|
||||
visual_size = {x=1, y=2},
|
||||
textures = {"mobs_dirt_monster.png", "mobs_dirt_monster_back.png"},
|
||||
makes_footstep_sound = true,
|
||||
VIEW_RANGE = 15
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_grass"},
|
||||
|
|
Loading…
Reference in New Issue