Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap("left")
- term.redirect(monitor)
- local rain = {}
- local maxX, maxY = term.getSize()
- function newrain()
- local axis = math.random(1,2) == 1 and true or false
- local template = {
- x = axis == true and math.random(1,maxX) or maxX,
- y = axis == false and math.random(1,maxY) or 1,
- color = colors.blue,
- velo = math.random(1,4) == 4 and 2 or 1
- }
- table.insert(rain,template)
- end
- function redraw(bool)
- term.setBackgroundColor(bool == true and colors.white or colors.black)
- term.clear()
- for i,v in ipairs(rain) do
- term.setCursorPos(v.x,v.y)
- term.setTextColor(v.color)
- term.write("/")
- v.x = v.x - v.velo
- v.y = v.y + v.velo
- if v.y > maxX or v.x < 1 then
- table.remove(rain,i)
- end
- end
- end
- local boolean
- local light = 0
- while true do
- for i=1,3 do
- newrain()
- end
- if boolean == true then
- light = light + 1
- if light == 5 then
- boolean = false
- light = 0
- end
- else
- boolean = math.random(1,40) == 1 and true or false
- if boolean == true and commands then
- commands.exec("playsound ambient.weather.thunder"..math.random(1,3).." @p")
- end
- end
- redraw(boolean)
- sleep(0.01)
- if commands then
- commands.exec("playsound ambient.weather.rain"..math.random(1,4).." @p")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement