summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstujones11 <stujones111@gmail.com>2016-01-17 14:19:46 +0000
committerstujones11 <stujones111@gmail.com>2016-01-17 15:42:07 +0000
commit0f25b414ac4c3bc603cfa292af9f53d119739a6f (patch)
tree063b5292586062ab4f54ac80ca0090d4ece8fe66
parent6f88d59d9d6ddac909df0000db8589c4f1b4ceca (diff)
Prevent build-up of unloaded SAOs
-rw-r--r--railcart/init.lua6
1 files changed, 6 insertions, 0 deletions
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,
})