get_train_stop_trains() behaviour when station name changed
Posted: Sat Nov 24, 2018 12:20 pm
If you have a single station with a train parked at it and you change the station name, then 'event.entity.get_train_stop_trains()' correctly returns the train that was in the single train stop. However, if there are more than one train stops with the same name, and a train is parked in one of these train stops and you change the train stop's name, then the same function, 'event.entity.get_train_stop_trains()' is unable to return that train. As this is based off the entity, not the backer name it should be able to function correctly.
This event is within a "script.on_event(defines.events.on_entity_renamed, function(event)" code block
In the single station case, the return looks like this -
{
{
__self = "userdata: 0x000000006d54bce0"
}
}
When there is more than one station with the same name (ie backer_name) then you get -
{}
(Results per game.write_file("trains",serpent.block(trains),{comment=false}))
- it is possible this is related to the same issue you fixed for 0.17 "Crash on LuaEntity.get_train_stop_trains() + train change" - however, I am not sure of this
This event is within a "script.on_event(defines.events.on_entity_renamed, function(event)" code block
In the single station case, the return looks like this -
{
{
__self = "userdata: 0x000000006d54bce0"
}
}
When there is more than one station with the same name (ie backer_name) then you get -
{}
(Results per game.write_file("trains",serpent.block(trains),{comment=false}))
- it is possible this is related to the same issue you fixed for 0.17 "Crash on LuaEntity.get_train_stop_trains() + train change" - however, I am not sure of this