Advertisement
Guest User

[Lua] Eshkation's lights

a guest
Nov 30th, 2014
1,174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. dec = {}
  2. startLights = false
  3. ids = {0,1,2,4,9}
  4.  
  5. function eventNewGame()
  6. startLights = false
  7. dec = {}
  8. count = 0
  9.     xml = tfm.get.room.xmlMapInfo.xml
  10.     decorations = xml:match('<D>[^ยด]+/>'):gsub("<D>","")
  11.     for tree in decorations:gmatch('<P[^/]+/>') do
  12.         if tree:match('T="57"') then
  13.             count = count+1
  14.             dec[count] = {
  15.                 X = tree:match('X="[0-9]+"'):gsub('X="',''):gsub('"',''),
  16.                 Y = tree:match('Y="[0-9]+"'):gsub('Y="',''):gsub('"','')
  17.             }
  18.         end
  19.     end
  20.     startLights = true
  21. end
  22.  
  23. function eventLoop()
  24.     if startLights then
  25.         for counter = #dec,1,-1 do
  26.             for k = 10,0,-1 do
  27.                 tfm.exec.displayParticle(ids[math.random(#ids)],dec[counter].X+math.random(-40,40),dec[counter].Y+math.random(-120,30),0,0,0,0)
  28.                 tfm.exec.displayParticle(11,dec[counter].X-2,dec[counter].Y-183,math.cos(k),math.sin(k),0,0)
  29.             end
  30.         end
  31.     end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement