Closed BuckarooBanzay closed 4 years ago
Just need a nil check for this: https://github.com/S-S-X/metatool/blob/1b51d6d274e220a39a648f96716f171079d3a264/sharetool/init.lua#L112
I didn't have a network with the same name as the travelnet I used it on had.
if travelnet.targets[name] and travelnet.targets[name][network] then
travelnet.targets[name][network][station] = nil
end
Should also check a bit better whole owner setting with travelnets as above does not really seem to work at least not always, mentioned other problems with removing travelnet from previous network here: https://github.com/S-S-X/metatool/issues/16#issuecomment-638252103
So it might be that it needs bit more tinkering than just that to make it all work correctly... I would have used functions provided by travelnet itself but it did not really offer usable functions for removing travelnet from one network.
I'll take a look at it and test a bit, that nil checking is still needed unless there's better way to remove station from network (through some function provided by travelnet mod).
Actually that whole thing was completely wrong and only seemed to work in some specific cases, it should have been
travelnet.targets[current_owner][network][station] = nil
instead of
travelnet.targets[name][network][station] = nil
and name
should have been only used to send chat messages to player who used tool.
Also at beginning there's very inconsistent line
local current_owner = meta:set_string('owner', owner)
which should be
local current_owner = meta:get_string('owner')
Maybe fixing these already fixes few other things too :facepalm:
Seems that above commit fixes it, also cleaned up code a bit and added location of duplicate travelnet station coords to error message.
https://pandorabox.io/crashlogs/crash_2020-06-07_14-34.txt