API access to rolling stock's rail layer
Posted: Sun Feb 02, 2025 1:19 am
An entity's location is generally represented by MapPosition in the API. However, when elevated rails overlap with ground rails, MapPosition is not sufficient to identify the location of rolling stock. I am requesting for rail layer information to be included in the API:
* When reading the location of rolling stock, mods should be able to read which rail layer it is on
* When creating rolling stock with create_entity, mods should be able to control which rail layer it is created on
Because of this issue, my mod causes trains to unexpectedly jump from one rail layer to the other. The mod reads an entity's position, removes the entity, and creates a replacement at the same position. Since the position is ambiguous, the train unexpectedly jumps layers.
The attached save file reproduces the problem. The player is riding a locomotive on the bottom rail layer. After loading the save file, move the engine from the player's inventory into the locomotive's equipment grid. From the viewpoint of the player, this causes the locomotive to jump to the top rail layer.
* When reading the location of rolling stock, mods should be able to read which rail layer it is on
* When creating rolling stock with create_entity, mods should be able to control which rail layer it is created on
Because of this issue, my mod causes trains to unexpectedly jump from one rail layer to the other. The mod reads an entity's position, removes the entity, and creates a replacement at the same position. Since the position is ambiguous, the train unexpectedly jumps layers.
The attached save file reproduces the problem. The player is riding a locomotive on the bottom rail layer. After loading the save file, move the engine from the player's inventory into the locomotive's equipment grid. From the viewpoint of the player, this causes the locomotive to jump to the top rail layer.