diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-02-03 20:40:30 +0100 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-02-03 20:40:30 +0100 |
commit | 328d5054a105869c7e12df1941ceedb308ef1faa (patch) | |
tree | 736df563aa116e08e8ae4284b38a90852b25bd1e /advtrains/advtrains_luaautomation/atc_rail.lua | |
parent | a72dda17be2175d5df8f1b7dd28e5ddeabe1494d (diff) | |
download | advtrains-328d5054a105869c7e12df1941ceedb308ef1faa.tar.gz advtrains-328d5054a105869c7e12df1941ceedb308ef1faa.tar.bz2 advtrains-328d5054a105869c7e12df1941ceedb308ef1faa.zip |
Revert change to node pos hashes, and rewrite trackdb to use individual coordinates
The precision of integers was not sufficient for saving pos node hashes in most cases, leading to strange bugs.
This fixes broken ATC rails, broken LuaAutomation stuff and trackdb on Windows.
Probably also fixes trains randomly stopping.
Diffstat (limited to 'advtrains/advtrains_luaautomation/atc_rail.lua')
-rw-r--r-- | advtrains/advtrains_luaautomation/atc_rail.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/advtrains/advtrains_luaautomation/atc_rail.lua b/advtrains/advtrains_luaautomation/atc_rail.lua index b2a8aad..f52252c 100644 --- a/advtrains/advtrains_luaautomation/atc_rail.lua +++ b/advtrains/advtrains_luaautomation/atc_rail.lua @@ -7,8 +7,14 @@ local r={} function r.fire_event(pos, evtdata) - local ph=minetest.hash_node_position(pos) - local railtbl = atlatc.active.nodes[ph] or {} + local ph=minetest.pos_to_string(pos) + local railtbl = atlatc.active.nodes[ph] + + if not railtbl then + atprint("missing rail table entry!") + return + end + local arrowconn = railtbl.arrowconn @@ -70,7 +76,7 @@ advtrains.register_tracks("default", { atlatc.active.on_receive_fields(pos, ...) --set arrowconn (for ATC) - local ph=minetest.hash_node_position(pos) + local ph=minetest.pos_to_string(pos) local _, conn1=advtrains.get_rail_info_at(pos, advtrains.all_tracktypes) atlatc.active.nodes[ph].arrowconn=conn1 end, |