[2.0.35] 1.1 BP converted during game load is converted differently than pasting via BP string

Bugs that are actually features.
kryojenik
Inserter
Inserter
Posts: 46
Joined: Fri Jun 26, 2020 8:18 pm
Contact:

[2.0.35] 1.1 BP converted during game load is converted differently than pasting via BP string

Post by kryojenik »

A 1.1 blueprint in a players storage, game inventory, or game library are all converted upon load into 2.x. Filters in constant combinators have their location (index) changed. All filters in the combinator are compacted into a 1 indexed, sequential list with no gaps. If you export that BP on 1.1 and then import the BP string on 2.x the original index positions are maintained. For some mods that do assume / depend on specific index of a signal, this causes problems.

1.1 BP:

Code: Select all

0eNqdlcuOozAQRX9lVGtoNYSEx6I38wu9G7WQAQesNjZtF1GiiH+fcpjQmYkTJbMyfnCq6ta1fIRKjnwwQiEURxC1VhaKX0ewolVMujU8DBwKEMh7CECx3s0kqrDWfSUUQ21gCkCohu+hiKaPALhCgYLPpNPkUKqxr7ihAwvDomGi7TCkQRJ60Jb+0soFJVIY5wEcaIxW0xRcceLnOZGPs3qak/swybc0uhUWRR06nAot6iEUahjRh9y8rP9AX9YkIsmPRsuy4h3bCRKWztXC1KPAkvaa5eetMBbLqybthMGRye8+zSdCpg7YCdXCHMMic/1+dZN+YObUwwLe3PZoOYWS2lD30IzcV+z6brF6xBvVppfVeribe1wv8NwRv3SGs6bcGt2XJ8xcUACnSemYA28eF/EdKGdyCZtTAPBUkD7tptQnRHbrot2zUHrTQlshkZsbF/uqXBeyJ9Fn6SVXLXazcUbnmni567HL/EEe29/irRbe6j949oIULaTkcZLhXyO3JE+IneG207K5LDZK0iRbbZJ0Ya8fZw9G70TzODqfPmgfWWsdmQi1G88UKLZMWvLvkvKy8lcwcmj9eRGyyF6Df0r1HJl8PsyftjPda3oATo9FcfG2UAKs4iQYRPvwLd7/+KnVjizpCAGcv4o4I1HyOM2ybJNH8TT9BmClPK8=

Code: Select all

{
    "blueprint": {
        "icons": [
            {
                "signal": {
                    "type": "item",
                    "name": "ltn-combinator"
                },
                "index": 1
            }
        ],
        "entities": [
            {
                "entity_number": 1,
                "name": "straight-rail",
                "position": {
                    "x": -29,
                    "y": -13
                }
            },
            {
                "entity_number": 2,
                "name": "straight-rail",
                "position": {
                    "x": -29,
                    "y": -11
                }
            },
            {
                "entity_number": 3,
                "name": "straight-rail",
                "position": {
                    "x": -29,
                    "y": -9
                }
            },
            {
                "entity_number": 4,
                "name": "logistic-train-stop-input",
                "position": {
                    "x": -26.5,
                    "y": -9.5
                },
                "control_behavior": {
                    "circuit_condition": {
                        "first_signal": {
                            "type": "virtual",
                            "name": "signal-anything"
                        },
                        "constant": 0,
                        "comparator": ">"
                    },
                    "use_colors": true
                }
            },
            {
                "entity_number": 5,
                "name": "logistic-train-stop-output",
                "position": {
                    "x": -27.5,
                    "y": -9.5
                }
            },
            {
                "entity_number": 6,
                "name": "logistic-train-stop",
                "position": {
                    "x": -27,
                    "y": -9
                },
                "control_behavior": {
                    "read_from_train": true,
                    "train_stopped_signal": {
                        "type": "virtual",
                        "name": "signal-T"
                    }
                },
                "station": ""
            },
            {
                "entity_number": 7,
                "name": "straight-rail",
                "position": {
                    "x": -29,
                    "y": -7
                }
            },
            {
                "entity_number": 8,
                "name": "ltn-combinator",
                "position": {
                    "x": -26.5,
                    "y": -7.5
                },
                "control_behavior": {
                    "filters": [
                        {
                            "signal": {
                                "type": "virtual",
                                "name": "ltn-min-train-length"
                            },
                            "count": 2,
                            "index": 2
                        },
                        {
                            "signal": {
                                "type": "virtual",
                                "name": "ltn-max-train-length"
                            },
                            "count": 3,
                            "index": 3
                        },
                        {
                            "signal": {
                                "type": "virtual",
                                "name": "ltn-max-trains"
                            },
                            "count": 1,
                            "index": 4
                        },
                        {
                            "signal": {
                                "type": "virtual",
                                "name": "ltn-requester-threshold"
                            },
                            "count": 2147483647,
                            "index": 5
                        },
                        {
                            "signal": {
                                "type": "virtual",
                                "name": "ltn-provider-threshold"
                            },
                            "count": 2147483647,
                            "index": 9
                        }
                    ]
                },
                "tags": {
                    "ltnc": {
                        "provider": false,
                        "requester": false,
                        "ltn-provider-stack-threshold": 80,
                        "ltn-requester-stack-threshold": 80
                    }
                }
            },
            {
                "entity_number": 9,
                "name": "straight-rail",
                "position": {
                    "x": -29,
                    "y": -5
                }
            }
        ],
        "item": "blueprint",
        "label": "1x->2x Conversion",
        "version": 281479278886912
    }
}
Converted during game load:

