I+noticed+that+a+player,+who+was+on+a+wagon,
+and+joins+the+game+_while+the+wagon+is+already+loaded_,
+is+not+attached+to+the+wagon.
I+think+the+problem+is+this+section+of+code+inside+the+on_joinplayer+callback+handler:
local+id+=+blablah
...
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
This+never+calls+reattach_all()+on+any+wagon,
+because+wagon.train_id+does+not+exist.
Instead,+advtrains.wagons[wagon.id].train_id+has+to+be+used.
If+I+change+the+code+to+the+following,+it+works:
if+wagon.is_wagon+and+wagon.initialized+and+advtrains.wagons[wagon.id].train_id==id+then
wagon:reattach_all()
end
Seriously? Plusses all over? I will try it again.
---
I noticed that a player, who was on a wagon,
and joins the game _while the wagon is already loaded_,
is not attached to the wagon.
I think the problem is this section of code inside the on_joinplayer callback
handler:
local id = blablah
...
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
This never calls reattach_all() on any wagon,
because wagon.train_id does not exist.
Instead, advtrains.wagons[wagon.id].train_id has to be used.
If I change the code to the following, it works:
if wagon.is_wagon and wagon.initialized and
advtrains.wagons[wagon.id].train_id==id then
wagon:reattach_all()
end