Blueprint Library


A utility library for manipulating Factorio blueprints.

Internal
2 months ago
2.0
16
Blueprints
Owner:
The_LORD_thy_GOD
Source:
https://github.com/project-cybersyn/bplib
Homepage:
https://github.com/project-cybersyn/bplib
License:
MIT
Created:
2 months ago
Latest Version:
1.1.0 (2 months ago)
Factorio version:
2.0
Downloaded by:
16 users

Blueprint Library

bplib is a set of tools for use by other Factorio mods that need to manipulate blueprints.

Its primary purpose is to address the following pain points for developers working with custom entities that need advanced interaction with blueprints:

  • Abstracting over blueprints within or without books, in the library, in the inventory, etc. and treating them in a unified fashion.

  • Correctly identifying and updating pre-existing entities in the world when an overlapping blueprint is stamped down.

  • Correctly extracting blueprint tags from world entities into blueprints, including when blueprints are updated via "select new contents."

  • Doing all of the above while supporting absolute and relative snapping, offsets, books, libraries, the kitchen sink, etc.

Contributing

Please use the GitHub repository for questions, bug reports, or pull requests.

Usage

Read the example code here!

You can import the primary API of bplib by using require("__bplib__.blueprint").

bplib is self-documenting, via LuaLS type annotations and comments. We recommend installing the Factorio modding toolkit and setting it up with the Sumneko Lua language server. Adding bplib to the LuaLS library list will give you code completion and in-editor documentation.