Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. local component = require("component")
  2.  
  3. stor = component.proxy(component.get("526"))
  4.  
  5. items = {
  6. {label="Lapis Lazuli",max_quantity=300,min_quantity=100,name="dye",damage=4,block_name="lapis_block",block_damage=0,block_size=9},
  7. {label="Tin Ingot",max_quantity=300,min_quantity=100,name="thermalfoundation:material",damage=129,block_name="thermalfoundation:storage",block_damage=1,block_size=9},
  8. {label="Coal",max_quantity=500,min_quantity=300,name="coal",damage=0,block_name="coal_block",block_damage=0,block_size=9},
  9. {label="Redstone",max_quantity=1000,min_quantity=700,name="redstone",damage=0,block_name="redstone_block",block_damage=0,block_size=9},
  10. {label="Lead Ingot",max_quantity=300,min_quantity=100,name="thermalfoundation:material",damage=131,block_name="thermalfoundation:storage",block_damage=3,block_size=9},
  11. {label="Silver Ingot",max_quantity=300,min_quantity=100,name="thermalfoundation:material",damage=130,block_name="thermalfoundation:storage",block_damage=2,block_size=9},
  12. {label="Aluminum Ingot",max_quantity=300,min_quantity=100,name="thermalfoundation:material",damage=132,block_name="thermalfoundation:storage",block_damage=4,block_size=9},
  13. {label="Iron Ingot",max_quantity=1000,min_quantity=700,name="iron_ingot",damage=0,block_name="iron_block",block_damage=0,block_size=9},
  14. {label="Copper Ingot",max_quantity=300,min_quantity=100,name="thermalfoundation:material",damage=128,block_name="thermalfoundation:storage",block_damage=0,block_size=9},
  15. {label="Gold Ingot",max_quantity=300,min_quantity=100,name="gold_ingot",damage=0,block_name="gold_block",block_damage=0,block_size=9}
  16. }
  17.  
  18. for i,item in ipairs(items) do
  19. stack = {name=item.name,damage=item.damage}
  20.  
  21. quantityInStorage = stor.getItem(stack).quantity
  22. if quantityInStorage > item.max_quantity then
  23. print(quantityInStorage - item.max_quantity,item.label,"to block")
  24. if (#stor.getTasks() == 0) then
  25. if item.block_size = 0 then
  26. print("Error: Spezify block size for item",item.name)
  27. else
  28. toCraft = math.floor((quantityInStorage - item.max_quantity) / item.block_size + 1)
  29. print("Blocking:",toCraft * 9,item.label)
  30. stor.scheduleTask({name=item.block_name},toCraft)
  31. end
  32. end
  33. end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement