Import and Export blueprint strings automagically with this handy dandy blueprint API
npm install --save factorio-blueprint
And don't forget to install the blue print mod!
https://forums.factorio.com/viewtopic.php?t=13651
Array of names of entities. No more than four icons are allowed. If this array is empty when calling .luaString()
, two icons will be automatically generated.
List of all entities
Create an empty blueprint. Accepts an optional encoded blueprint string str
to be loaded in.
Loads encoded blueprint string str
. Returns self.
Outputs fancy format with all the entities.
Created an entity of type name
at position
(top-left corner) facing direction
.
- Use
allowOverlap
to ignore two entities overlapping (which Factorio does not like...) - Use
noPlace
if you want the entity to be created but not placed (mainly used in .load()) - Use
center
if you wantposition
to refer to the center of the entity (again, mainly used by .load())
Returns the new entity
Return entity that overlaps position
or null.
Removes entity
, returns it (or false if it was not removed)
Removes an entity given the position
, returns the entity (or false if it was not removed)
Initialize the IDs on each item. They default to -1, but this is called automatically for things like .toString() and .encode(). Returns self.
Centers all entities on the blueprint. I recommend calling this before Blueprint.encode()
. Returns self.
Get position that is the center of all entities
Get top-left-most entity's corner position
Get top-right-most entity's corner position
Get bottom-left-most entity's corner position
Get bottom-right-most entity's corner position
Generate icons based off the entities, num
is the number of icons from 1 to 4. Returns self.
The lua string that is encoded
Get the encoded blue print string
Pass it extra items in the data
object if you need custom entities (such as from mods or entities that aren't included).
Use the same format as defaultentities.js
Get a list of all entities added to be supported by factorio-blueprint.
Position in bp.entities
when bp.setIds()
is called.
Get the entity's blueprint parent
Number from 1 to 8. For most things it's 0, 2, 4, or 6
List of wire connections with other entities
Condition if the entity is a combinator
Object of filters. Keys are the positions (1 to X). Used for constant combinators and storage containers.
x/y contain the width/height
Fancy display for data about the entity
Removes self from blueprint
Gets position of respective relative location. entity.topLeft()
simply returns a clone of the entity's position.
Connect with wire entity
's fromSide
to toEntity
's toSide
with wire color
(red or green). Returns self.
Remove wire connection (if it exists). Returns self.
Removes all wire connections with toEntity
. color
is optional. Returns self.
Remove all wires connections. Returns self.
Sets filter at position
with amount
of item
(an entity name). Returns self.
Returns self.
Sets logistics request filter at position
with amount
of item
(an entity name). Returns self.
Returns self.
opt
contains the following data:
- left: Number (constant) or String (item/entity name)
- right: Number (constant) or String (item/entity name)
- operator: If arithmetic, +-*/, if decider, <>=
- countFromInput: For decider combinator, should output count from input (or be one). Default is false
- out: String (item/entity name)