Modified the respawn function and added the do_custom for the "hydra procedure"
This commit is contained in:
parent
61df4cbc70
commit
3d94a86643
@ -14,7 +14,7 @@ nssm:register_mob("nssm:masticone", {
|
|||||||
rotate = 270,
|
rotate = 270,
|
||||||
walk_velocity = 1.5,
|
walk_velocity = 1.5,
|
||||||
run_velocity = 2.5,
|
run_velocity = 2.5,
|
||||||
sounds = {
|
sounds = {
|
||||||
random = "masticone",
|
random = "masticone",
|
||||||
},
|
},
|
||||||
damage = 5,
|
damage = 5,
|
||||||
@ -36,9 +36,9 @@ nssm:register_mob("nssm:masticone", {
|
|||||||
armor = 60,
|
armor = 60,
|
||||||
drawtype = "front",
|
drawtype = "front",
|
||||||
water_damage = 0,
|
water_damage = 0,
|
||||||
lava_damage = 5,
|
lava_damage = 0,
|
||||||
floats=0,
|
floats=0,
|
||||||
hydra = true,
|
--hydra = true,
|
||||||
light_damage = 0,
|
light_damage = 0,
|
||||||
on_rightclick = nil,
|
on_rightclick = nil,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
@ -56,27 +56,60 @@ nssm:register_mob("nssm:masticone", {
|
|||||||
punch_end = 180,
|
punch_end = 180,
|
||||||
},
|
},
|
||||||
on_die = function(self, pos)
|
on_die = function(self, pos)
|
||||||
core.after(2, function()
|
core.after(2, function()
|
||||||
minetest.add_particlespawner(
|
minetest.add_particlespawner(
|
||||||
200, --amount
|
200, --amount
|
||||||
0.1, --time
|
0.1, --time
|
||||||
{x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos
|
{x=pos.x-1, y=pos.y-1, z=pos.z-1}, --minpos
|
||||||
{x=pos.x+1, y=pos.y+1, z=pos.z+1}, --maxpos
|
{x=pos.x+1, y=pos.y+1, z=pos.z+1}, --maxpos
|
||||||
{x=-0, y=-0, z=-0}, --minvel
|
{x=-0, y=-0, z=-0}, --minvel
|
||||||
{x=1, y=1, z=1}, --maxvel
|
{x=1, y=1, z=1}, --maxvel
|
||||||
{x=-0.5,y=5,z=-0.5}, --minacc
|
{x=-0.5,y=5,z=-0.5}, --minacc
|
||||||
{x=0.5,y=5,z=0.5}, --maxacc
|
{x=0.5,y=5,z=0.5}, --maxacc
|
||||||
0.1, --minexptime
|
0.1, --minexptime
|
||||||
1, --maxexptime
|
1, --maxexptime
|
||||||
3, --minsize
|
3, --minsize
|
||||||
4, --maxsize
|
4, --maxsize
|
||||||
false, --collisiondetection
|
false, --collisiondetection
|
||||||
"tnt_smoke.png" --texture
|
"tnt_smoke.png" --texture
|
||||||
)
|
)
|
||||||
local pos1 = {x=pos.x+math.random(-1,1), y=pos.y+0.5, z=pos.z+math.random(-1,1)}
|
for i = 1,2 do
|
||||||
local pos2 = {x=pos.x+math.random(-1,1), y=pos.y+0.5, z=pos.z+math.random(-1,1)}
|
local pos = {x=pos.x+math.random(-1,1), y=pos.y+0.5, z=pos.z+math.random(-1,1)}
|
||||||
minetest.add_entity(pos1, "nssm:masticone")
|
local n = minetest.env:get_node(pos).name
|
||||||
minetest.add_entity(pos2, "nssm:masticone")
|
if n == "air" then
|
||||||
end)
|
minetest.add_entity(pos, "nssm:masticone")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
|
||||||
|
do_custom = function (self)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
local n = minetest.env:get_node(pos).name
|
||||||
|
|
||||||
|
if n == "default:lava_source" or n == "default:lava_flowing" then
|
||||||
|
self.object:set_hp(self.object:get_hp()-5)
|
||||||
|
if self.object:get_hp() <=0 then
|
||||||
|
|
||||||
|
for _,drop in pairs(self.drops) do
|
||||||
|
|
||||||
|
if math.random(1, drop.chance) == 1 then
|
||||||
|
|
||||||
|
obj = minetest.add_item(pos,
|
||||||
|
ItemStack(drop.name .. " "
|
||||||
|
.. math.random(drop.min, drop.max)))
|
||||||
|
|
||||||
|
if obj then
|
||||||
|
|
||||||
|
obj:setvelocity({
|
||||||
|
x = math.random(-1, 1),
|
||||||
|
y = 6,
|
||||||
|
z = math.random(-1, 1)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user