Code: Select all

0eNqtVduOmzAQ/ZVqns0qEAgBqfvSX+hbtUIGHLBqbNY2UaKIf+8Yct16s7tpn4zNzDnHZ2bgAKUYWK+5tJAfgFdKGsh/HcDwRlLhziTtGOQgrAwq1ZVcUqs0jAS4rNkO8nB8IcCk5ZazOXfa7As5dCXTGEDOGKyh1T4wVlPetDbARQCBXhlMVtKxIWAQZQT2uIbLcSR/wUUPw4U+uOWjcJkPLb6gqYYby6vAwUlEVX3AZT9YH+TqKTmCPiXoLFbBaiWKkrV0y9FtjKu4rgZuCyZpKVgNudUDI+djTKnPmBuujS0uJbT73knacm0H6u501DhHBFTubctlAzO1sdR1w8Jtup7qqd45PLvXg2FIJZQ2swCfB8ldD9Rg3zEh/dgEwyqXYm6fseUuvTj6JK3uSfJqOdXYr0MzWhcbrbpigjkVY9oUDrNn9ef9/wmoGdD2WQKA5wbpo22a+vxYk3fG+l5vpo+XhWBLCsv029P3jHGqOizPXCTBZGNbfPuKQXgNDJBKd1PCTYt+nw4G172Ru/WRKPqAiO7+gWh5RbT8JJH5GkV4RRHfp9DsdWAGnQ5sq5lplai/6FsYp/F6uYrTK9LkPmmv1ZbX/4XzxQ0wstFmaiZEr9x6YoB8Q4XBSTvf83xyIwRnqfp9JSdfL8gbfzwh3k9H9ujgJaP7MXLLOsy9/GVRBy0ZfhYg3AXP0e7bDyW3OBkOgcDpKU9WURZnWZKkYbJI1+P4B95imJg=[/code/
[code]
{
    "blueprint": {
        "icons": [
            {
                "signal": {
                    "name": "ltn-combinator"
                },
                "index": 1
            }
        ],
        "entities": [
            {
                "entity_number": 1,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -13
                }
            },
            {
                "entity_number": 2,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -11
                }
            },
            {
                "entity_number": 3,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -9
                }
            },
            {
                "entity_number": 4,
                "name": "logistic-train-stop-input",
                "position": {
                    "x": -26.5,
                    "y": -9.5
                },
                "control_behavior": {
                    "circuit_enabled": true,
                    "circuit_condition": {
                        "first_signal": {
                            "type": "virtual",
                            "name": "signal-anything"
                        },
                        "constant": 0,
                        "comparator": ">"
                    },
                    "use_colors": true
                }
            },
            {
                "entity_number": 5,
                "name": "logistic-train-stop-output",
                "position": {
                    "x": -27.5,
                    "y": -9.5
                },
                "control_behavior": {
                    "sections": {
                        "sections": [
                            {
                                "index": 1
                            }
                        ]
                    }
                }
            },
            {
                "entity_number": 6,
                "name": "logistic-train-stop",
                "position": {
                    "x": -27,
                    "y": -9
                },
                "control_behavior": {
                    "read_from_train": true,
                    "train_stopped_signal": {
                        "type": "virtual",
                        "name": "signal-T"
                    }
                },
                "station": ""
            },
            {
                "entity_number": 7,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -7
                }
            },
            {
                "entity_number": 8,
                "name": "ltn-combinator",
                "position": {
                    "x": -26.5,
                    "y": -7.5
                },
                "control_behavior": {
                    "sections": {
                        "sections": [
                            {
                                "index": 1,
                                "filters": [
                                    {
                                        "index": 1,
                                        "type": "virtual",
                                        "name": "ltn-min-train-length",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 2
                                    },
                                    {
                                        "index": 2,
                                        "type": "virtual",
                                        "name": "ltn-max-train-length",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 3
                                    },
                                    {
                                        "index": 3,
                                        "type": "virtual",
                                        "name": "ltn-max-trains",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 1
                                    },
                                    {
                                        "index": 4,
                                        "type": "virtual",
                                        "name": "ltn-requester-threshold",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 2147483647
                                    },
                                    {
                                        "index": 5,
                                        "type": "virtual",
                                        "name": "ltn-provider-threshold",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 2147483647
                                    }
                                ]
                            }
                        ]
                    }
                },
                "tags": {
                    "ltnc": {
                        "provider": false,
                        "requester": false,
                        "ltn-provider-stack-threshold": 80,
                        "ltn-requester-stack-threshold": 80
                    }
                }
            },
            {
                "entity_number": 9,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -5
                }
            }
        ],
        "item": "blueprint",
        "label": "1x->2x Conversion",
        "version": 562949955715078
    }
}
Pasting the 1.1 BP string into 2.x yields:

Code: Select all

0eNqtVdtuozAQ/ZXVPJsqJBACUvvSX9i3VYUMOGDV2NQ2UaKIf98x5LrrpG12n4zNzDnHZ2ZgD4XoWae5tJDtgZdKGsh+7cHwWlLhziRtGWQgrAxK1RZcUqs0DAS4rNgWsnB4I8Ck5ZazKXfc7HLZtwXTGEBOGKym5S4wVlNeNzbARQCBThlMVtKxIWAwTwnscA0Xw0D+gps/DBf64BaPwqU+tOiMpmpuLC8DBycRVXUBl11vfZDLp/gA+hSjs1gFq5XIC9bQDUe3Ma7kuuy5zZmkhWAVZFb3jJyOMaU6Ya65NjY/l9DuOidpw7XtqbvTQeMUEVC5sw2XNUzUxlLXDTO3aTuqx3pn8OJe94YhlVDaTAJ8HsR3PVC9vWFC8rkJhpUuxVw/Y8ude3HwSVrek+TVcqyxX4dmtMrXWrX5CHMsxrjJHWbHqq/7/xNQM6DtkwQAzw2SR9s08fmxIjfG+l5vJo+XhWBLCsv01SkO8i1jnKoWyzMVSTBZ2wbffmAQXgMDpNLtmHDVos/jQe+6d+5ufSBafEJEt/9AtLggir5IZL5HEV5QxPcpNPvomUGnA9toZholqm/6FkZJtFoso+SCNL1P2mm14dV/4XxzA4xstB6bCdFLtx4ZIFtTYXDSTvc8nVwJwVkq3y/kZKsZ+cMfT4j305E+Onjx4H6M3LIWc89/WdRBC4afBQi3wct8++NVyQ1OhkMgcHzK4uU8jdI0jpMwniWrYfgN7rqYoA==

Code: Select all

