aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2022-06-13 14:17:24 +0200
committerorwell96 <orwell@bleipb.de>2022-06-13 14:17:24 +0200
commit2b21817b4fee688f72988b5707fbeb6f7c532e98 (patch)
tree8ebaa8aa0ada9823cf47c0207e780fad26bcc781 /advtrains
parent744aee2cdd319bc19e83cc9efb52a07ae6adbb06 (diff)
downloadadvtrains-2b21817b4fee688f72988b5707fbeb6f7c532e98.tar.gz
advtrains-2b21817b4fee688f72988b5707fbeb6f7c532e98.tar.bz2
advtrains-2b21817b4fee688f72988b5707fbeb6f7c532e98.zip
On_Joinplayer: fix train ID check for attachment update
Previously, statement was always false because train_id is no longer in the luaentity
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/trainlogic.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index 35c3726..a0fdaa1 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -143,8 +143,11 @@ minetest.register_on_joinplayer(function(player)
local id=advtrains.player_to_train_mapping[pname]
if id then
for _,wagon in pairs(minetest.luaentities) do
- if wagon.is_wagon and wagon.initialized and wagon.train_id==id then
- wagon:reattach_all()
+ if wagon.is_wagon and wagon.initialized and wagon.id then
+ local wdata = advtrains.wagons[wagon.id]
+ if wdata and wdata.train_id == id then
+ wagon:reattach_all()
+ end
end
end
end