zed_com

Hologram

Mar 13th, 2015
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. --библиотека многопоточия
  2. --os.execute("pastebin get E0SzJcCx /lib/thread.lua")
  3. local holo = require('component').hologram
  4. local thread = require("thread")
  5. local sleep = 0.1
  6.  
  7. holo.clear()
  8. thread.init()
  9.  
  10. local function rain(col)
  11.     os.sleep(0.7)
  12.     local x = math.random(2,47)
  13.     local z = math.random(2,47)
  14.     local xx = x
  15.     for y = 32, 1, -1 do
  16.         if xx == x then
  17.             x=x+1
  18.             holo.set(x, y, z, col)
  19.         else
  20.             x=x-1
  21.             holo.set(x, y, z, col)
  22.         end
  23.         os.sleep(sleep)
  24.         if y <= 29 then
  25.             holo.set(x, y+6, z,0)
  26.         end
  27.     end
  28.     holo.fill(x,z,6,0)
  29.     holo.fill(x+1,z,6,0)
  30. end
  31.  
  32.     while true do
  33.         local col = math.random(1,3)
  34.         for i=1, 10 do
  35.             thread.create(rain,col)
  36.             os.sleep(0.5)
  37.         end
  38.     --thread.waitForAll()
  39. end
Advertisement
Add Comment
Please, Sign In to add comment