From be37a649f7ea83007ee15effed0a474fb8d00f59 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Sat, 29 Oct 2016 21:07:51 +0200 Subject: fix unloaded map chunk travelling --- trainlogic.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'trainlogic.lua') diff --git a/trainlogic.lua b/trainlogic.lua index 0291e8f..f16e1e2 100644 --- a/trainlogic.lua +++ b/trainlogic.lua @@ -246,11 +246,12 @@ function advtrains.train_step(id, train, dtime) --check for any trainpart entities if they have been unloaded. do this only if train is near a player, to not spawn entities into unloaded areas train.check_trainpartload=(train.check_trainpartload or 0)-dtime local node_range=(math.max((minetest.setting_get("active_block_range") or 0),1)*16) - if train.check_trainpartload<=0 and posfront and posback then - --print(minetest.pos_to_string(posfront)) + if train.check_trainpartload<=0 then + local ori_pos=advtrains.get_real_index_position(path, train.index) --not much to calculate + local should_check=false for _,p in ipairs(minetest.get_connected_players()) do - should_check=should_check or ((vector.distance(posfront, p:getpos())