Created
January 22, 2013 19:02
-
-
Save PilzAdam/4597327 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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