mt-mods / travelnet

Network of teleporter-boxes that allows easy travelling to other boxes on the same network. (Mod for Minetest)
https://content.minetest.net/packages/mt-mods/travelnet/
GNU General Public License v3.0
7 stars 12 forks source link

Move assignment of pos from on_interact methods to inside show_current_formspec method #50

Closed oversword closed 2 years ago

oversword commented 2 years ago

So I'm trying to make sure the locked tarvelnet mod https://github.com/BlockySurvival/locked_travelnet is working with the most recent changes. Though the way it works (in locked_travelnet) could do with an overhaul I seem to be able to get it to mostly work.

I will be merging these changes immediately as they are pretty small, really just reduce repetition, and are mostly a matter of preference anyway... also I want to get this bug fixed.

These changes are required because an external mod (such as locked_travelnet) cannot have access to the internal data storage of the travelnet form data, instead of relying on having that in the on_interact method, I have moved it to the show_current_formspec method so that an external mod can just call that.

Perhaps the ideal solution would be to add a new set_data_pos(pos) method to the API or something, but for now this should work fine.