kd8lvt

Healing Pod ComputerCraft 1.7

Apr 16th, 2015
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.71 KB | None | 0 0
  1. --Instructions:
  2.     --1. Create a 5x5 (on the inside) pod. (Filled with water)
  3.     --2. Put a Command Computer in the middle block in the floor.
  4.     --3. Do "pastebin get F3gqLfPf startup" without quotes to get the program.
  5.     --4. Put a leather cap in your inventory (not on your head)
  6.     --5. Walk into the pod, and wait to be healed!
  7. --IMPORTANT INFORMATION!
  8.     --Make sure you don't edit ANYTHING except for the configuration! If you do, things may break!
  9.     --Be warned, it only checks once for lava, or water, you have to reboot the program if you want to change it.
  10. -------------------------------------------------------------------------
  11. --Configuration!
  12. --Make sure to spell "false" right! (No quotes, of course!)
  13.   --Negative Effects
  14.       slowActive = true
  15.       miningFatigueActive = true
  16.       nauseaActive = true
  17.       witherActive = true
  18.   --Positive Effects
  19.       resistanceActive = true
  20.       hasteActive = true
  21.       strengthActive = true
  22.       foodActive = true
  23.       extraHealthActive = true
  24.   --Other Options
  25.       verbose = true --This just puts in the console the player who is being healed / damaged.
  26. --End of Configuration
  27. -------------------------------------------------------------------------
  28. --Functions
  29. function heal()
  30.   if commands.exec("clear @p [r=2] leather_helmet 0 0") then
  31.     if !lavaNotWater then
  32.       commands.exec("effect @p [r=2] 13 1 1") --Water Breathing KEEP THIS! Otherwise you will drown!
  33.     else
  34.       commands.exec("effect @p [r=2] 12 1 1") --Fire Resistance KEEP THIS TOO!
  35.     end
  36.     commands.exec("effect @p [r=2] 10 1 255") -- Regeneration (Duh keep this :P)
  37.     if resistanceActive then
  38.       commands.exec("effect @p [r=2] 11 30 3")  --Resistance Effect (Configurable!)
  39.     end
  40.     if hasteActive then
  41.       commands.exec("effect @p [r=2] 3 30 15")  --Haste Effect (Configurable!)
  42.     end
  43.     if strengthActive then
  44.       commands.exec("effect @p [r=2] 5 30 15")  --Strength Effect (Configurable!)
  45.     end
  46.     if foodActive then
  47.       commands.exec("effect @p [r=2] 23 30 255")  --Saturation Effect (Configurable!)
  48.     end
  49.     if extraHealthActive then
  50.       commands.exec("effect @p [r=2] 21 30 5")  --Extra Health Bar (Configurable!)
  51.     end
  52.     commands.exec("give @p [r=2] leather_helmet 0 1")
  53.     --Mind you, this can get VERY annoying, because of
  54.     --the popping sound from picking up the helmet :/
  55.     --Think of it as an injection of air ;)
  56.   else
  57.     if slowActive then
  58.       commands.exec("effect @p [r=2] 2 1 3")  --Slowness Effect if you don't bring in a leather helmet! (Configurable!)
  59.     end
  60.     if miningFatigueActive then
  61.       commands.exec("effect @p [r=2] 4 1 255") --Mining Fatigue Effect if you don't bring in a leather helmet! (Configurable!)
  62.     end
  63.     if nauseaActive then
  64.       commands.exec("effect @p [r=2] 9 1 255") --Nausea Effect if you don't bring in a leather helmet! (Configurable!)
  65.     end
  66.     if witherActive then
  67.       commands.exec("effect @p [r=2] 20 1 5") --Wither Effect if you don't bring in a leather helmet! (Configurable!)
  68.     end
  69. end
  70. ----------------------
  71. function checkThePlayer()
  72.   player = commands.exec("testfor @p [r=2]")
  73.   print(player .." is inside the chamber!")
  74. end
  75. ---------------------
  76. function checkForLava()
  77.   if commands.exec("testforblock lava ~ ~1 ~") then
  78.     lavaNotWater = true
  79.   end
  80. ---------------------
  81. function main()
  82.   while true do
  83.     heal()
  84.     if verbose then
  85.       checkThePlayer()
  86.     end
  87.     sleep(1)
  88.   end
  89. end
  90. -------------------
  91. --Main Program Beginning
  92. checkForLava()
  93. --The reason I don't put it in the main loop,
  94. --is for TPS optimization.
  95. --If I were to check every tick, it would
  96. --cause massive lag. Sorry!
  97. while true do
  98.   main()
  99. end
  100. --Main Program End
Advertisement
Add Comment
Please, Sign In to add comment