{
    "blueprint": {
        "icons": [
            {
                "signal": {
                    "name": "ltn-combinator"
                },
                "index": 1
            }
        ],
        "entities": [
            {
                "entity_number": 1,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -13
                }
            },
            {
                "entity_number": 2,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -11
                }
            },
            {
                "entity_number": 3,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -9
                }
            },
            {
                "entity_number": 4,
                "name": "logistic-train-stop-input",
                "position": {
                    "x": -26.5,
                    "y": -9.5
                },
                "control_behavior": {
                    "circuit_enabled": true,
                    "circuit_condition": {
                        "first_signal": {
                            "type": "virtual",
                            "name": "signal-anything"
                        },
                        "constant": 0,
                        "comparator": ">"
                    },
                    "use_colors": true
                }
            },
            {
                "entity_number": 5,
                "name": "logistic-train-stop-output",
                "position": {
                    "x": -27.5,
                    "y": -9.5
                },
                "control_behavior": {
                    "sections": {
                        "sections": [
                            {
                                "index": 1
                            }
                        ]
                    }
                }
            },
            {
                "entity_number": 6,
                "name": "logistic-train-stop",
                "position": {
                    "x": -27,
                    "y": -9
                },
                "control_behavior": {
                    "read_from_train": true,
                    "train_stopped_signal": {
                        "type": "virtual",
                        "name": "signal-T"
                    }
                },
                "station": ""
            },
            {
                "entity_number": 7,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -7
                }
            },
            {
                "entity_number": 8,
                "name": "ltn-combinator",
                "position": {
                    "x": -26.5,
                    "y": -7.5
                },
                "control_behavior": {
                    "sections": {
                        "sections": [
                            {
                                "index": 1,
                                "filters": [
                                    {
                                        "index": 2,
                                        "type": "virtual",
                                        "name": "ltn-min-train-length",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 2
                                    },
                                    {
                                        "index": 3,
                                        "type": "virtual",
                                        "name": "ltn-max-train-length",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 3
                                    },
                                    {
                                        "index": 4,
                                        "type": "virtual",
                                        "name": "ltn-max-trains",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 1
                                    },
                                    {
                                        "index": 5,
                                        "type": "virtual",
                                        "name": "ltn-requester-threshold",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 2147483647
                                    },
                                    {
                                        "index": 9,
                                        "type": "virtual",
                                        "name": "ltn-provider-threshold",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 2147483647
                                    }
                                ]
                            }
                        ]
                    }
                },
                "tags": {
                    "ltnc": {
                        "provider": false,
                        "requester": false,
                        "ltn-provider-stack-threshold": 80,
                        "ltn-requester-stack-threshold": 80
                    }
                }
            },
            {
                "entity_number": 9,
                "name": "legacy-straight-rail",
                "position": {
                    "x": -29,
                    "y": -5
                }
            }
        ],
        "item": "blueprint",
        "label": "1x->2x Conversion",
        "version": 562949955715078
    }
}
Rseding91
Factorio Staff
Factorio Staff
Posts: 15884
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.35] 1.1 BP converted during game load is converted differently than pasting via BP string

Post by Rseding91 »

Thanks for the report however this is working correctly. There are two different formats and are treated as such. The string is virtually always treated as “this exact definition” and once in game as an actual blueprint, migrations from that point in time apply to it.
If you want to get ahold of me I'm almost always on Discord.
kryojenik
Inserter
Inserter
Posts: 46
Joined: Fri Jun 26, 2020 8:18 pm
Contact:

Re: [2.0.35] 1.1 BP converted during game load is converted differently than pasting via BP string

Post by kryojenik »

I'm not sure I understand your response here, as it really doesn't apply to what I demonstrated.

Are you saying there are two different formats with in 2.0.35, or that 1.1.x and 2.x are two different formats? If it is the latter, yeah that's clear. What isn't clear is why 2.x generates two different blueprints (in 2.x format) from the same source blueprint depending on how it is presented to 2.x.

The source blueprint is

Code: Select all

                        {
                            "signal": {
                                "type": "virtual",
                                "name": "ltn-provider-threshold"
                            },
                            "count": 2147483647,
                            "index": 9                                  <======
                        }
Exporting that BP in 1.1 and importing it in 2.x results in the correct blueprint:

Code: Select all

                                    {
                                        "index": 9,                     <=====  
                                        "type": "virtual",
                                        "name": "ltn-provider-threshold",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 2147483647
                                    }
The problem is in migration of blueprint-storage.dat There the blueprint gets mangled to:

Code: Select all

                                    {
                                        "index": 5,                    <======
                                        "type": "virtual",
                                        "name": "ltn-provider-threshold",
                                        "quality": "normal",
                                        "comparator": "=",
                                        "count": 2147483647
                                    }
The two output formats are the same. The single source's content gets changed if you let the game migrate your blueprints instead of exporting them all first.
kryojenik
Inserter
Inserter
Posts: 46
Joined: Fri Jun 26, 2020 8:18 pm
Contact:

Re: [2.0.35] 1.1 BP converted during game load is converted differently than pasting via BP string

Post by kryojenik »

Look like a similar thing to viewtopic.php?p=662942#p662942 where LuaRecord::contents was being created as a compacted list without keys which resulted in LuaRecord::get_active_index() to point to non-existing keys in LuaRecord::contents.
Post Reply

Return to “Not a bug”