diff options
Diffstat (limited to 'advtrains')
-rw-r--r-- | advtrains/advtrains/init.lua | 4 | ||||
-rw-r--r-- | advtrains/advtrains/wagons.lua | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/advtrains/advtrains/init.lua b/advtrains/advtrains/init.lua index 03ec553..a415857 100644 --- a/advtrains/advtrains/init.lua +++ b/advtrains/advtrains/init.lua @@ -34,8 +34,8 @@ local function print_concat_table(a) end return str end ---atprint=function() end -atprint=function(t, ...) minetest.log("action", "[advtrains]"..print_concat_table({t, ...})) minetest.chat_send_all("[advtrains]"..print_concat_table({t, ...})) end +atprint=function() end +--atprint=function(t, ...) minetest.log("action", "[advtrains]"..print_concat_table({t, ...})) minetest.chat_send_all("[advtrains]"..print_concat_table({t, ...})) end sid=function(id) return string.sub(id, -4) end dofile(advtrains.modpath.."/helpers.lua"); diff --git a/advtrains/advtrains/wagons.lua b/advtrains/advtrains/wagons.lua index bedffda..13811ad 100644 --- a/advtrains/advtrains/wagons.lua +++ b/advtrains/advtrains/wagons.lua @@ -151,8 +151,17 @@ function wagon:init_shared() end
end
function wagon:ensure_init()
- if self.initialized then return true end
- self.object:setvelocity({x=0,y=0,z=0})
+ if self.initialized then
+ if self.noninitticks then self.noninitticks=nil end
+ return true
+ end
+ if not self.noninitticks then self.noninitticks=0 end
+ self.noninitticks=self.noninitticks+1
+ if self.noninitticks>20 then
+ self.object:remove()
+ else
+ self.object:setvelocity({x=0,y=0,z=0})
+ end
return false
end
|