Skip to content

Instantly share code, notes, and snippets.

@rpdelaney
Created August 14, 2022 21:47
Show Gist options
  • Save rpdelaney/aa88694d5f275fb842b859d485b2557d to your computer and use it in GitHub Desktop.
Save rpdelaney/aa88694d5f275fb842b859d485b2557d to your computer and use it in GitHub Desktop.
Create a Factorio blueprint with a logistic assembler for a rocket silo.
"""Create a Factorio blueprint with a logistic assembler for a rocket silo.
This assembler directly requests the ingredients for a rocket silo,
without the use of a requester chest.
Many thanks to redruin1 for factorio-draftsman:
https://github.com/redruin1/factorio-draftsman
This script licensed under the public domain.
0eNp9kN1qwzAMhd9F13bJT0vWvMooI3FFKubYxnLCSvC7Vy5jy0W3K9kHnU862mC0C4ZILkG/ASWcod9pClaMTN5B37zVx+7cdKdz20lVgC5RImTo3zdww4ziHJhxHi25Sc+DuZFD3QgkeJbWQtngC/r6cFJwf9asIKKhUMzRm09Mmsl68ZRduBiC6MhcmIsj2bOpKgXGOxMxia+uyh8tmhTJaHRTGbtr5YRodbDDb3d4TpR3/s5x/3DLPGIUMaufOOQYYxL1zwjt4QWi2SGsn4iT7GVuyEkHuRCtqCXUStf/yMdX5DZfcn4ArK2PXw==
"""
from draftsman.entity import (
AssemblingMachine,
Inserter,
LogisticPassiveContainer,
)
from draftsman.blueprintable import Blueprint
SILO = {
"name": "rocket-silo",
"ingredients": {
"processing-unit": 200,
"concrete": 1000,
"electric-engine-unit": 200,
"steel-plate": 1000,
"pipe": 100,
}
}
def main():
new_bp = Blueprint()
# add the assembler with ingredient requests
assembler = AssemblingMachine(name="assembling-machine-2")
assembler.recipe = SILO.get("name")
assembler.items = SILO.get("ingredients")
new_bp.entities.append(assembler)
# add an inserter to unload from the assembler
inserter = Inserter(name="inserter", position=(1.5, 3))
new_bp.entities.append(inserter)
# add a red crate to unload into
provider_chest = LogisticPassiveContainer(position=(1.5, 4))
new_bp.entities.append(provider_chest)
# print the result
print(new_bp.to_string(), end="")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment