Talk:Blueprint string format: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(stock_connections info)
m (link fix)
 
Line 5: Line 5:
== v2.x introduced new "wires" array of uncertain structure ==
== v2.x introduced new "wires" array of uncertain structure ==


My [FaTul tool](https://github.com/nyurik/fatul) minimizes versioned blueprint storage in git by making all IDs relative - e.g. connected to (-1,0) instead of a long entity number. Wires used to work in 1.x, but now I am observing a new "wires" blueprint root entry - this is an example of two electric poles connected by copper, red, and green wires. The format of the "wires" seem to be a list of connections, with each sub-array always having 4 numbers:
My [https://github.com/nyurik/fatul FaTul tool] minimizes versioned blueprint storage in git by making all IDs relative - e.g. connected to (-1,0) instead of a long entity number. Wires used to work in 1.x, but now I am observing a new "wires" blueprint root entry - this is an example of two electric poles connected by copper, red, and green wires. The format of the "wires" seem to be a list of connections, with each sub-array always having 4 numbers:


* source entity_number
* source entity_number
Line 51: Line 51:
== v2.x introduced new "stock_connections" array for trains(?) ==
== v2.x introduced new "stock_connections" array for trains(?) ==


Similar to above, for my [FaTul](https://github.com/nyurik/fatul) blueprint GIT management tool, I am seeing a new <code>stock_connections</code> top level property for connections entities like trains. If my entities represent a train with 4 cargo wagons (entities 1-4) and two locomotives (entities 5 and 6), this represents their connectivity LCCCCL:
Similar to above, for my [https://github.com/nyurik/fatul FaTul] blueprint GIT management tool, I am seeing a new <code>stock_connections</code> top level property for connections entities like trains. If my entities represent a train with 4 cargo wagons (entities 1-4) and two locomotives (entities 5 and 6), this represents their connectivity LCCCCL:


     "stock_connections": [
     "stock_connections": [

Latest revision as of 03:25, 28 October 2024

Decode snippets

Since there are some short snippets to decode blueprint strings to JSON / Lua tables I think it would make sense to also have snippets for the inverse operation. -- fgardt (talk) 03:35, 3 August 2024 (CEST)

v2.x introduced new "wires" array of uncertain structure

My FaTul tool minimizes versioned blueprint storage in git by making all IDs relative - e.g. connected to (-1,0) instead of a long entity number. Wires used to work in 1.x, but now I am observing a new "wires" blueprint root entry - this is an example of two electric poles connected by copper, red, and green wires. The format of the "wires" seem to be a list of connections, with each sub-array always having 4 numbers:

  • source entity_number
  • color of the wire at the source
  • destination entity_number
  • color of the wire at the destination

I guess the developers were trying to allow color-changing in the wire, e.g. starts as green, but ends as red? For now, I only saw same color on both sides (2nd and 4th value is always the same). The color indexes are: 5 - copper, 1 - red, 2 - green.

{
 "blueprint": {
   "icons": [{"signal": {"name": "big-electric-pole"}, "index": 1}],
   "entities": [
     {"entity_number": 1, "name": "big-electric-pole", "position": {"x": 163, "y": -240}},
     {"entity_number": 2, "name": "big-electric-pole", "position": {"x": 195, "y": -240}}
   ],
   "wires": [[1, 1, 2, 1], [1, 2, 2, 2], [1, 5, 2, 5]],
   "item": "blueprint",
   "version": 562949954076673
 }
}

v2.X SignalID has optional "type" now

Blueprint:

0eNqVkd1uhCAQhd9lrnGzWm2ir9JsDOLEnRQGC2hrDO9e0Dbbqza9Y5hzvvnbYdALzo44QLcDKcseupcdPE0sdf5jaRA6kN6jGTTxVBip7sRYVBAFEI/4AV0ZbwKQAwXCk3AEW8+LGdAlgfiVJGC2Ppkt55oZeL00Ajboni5NKuNQ0Zzd5CwXE0pXvN8RNXyn+rdF6lQwSdg6I3OGApqzGRp/jDI7Oy4q0JrkhUlvjcckpzqJuSdeU//Wbaf7EdUCfJDq9Zg4RvE3+mtN/4NfM/yWd5qNCfw4k4AVnT8W1TxXbd22TV3WVVWWMX4CClCeDw==

Beginning of JSON:

   {
       "blueprint": {
           "icons": [
               {
                   "signal": {
                       "name": "assembling-machine-2"
                   },
                   "index": 1
               }
           ],

Notice there is no "type": "item" property.

v2.x introduced new "stock_connections" array for trains(?)

Similar to above, for my FaTul blueprint GIT management tool, I am seeing a new stock_connections top level property for connections entities like trains. If my entities represent a train with 4 cargo wagons (entities 1-4) and two locomotives (entities 5 and 6), this represents their connectivity LCCCCL:

   "stock_connections": [
     {"back": 1, "stock": 5},
     {"back": 2, "front": 5, "stock": 1},
     {"back": 3, "front": 1, "stock": 2},
     {"back": 4, "front": 2, "stock": 3},
     {"back": 6, "front": 3, "stock": 4},
     {"front": 4, "stock": 6}
   ]