Advertisement
Yazzou

Galacticraft

May 15th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. ---- SCRIPT GALACTICRAFT AUTOCRAFT ----
  2. ---- By Yazzou ----
  3.  
  4. local component = require("component")
  5. local sides = require("sides")
  6.  
  7. local ic = component.proxy(component.get("bb78"))
  8.  
  9. local function print_table(table)
  10.     if table then
  11.         for k,v in pairs(table) do
  12.             print(k,v)
  13.         end
  14.     else
  15.         print("print_table :", "Table vide")
  16.     end
  17. end
  18.  
  19. local function print_inventory(comp, side)
  20.     if (comp) then
  21.         for i = 1,comp.getInventorySize(side),1 do
  22.             local item = comp.getStackInSlot(side, i)
  23.             if item then
  24.                 print("#"..i, item.label, "x "..item.size)
  25.             else
  26.                 print("#"..i, "empty")
  27.             end
  28.         end
  29.     else
  30.         print("print_table", "Composant null")
  31.     end
  32. end
  33.  
  34. ---- MAIN PROGRAM ----
  35.  
  36. print("Inventaire Nord")
  37. print_inventory(ic, sides.north)
  38. print("\nInventaire Ouest")
  39. print_inventory(ic, sides.west)
  40.  
  41. ic.suckFromSlot(sides.west, 1, 1)
  42. ic.dropIntoSlot(sides.north, 2, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement