Inserted the new digging_ability function:

modified:   sandworm.lua
modified:   stone_eater.lua
master
npx 2016-04-24 22:25:11 +02:00
parent c1d768d355
commit bc14b62ce1
2 changed files with 2 additions and 36 deletions

View File

@ -46,23 +46,6 @@ nssm:register_mob("nssm:sandworm", {
punch_end = 180,
},
do_custom = function(self)
--Worm
local c=2
local pos = self.object:getpos()
local v = self.object:getvelocity()
for dx = -c*(math.abs(v.x))-1 , c*(math.abs(v.x))+1 do
for dy=0,4 do
for dz = -c*(math.abs(v.z))-1 , c*(math.abs(v.z))+1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name
if (n~="default:water_source" and n~="default:water_flowing") then
if n=="default:sand" or n=="default:desert_sand" then
minetest.env:set_node(t, {name="air"})
end
end
end
end
end
nssm:digging_ability(self, nil, self.run_velocity, {x=0, y=2, z=0})
end,
})

View File

@ -51,23 +51,6 @@ nssm:register_mob("nssm:stone_eater", {
punch_end = 185,
},
do_custom = function(self)
--Remove stone around
local pos = self.object:getpos()
local c=3
local v = self.object:getvelocity()
for dx = -c*(math.abs(v.x))-1 , c*(math.abs(v.x))+1 do
for dy=0,1 do
for dz = -c*(math.abs(v.z))-1 , c*(math.abs(v.z))+1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(t).name
if (n~="default:water_source" and n~="default:water_flowing") then
if n=="default:stone" or n=="default:sandstone" or n=="default:cobble" then
minetest.env:set_node(t, {name="air"})
end
end
end
end
end
nssm:digging_ability(self, "stone", self.run_velocity, {x=0, y=2, z=0})
end,
})