Advertisement
MinoCraft72

Armor Switcher [Mc 1.8.9]

Nov 13th, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.62 KB | None | 0 0
  1. --Swith Armor V.1.0
  2.  
  3. -- Config:
  4.  
  5.   rsArmor_1 = "left"
  6.   rsArmor_2 = "right"
  7.   bundSide = "back"
  8.   extColor = colors.white
  9.   insColor = colors.orange
  10.   colorArmor_1 = colors.magenta
  11.   colorArmor_2 = colors.lightBlue
  12.   modemSide = "bottom"
  13.   remoteID = 69
  14.  
  15. -- Prog:
  16. rednet.open(modemSide)
  17.  
  18. while true do
  19.  rs.setBundledOutput(bundSide,0)
  20.  event,senderID,message,dist = os.pullEvent("rednet_message")
  21.   if senderID == remoteID then
  22.     if message == "change armor" then
  23.      print(message)
  24.      equipArmor = true
  25.     --else
  26.      --equipArmor = false
  27.     end
  28.   end  
  29.   if equipArmor then
  30.    print(tostring(equipArmor))
  31.     if rs.getAnalogInput(rsArmor_1) > 0 then
  32.      print(tostring(rs.getAnalogInput(rsArmor_1)))
  33.      extArmor = true
  34.       while extArmor do
  35.        sleep(1)
  36.        term.setCursorPos(1,8)
  37.        term.clearLine()
  38.        print("extract player armor 2")
  39.         if rs.getAnalogInput(rsArmor_2) < 4 then
  40.          rs.setBundledOutput(bundSide, extColor)
  41.         else
  42.          rs.setAnalogOutput(bundSide,0)
  43.          extArmor = false
  44.          insArmor = true
  45.          sleep(1)
  46.         end
  47.       end
  48.       while insArmor do
  49.        sleep(1)
  50.         if rs.getAnalogInput(rsArmor_1) > 0 then
  51.          term.setCursorPos(1,8)
  52.          term.clearLine()
  53.          print("insert armor 1 on player")
  54.          color = insColor + colorArmor_1
  55.          rs.setBundledOutput(bundSide,color)
  56.          sleep(4)
  57.         else
  58.          rs.setBundledOutput(bundSide,0)
  59.          insArmor = false
  60.          sleep(1)
  61.         end
  62.       end
  63.      equipArmor = false
  64.      sleep(1)
  65.     end
  66.   end
  67.      if equipArmor then
  68.        if rs.getAnalogInput(rsArmor_2) > 0 then
  69.      print(tostring(rs.getAnalogInput(rsArmor_2)))
  70.      extArmor = true
  71.       while extArmor do
  72.        sleep(1)
  73.        term.setCursorPos(1,8)
  74.        term.clearLine()
  75.        print("extract player armor 1")
  76.         if rs.getAnalogInput(rsArmor_1) < 4 then
  77.          rs.setBundledOutput(bundSide, extColor)
  78.         else
  79.          rs.setAnalogOutput(bundSide,0)
  80.          extArmor = false
  81.          insArmor = true
  82.          sleep(1)
  83.         end
  84.       end
  85.       while insArmor do
  86.        sleep(1)
  87.         if rs.getAnalogInput(rsArmor_2) > 0 then
  88.          term.setCursorPos(1,8)
  89.          term.clearLine()
  90.          print("insert armor 2 on player")
  91.          color = insColor + colorArmor_2
  92.          rs.setBundledOutput(bundSide,color)
  93.          sleep(4)
  94.         else
  95.          rs.setBundledOutput(bundSide,0)
  96.          insArmor = false
  97.          sleep(1)
  98.         end
  99.       end
  100.      equipArmor = false
  101.      sleep(1)
  102.     end  
  103.   end
  104. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement