restore_network_via_abm.lua 710 B

1234567891011121314151617181920
  1. minetest.register_abm({
  2. nodenames = { "travelnet:travelnet" },
  3. interval = 20,
  4. chance = 1,
  5. action = function(pos)
  6. local meta = minetest.get_meta(pos)
  7. local owner_name = meta:get_string("owner")
  8. local station_name = meta:get_string("station_name")
  9. local station_network = meta:get_string("station_network")
  10. if owner_name and station_name and station_network
  11. and not travelnet.get_station(owner_name, station_network, station_name) then
  12. travelnet.add_target(station_name, station_network, pos, owner_name, meta, owner_name)
  13. print("TRAVELNET: re-adding " .. tostring(station_name) .. " to " ..
  14. tostring(station_network) .. " owned by " .. tostring(owner_name))
  15. end
  16. end
  17. })