From 8c66f1caf495442e1435bf3a49176932eee986b3 Mon Sep 17 00:00:00 2001 From: Gabriel PĂ©rez-Cerezo Date: Sun, 19 Jul 2020 23:00:07 +0200 Subject: Fix error in workaround causing train entities to despawn. --- advtrains/wagons.lua | 6 +++--- 1 file 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 -- cgit v1.2.3