From c71b0209270daa2df717c449c67507d9db0dc0a9 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Sun, 29 May 2016 22:02:51 +0200 Subject: fixed lua errors and code mistakes --- wagons.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'wagons.lua') 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 -- cgit v1.2.3