Page 1 of 1

0.15.12 On_train_Created ignores the equipment of the train

Posted: Sat May 20, 2017 3:00 pm
by Hermios
Hi
This bug is for modders
Here is my step by step
- Prepare a mod how will read the equipment of locos when a train creation is triggered.
you can use this :
OnTrainCreated=function(train)
for _,loco in pairs(train.locomotives.front_movers) do
for _,equipment in pairs(loco.grid.equipment) do
game.player.print(equipment.name)
end
end
for _,loco in pairs(train.locomotives.back_movers) do
for _,equipment in pairs(loco.grid.equipment) do
game.player.print(equipment.name)
end
end
end
end
Add a train, with an equipment (Happy if you use mine, TrainCaller, but I won't be that mad if you use another :D :D :D )
Then, remove the train
And add it again
This should trigger the print... however nothing happens. If another locomotive is added, then, it works. And if you check the grid, the equipment is still in.
I am pretty sure it's a bug
THanks

Hermios

Re: 0.15.12 On_train_Created ignores the equipment of the train

Posted: Sat May 20, 2017 5:10 pm
by Rseding91
Can you please post a save file and mod(s) needed to reproduce the problem you're having?

Re: 0.15.12 On_train_Created ignores the equipment of the train

Posted: Sat May 20, 2017 8:07 pm
by Hermios
Here it goes.
There are other mods that apply on this save, but you don't need it
Just remove the loco at the top, and replace it. Nothing will appear
If you do the same with the bottom one, it will display the content of the top loco.
Thanks

Hermios

Re: 0.15.12 On_train_Created ignores the equipment of the train

Posted: Sun May 21, 2017 4:12 am
by Rseding91
Ah, when the train event is fired the entity isn't fully built yet. The grid gets transferred back to the train after the event is over in the player built entity event.

Re: 0.15.12 On_train_Created ignores the equipment of the train

Posted: Sun May 21, 2017 8:41 am
by Hermios
Is that planned to fix it?

Re: 0.15.12 On_train_Created ignores the equipment of the train

Posted: Mon May 22, 2017 12:00 am
by Rseding91
Hermios wrote:Is that planned to fix it?
Yeah.