Skip to content

Instantly share code, notes, and snippets.

@PilzAdam
Created January 22, 2013 19:02
Show Gist options
  • Select an option

  • Save PilzAdam/4597327 to your computer and use it in GitHub Desktop.

Select an option

Save PilzAdam/4597327 to your computer and use it in GitHub Desktop.
minetest.register_craftitem("test:test", {
description = "Testcraftitem",
inventory_image = "test_test.png",
on_use = function(itemstack, dropper, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local minp = {x=pos.x+50, y=pos.y+12, z=pos.z-50}
local maxp = {x=pos.x-50, y=pos.y+2, z=pos.z+50}
local t1 = os.time()
for x=minp.x,maxp.x do
for y=minp.y,maxp.y do
for z=minp.z,maxp.z do
minetest.env:set_node({x=x, y=y, z=z}, {name="default:stone"})
end
end
end
local t2 = os.time()
minetest.env:set_node_area(minp, maxp, {name="default:dirt"})
local t3 = os.time()
minetest.chat_send_all("set_node(): "..t2-t1.."; set_node_area(): "..t3-t2)
end,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment