I came across the issue when messing with the new fast_replace option for rollingstock, but as it turns out that isn't the root cause.
It's kind of a weird scenario since the solution should just be "don't do that" but wanted to report it anyway since it crashes to desktop.
I've attached a small mod that can quickly identify the issue.
The main thing for the repro is this event:
Code: Select all
script.on_event(defines.events.on_built_entity, function(event)
local entity = event.entity
local surface = entity.surface
local entity_data = {
name = "locomotive",
position = entity.position,
direction = entity.direction,
force = entity.force,
raise_built = false,
fast_replace = false,
create_build_effect_smoke = false,
orientation = entity.orientation,
enable_logistics_while_moving = entity.enable_logistics_while_moving,
grid = entity.grid,
color = entity.color,
copy_color_from_train_stop = entity.copy_color_from_train_stop
}
surface.create_entity(entity_data)
end, {{filter = "rolling-stock"}})
As you can see I was able to place a locomotive in the curve by carefully centering it between two rail pieces, but placing another afterwards crashes the game.
Also, like I said, the create_entity doesn't fail when the train is actually placed which is kinda odd:

