joe7575 / Minetest-Hyperloop

Transportation Mod for Minetest
Other
5 stars 6 forks source link

Crash when placing a Junction-Block #2

Closed upsala closed 5 years ago

upsala commented 5 years ago

I've got the following stack-trace after placing or removing a junction-block on an 1000m Line.

2018-12-25 09:38:45: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'hyperloop' in callback item_OnPlace(): /usr/share/games/minetest/builtin/common/vector.lua:16: attempt to index local 'b' (a nil value) 2018-12-25 09:38:45: ERROR[Main]: stack traceback: 2018-12-25 09:38:45: ERROR[Main]: /usr/share/games/minetest/builtin/common/vector.lua:16: in function 'equals' 2018-12-25 09:38:45: ERROR[Main]: /usr/share/games/minetest/mods/tubelib2/internal1.lua:112: in function 'infotext' 2018-12-25 09:38:45: ERROR[Main]: /usr/share/games/minetest/mods/tubelib2/tube_api.lua:52: in function 'update1' 2018-12-25 09:38:45: ERROR[Main]: /usr/share/games/minetest/mods/tubelib2/tube_api.lua:154: in function 'after_place_node' 2018-12-25 09:38:45: ERROR[Main]: ...hare/games/minetest/mods/Minetest-Hyperloop/junction.lua:53: in function 'after_place_node' 2018-12-25 09:38:45: ERROR[Main]: /usr/share/games/minetest/builtin/game/item.lua:383: in function </usr/share/games/minetest/builtin/game/item.lua:264>

Btw.: Is there a technical reason for the 1000m-Limit? What happens when longer lines are converted from V1 to V2?

joe7575 commented 5 years ago

Hi, thanks for the report. As a fast solution change line 57 in 'hyperloop/tube.lua': max_tube_length = 1000, to something which fits to your needs. There is no technical reason, the only reason is that the calculation of tube connections need more time for longer lines. And players should be stimulated to place more junction blocks.

Longer lines will be converter but if you change something on that line, unfortunately, it will not work any more.

The better solution would be to place junction blocks automatically after every 1000m when converting from v1 to v2. Let's see what I can do...

joe7575 commented 5 years ago

I updated tubelib2 to prevent the crash. But adding junction blocks every 1000m is not that easy, it corrupts the Hyperloop data base while migrating to the new format. That means, broken connections after the migration have to be repaired by hand.

joe7575 commented 5 years ago

Issue fixed by automatically placing a junction block every 'max_tube_length' blocks after the migration of the data base.