Importing a Blueprint from string?

Place to get help with not working mods / modding interface.
ElGaucho
Burner Inserter
Burner Inserter
Posts: 19
Joined: Mon Mar 27, 2017 9:27 pm
Contact:

Importing a Blueprint from string?

Post by ElGaucho »

So, the new update added the very cool feature to export and import a blueprint as a string / from a string. Is there anyway to call these fuctionalities from a lua script? Especially importing a blueprint from a string would be awesome.

E.g. this one

Code: Select all

0eNqd0dsKgzAMBuB3+a8rqOu86KuMMTxko6BR2mxMpO8+D7vYQQbzMk36hSQDivpKnbMsMANs2bKHOQzw9sJ5Pb1J3xEMrFADBc6bKTrnXiJxOfuudRIVVAuCguWK7jBJOCoQixVLCzcH/YmvTUFuLPgJKXStH/+2PPUfvWis72HiENQXlf5HxU9JobKOyiWTrbi7LW6UvMN6BdabZv+U02nF803MywkVbuT8MpPWqc50vE/SEB6lJqOt
creates a circle made out of red belts. How can i now import that via a lua script
gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Re: Importing a Blueprint from string?

Post by gheift »

Basic concept:
  • remove the leading "0", it is a some kind of version
  • decode the base64 string
  • decompress the result, which is zlib compressed ([1] may be helpful)
  • parse the json and do stuff with it
Kind regards, Gerhard

[1] https://unix.stackexchange.com/question ... ta-in-unix
ElGaucho
Burner Inserter
Burner Inserter
Posts: 19
Joined: Mon Mar 27, 2017 9:27 pm
Contact:

Re: Importing a Blueprint from string?

Post by ElGaucho »

I got the basic concept, but i thought there would be an easier way to use them with a build in function from factorio api ?
mophydeen
Filter Inserter
Filter Inserter
Posts: 529
Joined: Sun Nov 22, 2015 5:02 pm
Contact:

Re: Importing a Blueprint from string?

Post by mophydeen »

I'd like an easy api way.

eg. add a blueprint book to the "game blueprints"-frame in script.

Code: Select all

game.blueprints.add("somestring")
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Importing a Blueprint from string?

Post by daniel34 »

I had this already moved to Modding interface requests, but I see you already created a new topic: viewtopic.php?f=28&t=45704
quick links: log file | graphical issues | wiki
Post Reply

Return to “Modding help”