Advertisement
Arc13

guardapi

Jun 21st, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. local function isRednetAvailable()
  2.   result = false
  3.  
  4.   for n,m in ipairs(rs.getSides()) do
  5.    if rednet.isOpen(m) then
  6.      result = true
  7.    end
  8.  end
  9.  
  10.    return result
  11. end
  12.  
  13. function getShard(itemCount)
  14.   if not isRednetAvailable() then
  15.     error("Rednet is not available !")
  16.   end
  17.  
  18.   if not itemCount or itemCount > 64 or itemCount < 0 or type(itemCount) ~= "number" then
  19.     error("First argument must be an integer between 0 and 64")
  20.   end
  21.  
  22.   rednet.send(3955, itemCount)
  23. end
  24.  
  25. function getCrystal(itemCount)
  26.   if not isRednetAvailable() then
  27.     error("Rednet is not available !")
  28.   end
  29.  
  30.   if not itemCount or itemCount > 64 or itemCount < 0 or type(itemCount) ~= "number" then
  31.     error("First argument must be an integer between 0 and 64")
  32.   end
  33.  
  34.   rednet.send(3953, itemCount)
  35. end
  36.  
  37. function getPearl(itemCount)
  38.   if not isRednetAvailable() then
  39.     error("Rednet is not available !")
  40.   end
  41.  
  42.   if not itemCount or itemCount > 16 or itemCount < 0 or type(itemCount) ~= "number" then
  43.     error("First argument must be an integer between 0 and 16")
  44.   end
  45.  
  46.   rednet.send(3978, itemCount)
  47. end
  48.  
  49. function getFish(itemCount)
  50.   if not isRednetAvailable() then
  51.     error("Rednet is not available !")
  52.   end
  53.  
  54.   if not itemCount or itemCount > 64 or itemCount < 0 or type(itemCount) ~= "number" then
  55.     error("First argument must be an integer between 0 and 64")
  56.   end
  57.  
  58.   rednet.send(3954, itemCount)
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement