diff options
author | orwell96 <mono96.mml@gmail.com> | 2016-05-29 22:02:51 +0200 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2016-05-29 22:02:51 +0200 |
commit | c71b0209270daa2df717c449c67507d9db0dc0a9 (patch) | |
tree | 730a9c1d91c082ae45c3887d45e4910134d3a93a /wagons.lua | |
parent | 6e34cb19559ccc99ea11ccec6fc20172fdda25e2 (diff) | |
download | advtrains-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.lua | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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
|