Add a function that adds monsters

master
PilzAdam 2012-09-15 16:12:25 +02:00
parent 8fdef6890d
commit 6eae6dee2e
1 changed files with 204 additions and 190 deletions

View File

@ -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()
@ -195,6 +197,18 @@ minetest.register_entity("mobs:dirt_monster", {
end
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({