lightning.lua 645 B

123456789101112131415161718192021222324
  1. -- lightning: https://github.com/minetest-mods/lightning
  2. minetest.register_craftitem("witchcraft:scroll_lightning", {
  3. description = "Scroll of lightning",
  4. inventory_image = "witchcraft_scroll.png^witchcraft_thunder_over.png",
  5. stack_max = 1,
  6. on_use = function(item, placer, pos)
  7. local playerpos = placer:getpos();
  8. local dir = placer:get_look_dir();
  9. lightning.strike({x=playerpos.x+dir.x*2,y=playerpos.y+0+dir.y,z=playerpos.z+dir.z*2})
  10. item:take_item()
  11. return item
  12. end,
  13. })
  14. minetest.register_craft({
  15. output = 'witchcraft:scroll_lightning',
  16. recipe = {
  17. {'default:steel_ingot'},
  18. {'default:diamond'},
  19. {'witchcraft:scroll'},
  20. }
  21. })