From d0e1588399d36cb9848f6cfafe375e271a785232 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Sun, 28 Aug 2016 21:58:13 +0200 Subject: Add a subway train (and fix spelling mistake resulting in collision not working --- trainlogic.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'trainlogic.lua') diff --git a/trainlogic.lua b/trainlogic.lua index 71d7086..81672d9 100644 --- a/trainlogic.lua +++ b/trainlogic.lua @@ -168,7 +168,7 @@ function advtrains.train_step(id, train, dtime) if train.couple_eid_back and (not minetest.luaentities[train.couple_eid_back] or not minetest.luaentities[train.couple_eid_back].is_couple) then train.couple_eid_back=nil end --skip certain things (esp. collision) when not moving - local train_moves=train.velocity~=0 + local train_moves=(train.velocity~=0) --if not train.last_pos then advtrains.trains[id]=nil return end @@ -202,7 +202,7 @@ function advtrains.train_step(id, train, dtime) if train.tarvelocity<0 then train.tarvelocity=0 end end - if train_moving then + if train_moves then --check for collisions by finding objects --front local search_radius=4 @@ -294,7 +294,7 @@ function advtrains.train_step(id, train, dtime) --handle collided_with_env if train.recently_collided_with_env then train.tarvelocity=0 - if not train_moving then + if not train_moves then train.recently_collided_with_env=false--reset status when stopped end end -- cgit v1.2.3