Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get 2eMc8Pei startup.lua
- -- Imposta i tempi (in secondi)
- local tFight = 2 -- tempo in cui il segnale è attivo ("FIGHT")
- local tRest = 20 -- tempo di riposo dopo il FIGHT
- local tRestElse = 5 -- tempo di riposo quando non c'è segnale
- -- Definisci le facciate per il segnale redstone
- local redstoneIn = "right" -- lato di ingresso
- local redstoneOut = "left" -- lato di uscita
- -- Ottieni il riferimento al monitor collegato
- local monitor = peripheral.find("monitor")
- if not monitor then
- error("No monitor found!")
- end
- -- Imposta la dimensione del testo sul monitor (valore 2, regolabile secondo le esigenze)
- monitor.setTextScale(4)
- while true do
- if redstone.getInput(redstoneIn) then
- -- Stato FIGHT
- monitor.clear()
- monitor.setCursorPos(3,3)
- monitor.write("*** FIGHT !! ***")
- redstone.setOutput(redstoneOut, true)
- -- Conta alla rovescia durante il periodo FIGHT
- for i = tFight, 1, -1 do
- monitor.setCursorPos(3,4)
- monitor.write("Fight: " .. i .. " s")
- sleep(1)
- end
- redstone.setOutput(redstoneOut, false)
- -- Conta alla rovescia per il riposo dopo il FIGHT
- for i = tRest, 1, -1 do
- monitor.clear()
- monitor.setCursorPos(3,3)
- monitor.write("*** REST ***")
- monitor.setCursorPos(3,4)
- monitor.write("Wait: " .. i .. " s")
- sleep(1)
- end
- else
- monitor.setCursorPos(3,4)
- monitor.write("Mob Farm OFF!")
- sleep(tRestElse)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement