Page 1 of 1

uncompressed blueprint string

Posted: Thu Nov 14, 2019 11:56 am
by ichVII
In addition to the import_stack and export_stack features, I would like to have an option to use similiar features with the uncompressed blueprint string. While set/get_blueprint_entities/tiles/entity_tags are great, it would be nice to have one combined access to all information.

I tried to inflate a string in lua, but I only found ways, that require specific libraries, which I propably cant or shouldnt include in a mod.

Alternatively adding game.inflate and game.deflate to inflate/deflate strings would solve my problem as well.

I am trying to change the colour of a coloured blueprint and if i could get access to the uncompressed blueprint string, it would be as easy as replacing the name of the blueprint in the uncompressed string. (at the end in item: …).

Re: uncompressed blueprint string

Posted: Wed Nov 20, 2019 1:48 am
by eradicator
+1 for zip/deflate support

Would be handy to generate custom "exchange strings" too (for modded stuff other than blueprints).

Re: uncompressed blueprint string

Posted: Wed Nov 20, 2019 3:22 am
by DaveMcW
As a workaround, you can include the zip library yourself. https://github.com/DaveMcW/blueprint-st ... rintstring

Re: uncompressed blueprint string

Posted: Wed Feb 05, 2020 3:33 pm
by raiguard
+1. Having inflate / deflate and base64 encode/decode available to be used anywhere, not just for blueprints, would be amazing.

Re: uncompressed blueprint string

Posted: Mon Feb 17, 2020 9:58 pm
by Therenas
Raiguard wrote: Wed Feb 05, 2020 3:33 pm +1. Having inflate / deflate and base64 encode/decode available to be used anywhere, not just for blueprints, would be amazing.
Isn't base64 en- and decode already available in the core lualib util file?

Re: uncompressed blueprint string

Posted: Mon Feb 17, 2020 10:29 pm
by raiguard
Well yes, but not zlib inflate and deflate.

Re: uncompressed blueprint string

Posted: Tue Feb 18, 2020 3:35 pm
by raiguard
This was added, so this topic can be moved now.

Re: uncompressed blueprint string

Posted: Tue Feb 18, 2020 4:08 pm
by eradicator
Raiguard wrote: Tue Feb 18, 2020 3:35 pm This was added, so this topic can be moved now.
Had to search a bit until i found what you mean so i'll post it here for future readers:

Code: Select all

LuaGameScript.encode_string(string) → string	Deflates and base64 encodes the given string.
LuaGameScript.decode_string(string) → string	Base64 decodes and inflates the given string.
As far as i know "blueprint exchange string" has some factorio specific decorations (version byte?). So i'm wondering if that needs to be manually handled?

Re: uncompressed blueprint string

Posted: Tue Feb 18, 2020 4:44 pm
by raiguard
Yes, the Factorio blueprint strings have a single digit at the beginning denoting a version. Remove the first character of a compressed blueprint string and it'll work with the new functions.