Advertisement
Kebucc

MobFarm ATM10 - 01

Feb 26th, 2025 (edited)
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. -- pastebin get 2eMc8Pei startup.lua
  2. -- Imposta i tempi (in secondi)
  3. local tFight = 2      -- tempo in cui il segnale è attivo ("FIGHT")
  4. local tRest = 20      -- tempo di riposo dopo il FIGHT
  5. local tRestElse = 5   -- tempo di riposo quando non c'è segnale
  6.  
  7. -- Definisci le facciate per il segnale redstone
  8. local redstoneIn = "right"   -- lato di ingresso
  9. local redstoneOut = "left"   -- lato di uscita
  10.  
  11. -- Ottieni il riferimento al monitor collegato
  12. local monitor = peripheral.find("monitor")
  13. if not monitor then
  14.   error("No monitor found!")
  15. end
  16.  
  17. -- Imposta la dimensione del testo sul monitor (valore 2, regolabile secondo le esigenze)
  18. monitor.setTextScale(4)
  19.  
  20. while true do
  21.   if redstone.getInput(redstoneIn) then
  22.     -- Stato FIGHT
  23.     monitor.clear()
  24.     monitor.setCursorPos(3,3)
  25.     monitor.write("*** FIGHT !! ***")
  26.    
  27.     redstone.setOutput(redstoneOut, true)
  28.     -- Conta alla rovescia durante il periodo FIGHT
  29.     for i = tFight, 1, -1 do
  30.       monitor.setCursorPos(3,4)
  31.       monitor.write("Fight: " .. i .. " s")
  32.       sleep(1)
  33.     end
  34.     redstone.setOutput(redstoneOut, false)
  35.    
  36.     -- Conta alla rovescia per il riposo dopo il FIGHT
  37.     for i = tRest, 1, -1 do
  38.       monitor.clear()
  39.       monitor.setCursorPos(3,3)
  40.       monitor.write("*** REST ***")
  41.       monitor.setCursorPos(3,4)
  42.       monitor.write("Wait: " .. i .. " s")
  43.       sleep(1)
  44.     end
  45.   else
  46.       monitor.setCursorPos(3,4)
  47.       monitor.write("Mob Farm OFF!")
  48.       sleep(tRestElse)
  49.   end
  50. end
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement