Modified the respawn function and added the do_custom for the "hydra procedure"

This commit is contained in:
npx 2016-05-10 23:23:41 +02:00
parent 61df4cbc70
commit 3d94a86643

View File

@ -36,9 +36,9 @@ nssm:register_mob("nssm:masticone", {
armor = 60,
drawtype = "front",
water_damage = 0,
lava_damage = 5,
lava_damage = 0,
floats=0,
hydra = true,
--hydra = true,
light_damage = 0,
on_rightclick = nil,
attack_type = "dogfight",
@ -73,10 +73,43 @@ nssm:register_mob("nssm:masticone", {
false, --collisiondetection
"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)}
local pos2 = {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")
minetest.add_entity(pos2, "nssm:masticone")
for i = 1,2 do
local pos = {x=pos.x+math.random(-1,1), y=pos.y+0.5, z=pos.z+math.random(-1,1)}
local n = minetest.env:get_node(pos).name
if n == "air" then
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,
})