diff options
author | orwell96 <orwell@bleipb.de> | 2021-04-25 21:53:41 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2021-04-25 21:54:51 +0200 |
commit | 112e3ff2555f1380a5125a9b09ef0a7fc81b053a (patch) | |
tree | 40a757346fa5ac19dc10e3ccf27cfc9b6da131dd /advtrains/trainlogic.lua | |
parent | e04c21be78f6c915537f7dc8fdbf8110d7eadcd0 (diff) | |
download | advtrains-112e3ff2555f1380a5125a9b09ef0a7fc81b053a.tar.gz advtrains-112e3ff2555f1380a5125a9b09ef0a7fc81b053a.tar.bz2 advtrains-112e3ff2555f1380a5125a9b09ef0a7fc81b053a.zip |
Fix undeclared globals warnings (#176)
Reported by Vanessa Dannenberg
Diffstat (limited to 'advtrains/trainlogic.lua')
-rw-r--r-- | advtrains/trainlogic.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index c9c7e76..c812ff7 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -139,9 +139,12 @@ minetest.register_on_joinplayer(function(player) advtrains.hhud[player:get_player_name()] = nil --independent of this, cause all wagons of the train which are loaded to reattach their players --needed because already loaded wagons won't call reattach_all() - for _,wagon in pairs(minetest.luaentities) do - if wagon.is_wagon and wagon.initialized and wagon.train_id==id then - wagon:reattach_all() + 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() + end end end end) |