add_target.lua 655 B

12345678910111213141516171819202122
  1. local S = minetest.get_translator("travelnet")
  2. -- add a new target; meta is optional
  3. function travelnet.add_target(station_name, network_name, pos, player_name, meta, owner_name)
  4. local node = minetest.get_node(pos)
  5. local is_elevator = travelnet.is_elevator(node.name)
  6. local success, result = travelnet.actions.add_station({
  7. pos = pos,
  8. node = node,
  9. meta = meta,
  10. props = {
  11. station_name = station_name,
  12. station_network = network_name,
  13. owner_name = owner_name,
  14. is_elevator = is_elevator
  15. },
  16. }, {}, minetest.get_player_by_name(player_name))
  17. if not success then
  18. travelnet.show_message(pos, player_name, S("Error"), result)
  19. end
  20. end