travelnet-cd2025/restore_network_via_abm.lua
Oversword 9b20c7b023
WIP: Code sanity improved (#18)
* Logic cleaned up and repetition removed
2021-07-03 19:41:00 +02:00

20 lines
710 B
Lua

minetest.register_abm({
nodenames = { "travelnet:travelnet" },
interval = 20,
chance = 1,
action = function(pos)
local meta = minetest.get_meta(pos)
local owner_name = meta:get_string("owner")
local station_name = meta:get_string("station_name")
local station_network = meta:get_string("station_network")
if owner_name and station_name and station_network
and not travelnet.get_station(owner_name, station_network, station_name) then
travelnet.add_target(station_name, station_network, pos, owner_name, meta, owner_name)
print("TRAVELNET: re-adding " .. tostring(station_name) .. " to " ..
tostring(station_network) .. " owned by " .. tostring(owner_name))
end
end
})