DPG-mattcow12

Mattcow12's Bee api

Jun 26th, 2013
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. local b = peripheral.wrap("bottom")
  2. function getSpeed()
  3. t = b.analyze()
  4. speed = t["speed"]
  5.   if speed >= 1.7 then return "Fastest"
  6.   elseif speed >= 1.4 then return "Faster"
  7.   elseif speed >= 1.2 then return "Fast"
  8.   elseif speed >= 1.0 then return "Normal"
  9.   elseif speed >= 0.8 then return "Slow"
  10.   elseif speed >= 0.6 then return "Slower"
  11.   else return "Slowest" end
  12. end
  13.  
  14. function getLifespan()
  15. t = b.analyze()
  16. lifespan = t["lifespan"]
  17.   if lifespan >= 70 then return "Longest"
  18.   elseif lifespan >= 60 then return "Longer"
  19.   elseif lifespan >= 50 then return "Long"
  20.   elseif lifespan >= 45 then return "Elongated"
  21.   elseif lifespan >= 40 then return "Normal"
  22.   elseif lifespan >= 35 then return "Shortened"
  23.   elseif lifespan >= 30 then return "Short"
  24.   elseif lifespan >= 20 then return "Shorter"
  25.   else return "Shortest" end
  26. end
  27.  
  28. function getPrimarySpecies()
  29.     t = b.analyze()
  30.     return t["speciesPrimary"]
  31. end
  32.  
  33. function getSecondarySpecies()
  34.     t = b.analyze()
  35.     return t["speciesSecondary"]
  36. end
  37.  
  38. function getType()
  39.     t = b.analyze()
  40.     return t["type"]
  41. end
  42.  
  43. function getTemperature()
  44.     t = b.analyze()
  45.     return t["temperature"]
  46. end
  47.  
  48. function getTemperatureTolerance()
  49.     t = b.analyze()
  50.     return t["toleranceTemperature"]
  51. end
  52.  
  53. function getHumidity()
  54.     t = b.analyze()
  55.     return t["humidity"]
  56. end
  57.  
  58. function getHumidityTolerance()
  59.     t = b.analyze()
  60.     return t["toleranceHumidity"]
  61. end
  62.  
  63. function getFlower()
  64.     t = b.analyze()
  65.     return t["flower"]
  66. end
  67.  
  68. function getEffect()
  69.     t = b.analyze()
  70.     return t["effect"]
  71. end
  72.  
  73. -- territories X Y Z
  74.  
  75. function getTerritoryX()
  76.     t = b.analyze()
  77.     return t["territory"][1]
  78. end
  79.  
  80. function getTerritoryY()
  81.     t = b.analyze()
  82.     return t["territory"][2]
  83. end
  84.  
  85. function getTerritoryZ()
  86.     t = b.analyze()
  87.     return t["territory"][3]
  88. end
  89.  
  90.  
  91. function getFertility()
  92.     t = b.analyze()
  93.     return t["fertility"]
  94. end
  95.  
  96. -- bool factors
  97.  
  98. function isNocturnal()
  99.     t = b.analyze()
  100.     return t["nocturnal"]
  101. end
  102.  
  103. function isFlyer()
  104.     t = b.analyze()
  105.     return t["tolerantFlyer"]
  106. end
  107.  
  108. function isCaveDwelling()
  109.     t = b.analyze()
  110.     return t["caveDwelling"]
  111. end
  112.  
  113.  
  114.  
  115. -- useful functions:
  116.  
  117. function isPure()
  118.     if getPrimarySpecies() == getSecondarySpecies() then
  119.         return true
  120.     else return false end
  121. end
  122.  
  123. function isAnalyzedBee()
  124.     t = b.analyze()
  125.     if t ~= nil then return true
  126.     else return false end
  127. end
Advertisement
Add Comment
Please, Sign In to add comment