Talk:Blueprint string format: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(decode snippets)
 
Line 2: Line 2:


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. -- [[User:Fgardt|fgardt]] ([[User talk:Fgardt|talk]]) 03:35, 3 August 2024 (CEST)
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. -- [[User:Fgardt|fgardt]] ([[User talk:Fgardt|talk]]) 03:35, 3 August 2024 (CEST)
== v2.x introduced new "wires" array of uncertain structure ==
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
  }
}

Revision as of 01:24, 25 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

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
 }
}