Addd sand monster
parent
f946b8feea
commit
002116a8cb
69
init.lua
69
init.lua
|
@ -11,6 +11,7 @@ function mobs:register_monster(name, def)
|
||||||
view_range = def.view_range,
|
view_range = def.view_range,
|
||||||
walk_velocity = def.walk_velocity,
|
walk_velocity = def.walk_velocity,
|
||||||
run_velocity = def.run_velocity,
|
run_velocity = def.run_velocity,
|
||||||
|
damage = def.damage,
|
||||||
|
|
||||||
timer = 0,
|
timer = 0,
|
||||||
attack = {player=nil, dist=nil},
|
attack = {player=nil, dist=nil},
|
||||||
|
@ -153,12 +154,28 @@ function mobs:register_monster(name, def)
|
||||||
self.v_start = false
|
self.v_start = false
|
||||||
if self.timer > 1 then
|
if self.timer > 1 then
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
self.attack.player:punch(self.object, 1.0, {
|
if damage > 3 then
|
||||||
full_punch_interval=1.0,
|
self.attack.player:punch(self.object, 1.0, {
|
||||||
groupcaps={
|
full_punch_interval=1.0,
|
||||||
fleshy={times={[2]=1/1,[3]=1/2}},
|
groupcaps={
|
||||||
}
|
fleshy={times={[1]=1/(damage-2),[2]=1/(damage-1),[3]=1/damage}},
|
||||||
}, vec)
|
}
|
||||||
|
}, vec)
|
||||||
|
elseif damage > 2 then
|
||||||
|
self.attack.player:punch(self.object, 1.0, {
|
||||||
|
full_punch_interval=1.0,
|
||||||
|
groupcaps={
|
||||||
|
fleshy={times={[2]=1/(damage-1),[3]=1/damage}},
|
||||||
|
}
|
||||||
|
}, vec)
|
||||||
|
elseif damage > 1 then
|
||||||
|
self.attack.player:punch(self.object, 1.0, {
|
||||||
|
full_punch_interval=1.0,
|
||||||
|
groupcaps={
|
||||||
|
fleshy={times={[3]=1/damage}},
|
||||||
|
}
|
||||||
|
}, vec)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -212,6 +229,7 @@ mobs:register_monster("mobs:dirt_monster", {
|
||||||
view_range = 15,
|
view_range = 15,
|
||||||
walk_velocity = 1,
|
walk_velocity = 1,
|
||||||
run_velocity = 3,
|
run_velocity = 3,
|
||||||
|
damage = 2,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
@ -246,6 +264,7 @@ mobs:register_monster("mobs:stone_monster", {
|
||||||
view_range = 10,
|
view_range = 10,
|
||||||
walk_velocity = 0.5,
|
walk_velocity = 0.5,
|
||||||
run_velocity = 2,
|
run_velocity = 2,
|
||||||
|
damage = 3,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
@ -271,3 +290,41 @@ minetest.register_abm({
|
||||||
minetest.env:add_entity(pos, "mobs:stone_monster")
|
minetest.env:add_entity(pos, "mobs:stone_monster")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mobs:register_monster("mobs:sand_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_sand_monster.png", "mobs_sand_monster_back.png"},
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
view_range = 15,
|
||||||
|
walk_velocity = 1.5,
|
||||||
|
run_velocity = 4,
|
||||||
|
damage = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"default:desert_sand"},
|
||||||
|
neighbors = {"default:desert_sand", "default:desert_stone"},
|
||||||
|
interval = 60,
|
||||||
|
chance = 5000,
|
||||||
|
action = function(pos, node)
|
||||||
|
pos.y = pos.y+1
|
||||||
|
if not minetest.env:get_node_light(pos) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if minetest.env:get_node_light(pos) > 3 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if minetest.env:get_node(pos).name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
pos.y = pos.y+1
|
||||||
|
if minetest.env:get_node(pos).name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
minetest.env:add_entity(pos, "mobs:sand_monster")
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1016 B |
Binary file not shown.
After Width: | Height: | Size: 990 B |
Loading…
Reference in New Issue