nodes.lua 1.0 KB

1234567891011121314151617181920212223242526272829
  1. minetest.register_node('teleport:test', {
  2. description = 'Test teleport node',
  3. tiles = {'teleport_test.png'},
  4. floodable = true,
  5. groups = {oddly_breakable_by_hand=3},
  6. after_place_node = function(pos, placer)
  7. local player_name = placer:get_player_name()
  8. local meta = minetest.get_meta(pos)
  9. meta:set_string('infotext', 'Unconfigured station')
  10. meta:set_string('owner', player_name)
  11. local key = minetest.pos_to_string(pos)
  12. local data_table = {}
  13. data_table.owner = player_name
  14. data_table.name = 'Unconfigured station'
  15. data_table.desc = ''
  16. teleport.data[key] = data_table
  17. end,
  18. after_destruct = function(pos)
  19. local key = minetest.pos_to_string(pos)
  20. teleport.data[key] = nil
  21. end,
  22. on_rightclick = function(pos, node, clicker)
  23. local name = clicker:get_player_name()
  24. teleport.find_stations()
  25. teleport.local_pos[name] = pos
  26. minetest.show_formspec(name, 'teleport:formspec', teleport.formspec_overview(pos, name))
  27. end,
  28. })