Page 1 of 1

[0.18.19] Crash when using rail planner on modded rail entities with order property

Posted: Wed Apr 22, 2020 12:27 am
by tbf
I have the following prototype in the mods directory:

Code: Select all

local recipe = table.deepcopy(data.raw.recipe["rail"])
recipe.enabled = true
recipe.name = "tram-rail"
recipe.ingredients = {{"iron-plate",1}}
recipe.result = "tram-rail"

local tramRail = table.deepcopy(data.raw["rail-planner"]["rail"])
tramRail.name = "tram-rail"
tramRail.straight_rail = "tram-rail-straight"

local tramRailStraight = table.deepcopy(data.raw["straight-rail"]["straight-rail"])
tramRailStraight.name = "tram-rail-straight"
tramRailStraight.order = "a"

data:extend{tramRail,recipe,tramRailStraight}
The entity tramRailStraight is incorrectly assigned an order. After crafting a tram-rail and placing it down in any new world, using the rail planner to extend the track will crash the game immediately.

Re: [0.18.19] Crash when using rail planner on modded rail entities with order property

Posted: Wed Apr 22, 2020 5:04 am
by Rseding91
Thanks for the report. It's now fixed for the next release.

The issue is the game never checked that what mods defined for straight_rail and curved_rail on the rail-planner item type are built by that rail-planner item.

Specifically, if a rail-planner has "straight_rail" set to an entity, that entities first item-to-build-this must be that rail planner. Same for "curved_rail". In the mod, it's nothing; there is no item-to-place for the curved rail and so it crashes.

Re: [0.18.19] Crash when using rail planner on modded rail entities with order property

Posted: Wed Apr 22, 2020 5:12 am
by tbf
Neat, thanks for the fix

Re: [0.18.19] Crash when using rail planner on modded rail entities with order property

Posted: Wed Apr 22, 2020 5:34 am
by Rseding91
tbf wrote: Wed Apr 22, 2020 5:12 am Neat, thanks for the fix
Specifically, the fix checks that the lua definitions are correct and will provide an error message stating what's wrong if they aren't.