Page 1 of 1

[Rseding91] [2.0.15] "Unknown entity name: <null>" error importing blueprint of turret with gaps in target priority list

Posted: Thu Nov 07, 2024 12:47 am
by jeff.s
Steps to reproduce:

1. Place a turret, and configure it with 3 target priorities
11-06-2024, 19-43-32.png
11-06-2024, 19-43-32.png (82.56 KiB) Viewed 598 times


2. Right click the middle target priority to remove it, leaving a gap
11-06-2024, 19-43-57.png
11-06-2024, 19-43-57.png (27.63 KiB) Viewed 598 times


3. Take a blueprint of the turret, and export the blueprint string

Code: Select all

0eNptj9sKg0AMRP9lnlfoZRVdSn9EpGi7SGCNspdSEf+90Rb60rdJyJyZLOhcspMnjjAL6D5ygKkXBOq5dduO28HCoE+cxeS9jVgViB/2BXNcGwXLkSLZj28f5hunobNeDtQfv8I0BrGMvPEFUyrMMFkpYKkyeiFkjoJUqhGG1rmsoyg4hQsn564iOuq/y2brIGqQkN8zCk/rwx6RF6dKV1Wu9UGf82Jd31NHUZU=
4. Import this blueprint string.

You will see:
- "Error while importing string:" flying text next to cursor (no second line or more detail)
- "Unknown entity name: <null>" in the console
- The blueprint was not imported
11-06-2024, 19-45-15.png
11-06-2024, 19-45-15.png (125.09 KiB) Viewed 598 times


Decoding this blueprint to JSON the issue is clearly evident:

Code: Select all

{
  "blueprint": {
    "icons": [
      {
        "signal": {
          "name": "gun-turret"
        },
        "index": 1
      }
    ],
    "entities": [
      {
        "entity_number": 1,
        "name": "gun-turret",
        "position": {
          "x": 8,
          "y": -8
        },
        "priority-list": [
          "small-biter",
          "<null>",
          "big-biter"
        ]
      }
    ],
    "item": "blueprint",
    "version": 562949954404356
  }
}

Re: [2.0.15] "Unknown entity name: <null>" error importing blueprint of turret with one or more gaps in target priority

Posted: Thu Nov 07, 2024 8:33 pm
by paulstelian97
I've made a few attempts to find something else to put instead of that "<null>" and it seems like I cannot find an alternative. Nice find! At least the fix is simple (or should be simple), there must be added a name that can be a valid placeholder for empty slots in the serialization/deserialization.

Perhaps even the one the serializer is already doing, the "<null>"!

Re: [2.0.15] "Unknown entity name: <null>" error importing blueprint of turret with one or more gaps in target priority

Posted: Sat Nov 09, 2024 12:55 am
by jeff.s
> Perhaps even the one the serializer is already doing, the "<null>"

It would for sure be the most compatible for anybody who already made a blueprint in this way unknowingly

Re: [2.0.15] "Unknown entity name: <null>" error importing blueprint of turret with one or more gaps in target priority

Posted: Sat Nov 09, 2024 2:28 am
by Rseding91
Thanks for the report. This is now fixed for the next release.