aboutsummaryrefslogtreecommitdiff
path: root/wagons.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-05-29 22:02:51 +0200
committerorwell96 <mono96.mml@gmail.com>2016-05-29 22:02:51 +0200
commitc71b0209270daa2df717c449c67507d9db0dc0a9 (patch)
tree730a9c1d91c082ae45c3887d45e4910134d3a93a /wagons.lua
parent6e34cb19559ccc99ea11ccec6fc20172fdda25e2 (diff)
downloadadvtrains-c71b0209270daa2df717c449c67507d9db0dc0a9.tar.gz
advtrains-c71b0209270daa2df717c449c67507d9db0dc0a9.tar.bz2
advtrains-c71b0209270daa2df717c449c67507d9db0dc0a9.zip
fixed lua errors and code mistakes
Diffstat (limited to 'wagons.lua')
-rw-r--r--wagons.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/wagons.lua b/wagons.lua
index ea54e19..b58c574 100644
--- a/wagons.lua
+++ b/wagons.lua
@@ -72,6 +72,13 @@ function wagon:on_activate(staticdata, dtime_s)
--does this object already have an ID?
if not self.unique_id then
self.unique_id=os.time()..os.clock()--should be random enough.
+ else
+ for _,wagon in pairs(minetest.luaentities) do
+ if wagon.is_wagon and wagon.initialized and wagon.unique_id==self.unique_id then--i am a duplicate!
+ self.object:remove()
+ return
+ end
+ end
end
--is my train still here
if not self.train_id or not self:train() then