Guest User

TFM BRIDGE - 1.2

a guest
Sep 1st, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.14 KB | None | 0 0
  1. -- variaveis
  2. listaNegra = {}
  3. tfm.exec.disableAutoScore ( true )
  4. tfm.exec.disableAutoShaman ( true )
  5. tfm.exec.disableAutoTimeLeft ( true )
  6. tfm.exec.disableMortCommand ( true )
  7. tfm.exec.setGameTime ( 300, true )
  8. tfm.exec.disableAutoNewGame ( true )
  9. tfm.exec.disableAfkDeath ( true )
  10. bombTime = {}
  11. bombX = {}
  12. bombY = {}
  13.  
  14. desgasteT = {}
  15. desgasteX = {}
  16. desgasteY = {}
  17.  
  18.  
  19. onTimer = {}
  20. onTimerPos = {}
  21. --rotação de mapas v
  22. mapas = {"@7375532", "@7376059", "@7376057", "@7377575", "@7395456", "@7416636", "@7415964", "@7472244", "@7472244", "@7472960"}
  23. -- resto v
  24. function rotacao ()
  25.  tfm.exec.newGame ( mapas[math.random(1, 10)], false )
  26.  tfm.exec.setGameTime ( 300, true )
  27. end
  28.  
  29. function eventNewGame ()
  30.  tfm.exec.setGameTime ( 300, true )
  31. end
  32. -- pisos especiais vv
  33. --timer vv
  34.  
  35. function timer (n)
  36.  bomba (n)
  37.  desgaste (n)
  38. end
  39. --bomba vv
  40. function bomba (n)
  41.  bombTime[tfm.get.room.playerList[n].id] = bombTime[tfm.get.room.playerList[n].id] - 1
  42.  bomba2 (bombX[tfm.get.room.playerList[n].id], bombY[tfm.get.room.playerList[n].id], n)
  43. end
  44. function bomba2 (bombX, bombY, n)
  45.  if (bombTime[tfm.get.room.playerList[n].id] == 6) then
  46.   tfm.exec.displayParticle ( 22, bombX, bombY, -1, 0, 0, 0, nil)
  47.   tfm.exec.displayParticle ( 22, bombX, bombY, 1, 0, 0, 0, nil)
  48.   tfm.exec.displayParticle ( 22, bombX, bombY, 0, 1, 0, 0, nil)
  49.   tfm.exec.displayParticle ( 22, bombX, bombY, 0, -1, 0, 0, nil)
  50.  end
  51.  if (bombTime[tfm.get.room.playerList[n].id]  == 4) then
  52.   tfm.exec.displayParticle ( 24, bombX, bombY, -1, 0, 0, 0, nil)
  53.   tfm.exec.displayParticle ( 24, bombX, bombY, 1, 0, 0, 0, nil)
  54.   tfm.exec.displayParticle ( 24, bombX, bombY, 0, 1, 0, 0, nil)
  55.   tfm.exec.displayParticle ( 24, bombX, bombY, 0, -1, 0, 0, nil)
  56.  end
  57.  if (bombTime[tfm.get.room.playerList[n].id]  == 2) then
  58.   tfm.exec.displayParticle ( 21, bombX, bombY, -1, 0, 0, 0, nil)
  59.   tfm.exec.displayParticle ( 21, bombX, bombY, 1, 0, 0, 0, nil)
  60.   tfm.exec.displayParticle ( 21, bombX, bombY, 0, 1, 0, 0, nil)
  61.   tfm.exec.displayParticle ( 21, bombX, bombY, 0, -1, 0, 0, nil)
  62.  end
  63.  if (bombTime[tfm.get.room.playerList[n].id]  == 0) then
  64.   tfm.exec.displayParticle ( 3, bombX, bombY, -1, 0, 0, 0, nil)
  65.   tfm.exec.displayParticle ( 3, bombX, bombY, 1, 0, 0, 0, nil)
  66.   tfm.exec.displayParticle ( 3, bombX, bombY, 0, 1, 0, 0, nil)
  67.   tfm.exec.displayParticle ( 3, bombX, bombY, 0, -1, 0, 0, nil)
  68.   tfm.exec.explosion ( bombX, bombY, 10000, 300, true )
  69.   tfm.exec.removePhysicObject ( tfm.get.room.playerList[n].id )
  70.   listaNegra[tfm.get.room.playerList[n].id] = 1
  71.  end
  72. end
  73. -- desgaste vv
  74. function desgaste (n)
  75.  if desgasteT[tfm.get.room.playerList[n].id] >= 10 then
  76.   desgasteT[tfm.get.room.playerList[n].id] = desgasteT[tfm.get.room.playerList[n].id] - 2
  77.   tfm.exec.addPhysicObject ( tfm.get.room.playerList[n].id, desgasteX[tfm.get.room.playerList[n].id], desgasteY[tfm.get.room.playerList[n].id], { type = 12, width = desgasteT[tfm.get.room.playerList[n].id], height = desgasteT[tfm.get.room.playerList[n].id], foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x573600, miceCollision = true, groundCollision = false})
  78.   tfm.exec.displayParticle ( 3, desgasteX[tfm.get.room.playerList[n].id], desgasteY[tfm.get.room.playerList[n].id], 0, 0, 0, 0.1, nil )
  79.   if desgasteT[tfm.get.room.playerList[n].id] >= 20 then
  80.    tfm.exec.displayParticle ( 3, desgasteX[tfm.get.room.playerList[n].id] - 10, desgasteY[tfm.get.room.playerList[n].id], 0, 0, 0, 0.1, nil )
  81.    tfm.exec.displayParticle ( 3, desgasteX[tfm.get.room.playerList[n].id] + 10, desgasteY[tfm.get.room.playerList[n].id], 0, 0, 0, 0.1, nil )
  82.   end
  83.  end
  84. end
  85.  
  86. rotacao ()
  87. posicaoX = 1
  88. posicaoY = 2
  89. tipo = 0
  90. invocador = "opa"
  91. function invocarPiso (nome)
  92.  if  (listaNegra[tfm.get.room.playerList[nome].id] == 1) then
  93.   desgasteT[tfm.get.room.playerList[nome].id] = 0
  94.   tfm.exec.removePhysicObject ( tfm.get.room.playerList[nome].id )
  95.   frictable = {[0]= 0.3, 0, 0, 0, 10, 0.3, 0.3, 0.3, 0.3, 0, 0.3, 0.3, 0.3, 0.3}
  96.   resttable = {[0]= 0.2, 0.2, 1.2, 20, 0.2, 0.2, 0.2, 0.2, 0.2, 0, 0.2, 0.2, 0.2, 0.2}
  97.   pisoaleatorio = {0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 13, 14, 1, 2, 3, 4, 5, 6, 7, 10, 11, 13, 14, 100, 200}
  98.   posicaoX = tfm.get.room.playerList[nome].x
  99.   posicaoY = tfm.get.room.playerList[nome].y
  100.   tipo = pisoaleatorio[math.random(1, #pisoaleatorio)]
  101.    if (tipo == 100) then
  102.     bombTime[tfm.get.room.playerList[nome].id] = 7
  103.     bombX[tfm.get.room.playerList[nome].id] = posicaoX
  104.     bombY[tfm.get.room.playerList[nome].id] = posicaoY
  105.     tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = 12, width = 48, height = 48, foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x000000, miceCollision = true, groundCollision = false})
  106.     listaNegra[tfm.get.room.playerList[nome].id] = 0
  107.     tfm.exec.displayParticle ( 37, posicaoX, posicaoY, 0, 0, 0, 0, nil)
  108.    elseif (tipo == 200) then
  109.     desgasteT[tfm.get.room.playerList[nome].id] = 48
  110.     desgasteX[tfm.get.room.playerList[nome].id] = posicaoX
  111.     desgasteY[tfm.get.room.playerList[nome].id] = posicaoY
  112.     tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = 12, width = 48, height = 48, foreground = false, friction = 0.2, restitution = 0.1, angle = 0, color=0x573600, miceCollision = true, groundCollision = false})
  113.     tfm.exec.displayParticle ( 3, posicaoX, posicaoY, -1, 0, 0, 0, nil)
  114.     tfm.exec.displayParticle ( 3, posicaoX, posicaoY, 1, 0, 0, 0, nil)
  115.     tfm.exec.displayParticle ( 3, posicaoX, posicaoY, 0, 1, 0, 0, nil)
  116.     tfm.exec.displayParticle ( 3, posicaoX, posicaoY, 0, -1, 0, 0, nil)
  117.     elseif (tipo == 13) then
  118.     fric = math.random(frictable[0], frictable[13])
  119.     rest = math.random(resttable[0], resttable[13])
  120.     tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = tipo, width = 24, height = 24, foreground = false, friction = fric, restitution = rest, angle = 0, color=0x5E80B3, miceCollision = true, groundCollision = false})
  121.     else
  122.     fric = frictable[tipo]
  123.     rest = resttable[tipo]
  124.    if (tipo == 14) then
  125.     fric = math.random(frictable[0], frictable[13])
  126.     rest = math.random(resttable[0], resttable[13])
  127.    end
  128.     tfm.exec.addPhysicObject ( tfm.get.room.playerList[nome].id, posicaoX, posicaoY, { type = tipo, width = 48, height = 48, foreground = false, friction = fric, restitution = rest, angle = 0, miceCollision = true, groundCollision = false})
  129.     tfm.exec.displayParticle ( 37, posicaoX, posicaoY, 0, 0, 0, 0, nil)
  130.    end
  131.   end
  132.  end
  133. function eventKeyboard ( jogador, codigoTecla, pressionando, posicaoX, posicaoY )
  134.  if (codigoTecla == 32) then
  135.   invocarPiso (jogador)
  136.  end
  137. end
  138.  
  139. function eventPlayerDied ( jogador )
  140.  tfm.exec.respawnPlayer ( jogador )
  141. end
  142.  
  143. -- comandos v
  144. system.disableChatCommandDisplay ( "start", true )
  145. system.disableChatCommandDisplay ( "r", true )
  146. system.disableChatCommandDisplay ( "remove", true )
  147. system.disableChatCommandDisplay ( "skip", true )
  148.  
  149. function eventChatCommand ( jogador, comando )
  150.  if (comando == "start") then
  151.   start(jogador)
  152.  end
  153.  if (comando == "r") then
  154.   tfm.exec.killPlayer ( jogador )
  155.   tfm.exec.respawnPlayer ( jogador )
  156.  end
  157.  if (comando == "remove") then
  158.   tfm.exec.removePhysicObject ( tfm.get.room.playerList[jogador].id )
  159.  end
  160.  if (comando == "skip") then
  161.    rotacao ()
  162.   end
  163.  end
  164.  
  165. function eventPlayerWon ( jogador, tempo, tempoRespawn )
  166.   tfm.exec.respawnPlayer ( jogador )
  167. end
  168.  
  169.  
  170. --ajuda v
  171.  
  172. function ajuda (clicker)
  173.  ui.addPopup ( 76, 0, "<html><b><font color='#BABD2F'><p align='center'>Ajuda</p></font></b><br/><b><font color='#009D9D'>- Instruções:</font></b><br/><br/><font color='#6C77C1'>Aperte espaço para invocar os pisos. Seu objetivo é construir uma <b>ponte</b> até o queijo, e depois outra para retornar. Você pode fazer isso com um amigo ou sozinho, mas alguns mapas são difíceis de se completar sem ajuda.</font><br/><br/><b><font color='#009D9D'>- Comandos:</font></b><br/><br/><font color='#6C77C1'>!r - Usado para respawnar</font><br/><font color='#6C77C1'>!remove - Remove o seu piso</font><br/><font color='#6C77C1'>!skip - Pula o mapa</font></html>", clicker, 200, 110, 400, true )
  174. end
  175.  ui.addTextArea ( 1, "<a href='event:teste'>Ajuda", nil, 6, 376, 0, 0, 0x324650, 0x213540, 1, true )
  176. function eventTextAreaCallback ( id, jogador, callback )
  177.  if (id == 1) then
  178.   ajuda (jogador)
  179.  end
  180. end
  181. function eventNewPlayer ( jogador )
  182.  system.bindKeyboard ( jogador , 32, true, true)
  183.  system.bindKeyboard ( jogador , 65, true, true)
  184.  tfm.exec.respawnPlayer ( jogador )
  185.  listaNegra[tfm.get.room.playerList[jogador].id] = 1
  186.  ui.addTextArea ( 1, "<a href='event:teste'>Ajuda", nil, 6, 376, 0, 0, 0x324650, 0x213540, 1, true)
  187.  bombTime[tfm.get.room.playerList[jogador].id] = -1
  188.  bombX[tfm.get.room.playerList[jogador].id] = -1
  189.  bombY[tfm.get.room.playerList[jogador].id] = -1
  190.  desgasteT[tfm.get.room.playerList[jogador].id] = 0
  191.  desgasteX[tfm.get.room.playerList[jogador].id] = 0
  192.  desgasteY[tfm.get.room.playerList[jogador].id] = 0
  193. end
  194. table.foreach(tfm.get.room.playerList, eventNewPlayer)
  195. --eventLoop v
  196. function eventLoop ( tempoAtual, tempoRestante )
  197.  if (tempoRestante <= 0) then
  198.   rotacao ()
  199.  end
  200.  table.foreach(tfm.get.room.playerList, timer)
  201. end
Add Comment
Please, Sign In to add comment