Advertisement
karelvysinka

item_logistic_pipes

Dec 12th, 2024 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | Gaming | 0 0
  1. -- Funkce pro hledání všech periferíí a kontrolu, zda je to Logistics Pipe
  2. local function findLogisticsPipe()
  3.     local sides = {"top", "bottom", "left", "right", "front", "back"} -- Strany pro modem
  4.     for _, side in ipairs(sides) do
  5.         if peripheral.isPresent(side) then
  6.             local peripheralType = peripheral.getType(side)
  7.             print("Nalezena periferie na straně: " .. side .. " (" .. peripheralType .. ")")
  8.            
  9.             -- Zkontrolujeme, zda typ obsahuje "LogisticsPipes"
  10.             if peripheralType:find("LogisticsPipes") then
  11.                 print("Nalezena Logistics Pipe na straně: " .. side)
  12.                 return peripheral.wrap(side) -- Vrátí odkaz na periferii
  13.             end
  14.         end
  15.     end
  16.     return nil -- Nenalezena žádná Logistics Pipe
  17. end
  18.  
  19. -- Hlavní program
  20. local lp = findLogisticsPipe()
  21.  
  22. if lp then
  23.     print("Úspěšně nalezena Logistics Pipe!")
  24. else
  25.     print("Nenalezena žádná Logistics Pipe. Zkontrolujte připojení!")
  26. end
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement