From 0f25b414ac4c3bc603cfa292af9f53d119739a6f Mon Sep 17 00:00:00 2001 From: stujones11 Date: Sun, 17 Jan 2016 14:19:46 +0000 Subject: Prevent build-up of unloaded SAOs --- railcart/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/railcart/init.lua b/railcart/init.lua index c637e3f..7ca7fe2 100644 --- a/railcart/init.lua +++ b/railcart/init.lua @@ -136,6 +136,12 @@ minetest.register_entity("railcart:cart_entity", { self.timer = railcart:update(cart, RAILCART_ENTITY_UPDATE_TIME, object) end, get_staticdata = function(self) + if self.cart then + if self.cart:is_loaded() == false then + self.cart.timer = 0 + self.object:remove() + end + end return "expired" end, }) -- cgit v1.2.3