aboutsummaryrefslogtreecommitdiff
path: root/advtrains/couple.lua
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-10-12 15:41:27 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-10-12 15:41:27 +0200
commit964b0a7ab6e7e5756adef4f126f229995bd9210c (patch)
treea3970ea0c5bcf2e0a5bdd09c90cf9b9a742d6f6b /advtrains/couple.lua
parentdcf5b8670e19ad7603a0e305ec8515653555084f (diff)
downloadadvtrains-964b0a7ab6e7e5756adef4f126f229995bd9210c.tar.gz
advtrains-964b0a7ab6e7e5756adef4f126f229995bd9210c.tar.bz2
advtrains-964b0a7ab6e7e5756adef4f126f229995bd9210c.zip
Remove couple entities when out of range from players
Work around the entity flood bug caused by improper engine handling of static_save=false
Diffstat (limited to 'advtrains/couple.lua')
-rw-r--r--advtrains/couple.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/advtrains/couple.lua b/advtrains/couple.lua
index 1b213c2..5116bac 100644
--- a/advtrains/couple.lua
+++ b/advtrains/couple.lua
@@ -106,6 +106,10 @@ minetest.register_entity("advtrains:couple", {
end,
on_step=function(self, dtime)
return advtrains.pcall(function()
+ if advtrains.outside_range(self.object:getpos()) then
+ self.object:remove()
+ return
+ end
advtrains.atprint_context_tid=self.train_id_1
if not self.train_id_1 or not self.train_id_2 then atprint("Couple: train ids not set!") self.object:remove() return end