Hello,
Let's assume the setup pictured below. 2 tracks of rails. All trains were placed manualy, having the default color tint as defined in their prototype data. This means that LuaEntity.color is nil. The trains on the top track are tinted manualy, resulting in their LuaEntity.color to be set to the correct tint. Manualy setting this color back to the default color will also result in LuaEntity.color to still be present.
Now the issue:
When I copy (source) a locomotive that has the LuaEntity.color set, the pasted entity (destination) locomotive will take that color. This means for example, when I copy locomotive number 2 (green) and paste it on locomotive number 3 (red), the red locomotive will become green.
Now when I copy (source) the locomotive number 1, which does not have LuaEntity.color set, and paste it to the locomotive number 2, like the base game has, it will paste correctly the red-ish color, as both locomotive prototypes have the same default color set.
When I however try to paste locomotive number 1 (base game red) on the angels smelting train locomotive (red), it will not get the red color from the base game locomotive, instead it will get the orange (default) color of the smelting locomotive instead.
Solution:
When the paste behavior is executed, it first checks the color of the entity, which is fine as it is now. However, when the entity does not have a color set, it should first try to obtain the color from the source entity prototype instead of looking directly for the destination enitity prototype color.
This will result, when copying locomotive 1 onto locomotive 3, that locomotive 3 turns base game red instead of orange.
I've attached the save game and uploaded the mod on wetransfer as 30MB is too big to upload the mod on the forums: https://we.tl/t-mfhQ8CQUmM Please comment if I need to reupload it.
Kind regards
lovely_santa
[Rseding] [0.18.17] Rolling stock does not copy default color
- lovely_santa
- Filter Inserter
- Posts: 502
- Joined: Sat Feb 18, 2017 9:41 pm
- Contact:
[Rseding] [0.18.17] Rolling stock does not copy default color
- Attachments
-
- LocomotiveTinting.zip
- (2.38 MiB) Downloaded 34 times
Re: [Rseding] [0.18.17] Rolling stock does not copy default color
Thanks for the report. I changed the copy-paste logic so it allows copying in the cases you described.
If you want to get ahold of me I'm almost always on Discord.