aboutsummaryrefslogtreecommitdiff
path: root/advtrains/wagons.lua
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-07-19 23:00:07 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-07-19 23:00:07 +0200
commit8c66f1caf495442e1435bf3a49176932eee986b3 (patch)
treee42d872e3e42868456237e478ab53be64f6f82fd /advtrains/wagons.lua
parent7de2a9142f0b27f2b03235a6a47d9e2f02245852 (diff)
downloadadvtrains-8c66f1caf495442e1435bf3a49176932eee986b3.tar.gz
advtrains-8c66f1caf495442e1435bf3a49176932eee986b3.tar.bz2
advtrains-8c66f1caf495442e1435bf3a49176932eee986b3.zip
Fix error in workaround causing train entities to despawn.
Diffstat (limited to 'advtrains/wagons.lua')
-rw-r--r--advtrains/wagons.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index 28a471a..ba746ef 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -486,10 +486,10 @@ function wagon:on_step(dtime)
-- unload entity if out of range (because relevant pr won't be merged in engine)
-- This is a WORKAROUND!
- local outofrange = false
+ local outofrange = true
for _,p in pairs(minetest.get_connected_players()) do
- if vector.distance(p:get_pos(),pos)>=unload_wgn_range then
- outofrange = true
+ if vector.distance(p:get_pos(),pos)<=unload_wgn_range then
+ outofrange = false
end
end
if outofrange then