diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-02-05 20:41:31 +0100 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-02-05 20:41:31 +0100 |
commit | d84c23f0845982e3011eadcd56ee7ded36992726 (patch) | |
tree | 33af672b7d61e33af13c13e0bd7360b1ff106adb /advtrains | |
parent | 648e501f46d3e8f1600e7639924bddae4e577796 (diff) | |
download | advtrains-d84c23f0845982e3011eadcd56ee7ded36992726.tar.gz advtrains-d84c23f0845982e3011eadcd56ee7ded36992726.tar.bz2 advtrains-d84c23f0845982e3011eadcd56ee7ded36992726.zip |
Do not invalidate paths unnecessarily
Recomputing paths needs time and computing power, so do this only when really necessary
Diffstat (limited to 'advtrains')
-rw-r--r-- | advtrains/advtrains/trackplacer.lua | 4 | ||||
-rw-r--r-- | advtrains/advtrains/tracks.lua | 1 |
2 files changed, 1 insertions, 4 deletions
diff --git a/advtrains/advtrains/trackplacer.lua b/advtrains/advtrains/trackplacer.lua index e5e3340..9fee011 100644 --- a/advtrains/advtrains/trackplacer.lua +++ b/advtrains/advtrains/trackplacer.lua @@ -256,7 +256,6 @@ minetest.register_craftitem("advtrains:trackworker",{ end advtrains.ndb.swap_node(pos, {name=nnprefix.."_"..suffix..modext[modpos+1], param2=node.param2}) end - advtrains.invalidate_all_paths() end end, on_use=function(itemstack, user, pointed_thing) @@ -285,8 +284,7 @@ minetest.register_craftitem("advtrains:trackworker",{ end local nextsuffix=tp.tracks[nnprefix].twcycle[suffix] advtrains.ndb.swap_node(pos, {name=nnprefix.."_"..nextsuffix..rotation, param2=node.param2}) - --invalidate trains - advtrains.invalidate_all_paths() + else atprint(name, dump(tp.tracks)) end diff --git a/advtrains/advtrains/tracks.lua b/advtrains/advtrains/tracks.lua index a4d5bcc..a645017 100644 --- a/advtrains/advtrains/tracks.lua +++ b/advtrains/advtrains/tracks.lua @@ -321,7 +321,6 @@ function advtrains.register_tracks(tracktype, def, preset) return not advtrains.get_train_at_pos(pos)
end,
after_dig_node=function(pos)
- advtrains.invalidate_all_paths()
advtrains.ndb.update(pos)
end,
after_place_node=function(pos)
|