ziggurat.lua 774 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. local function fill_block(min, max, node)
  2. for x = min.x, max.x do
  3. for y = min.y, max.y do
  4. for z = min.z, max.z do
  5. minetest.set_node({x=x, y=y, z=z}, node)
  6. end
  7. end
  8. end
  9. end
  10. local function ziggurat(pos, step_width, step_height, bottom_h_sz, num_steps)
  11. local w = bottom_h_sz
  12. for sn = 1,num_steps do
  13. fill_block(
  14. vector.subtract(pos, {x=w, y=0, z=w}),
  15. vector.add(pos, {x=w, y=step_height*sn-1, z=w}),
  16. {name="default:sandstonebrick"}
  17. )
  18. w = w - step_width
  19. end
  20. -- TODO: steps
  21. end
  22. minetest.register_node("potions:zseed", {
  23. description = "Ziggurat Seed",
  24. drawtype = "node",
  25. tiles = {"default_stone_brick.png^default_tool_pick_stone.png"},
  26. groups = {cracky=3,},
  27. on_construct = function(pos)
  28. ziggurat(pos, 2, 2, 8, 5)
  29. end
  30. })