diff options
author | orwell96 <mono96.mml@gmail.com> | 2016-08-28 21:58:13 +0200 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2016-08-28 21:58:13 +0200 |
commit | d0e1588399d36cb9848f6cfafe375e271a785232 (patch) | |
tree | 2c5ec0254d9af4d865bf2c3afe4bf88a1f1aba2d /trainlogic.lua | |
parent | 30dd71ea5a0ec1be65d664941037ab2fd1ba4e4e (diff) | |
download | advtrains-d0e1588399d36cb9848f6cfafe375e271a785232.tar.gz advtrains-d0e1588399d36cb9848f6cfafe375e271a785232.tar.bz2 advtrains-d0e1588399d36cb9848f6cfafe375e271a785232.zip |
Add a subway train (and fix spelling mistake resulting in collision not working
Diffstat (limited to 'trainlogic.lua')
-rw-r--r-- | trainlogic.lua | 6 |
1 files changed, 3 insertions, 3 deletions
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 |