0.15.12 On_train_Created ignores the equipment of the train

This subforum contains all the issues which we already resolved.
Hermios
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Sat Aug 13, 2016 2:57 pm
Contact:

0.15.12 On_train_Created ignores the equipment of the train

Post 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
Rseding91
Factorio Staff
Factorio Staff
Posts: 16024
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: 0.15.12 On_train_Created ignores the equipment of the train

Post by Rseding91 »

Can you please post a save file and mod(s) needed to reproduce the problem you're having?
If you want to get ahold of me I'm almost always on Discord.
Hermios
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Sat Aug 13, 2016 2:57 pm
Contact:

Re: 0.15.12 On_train_Created ignores the equipment of the train

Post 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
Attachments
sandbox_base.zip
(3.72 MiB) Downloaded 69 times
TrainsWhistle_0.1.0.zip
(47.72 KiB) Downloaded 88 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 16024
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: 0.15.12 On_train_Created ignores the equipment of the train

Post 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.
If you want to get ahold of me I'm almost always on Discord.
Hermios
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Sat Aug 13, 2016 2:57 pm
Contact:

Re: 0.15.12 On_train_Created ignores the equipment of the train

Post by Hermios »

Is that planned to fix it?
Rseding91
Factorio Staff
Factorio Staff
Posts: 16024
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: 0.15.12 On_train_Created ignores the equipment of the train

Post by Rseding91 »

Hermios wrote:Is that planned to fix it?
Yeah.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”