Guest User

TFM BRIDGE - 1.1

a guest
Sep 1st, 2018
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.59 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. --rotação de mapas v
  15. rotacao = {"@7375532", "@7376059", "@7376057", "@7377575", "@7395456", "@7416636", "@7415964", "@7472244"}
  16. -- resto v
  17. function eventNewGame ()
  18.  mapaescolhido = rotacao[math.random(1, 8)]
  19.  tfm.exec.newGame ( mapaescolhido, false )
  20.  tfm.exec.setGameTime ( 300, true )
  21. end
  22.  
  23.  
  24. -- pisos especiais vv
  25.  
  26. --bomba vv
  27. function bomba (n)
  28.  bombTime[tfm.get.room.playerList[n].id] = bombTime[tfm.get.room.playerList[n].id] - 1
  29.  bomba2 (bombX[tfm.get.room.playerList[n].id], bombY[tfm.get.room.playerList[n].id], n)
  30. end
  31.  
  32. function bomba2 (bombX, bombY, n)
  33.  if (bombTime[tfm.get.room.playerList[n].id] == 6) then
  34.   tfm.exec.displayParticle ( 22, bombX, bombY, -1, 0, 0, 0, nil)
  35.   tfm.exec.displayParticle ( 22, bombX, bombY, 1, 0, 0, 0, nil)
  36.   tfm.exec.displayParticle ( 22, bombX, bombY, 0, 1, 0, 0, nil)
  37.   tfm.exec.displayParticle ( 22, bombX, bombY, 0, -1, 0, 0, nil)
  38.  end
  39.  if (bombTime[tfm.get.room.playerList[n].id]  == 4) then
  40.   tfm.exec.displayParticle ( 24, bombX, bombY, -1, 0, 0, 0, nil)
  41.   tfm.exec.displayParticle ( 24, bombX, bombY, 1, 0, 0, 0, nil)
  42.   tfm.exec.displayParticle ( 24, bombX, bombY, 0, 1, 0, 0, nil)
  43.   tfm.exec.displayParticle ( 24, bombX, bombY, 0, -1, 0, 0, nil)
  44.  end
  45.  if (bombTime[tfm.get.room.playerList[n].id]  == 2) then
  46.   tfm.exec.displayParticle ( 21, bombX, bombY, -1, 0, 0, 0, nil)
  47.   tfm.exec.displayParticle ( 21, bombX, bombY, 1, 0, 0, 0, nil)
  48.   tfm.exec.displayParticle ( 21, bombX, bombY, 0, 1, 0, 0, nil)
  49.   tfm.exec.displayParticle ( 21, bombX, bombY, 0, -1, 0, 0, nil)
  50.  end
  51.  if (bombTime[tfm.get.room.playerList[n].id]  == 0) then
  52.   tfm.exec.displayParticle ( 3, bombX, bombY, -1, 0, 0, 0, nil)
  53.   tfm.exec.displayParticle ( 3, bombX, bombY, 1, 0, 0, 0, nil)
  54.   tfm.exec.displayParticle ( 3, bombX, bombY, 0, 1, 0, 0, nil)
  55.   tfm.exec.displayParticle ( 3, bombX, bombY, 0, -1, 0, 0, nil)
  56.   tfm.exec.explosion ( bombX, bombY, 10000, 300, true )
  57.   tfm.exec.removePhysicObject ( tfm.get.room.playerList[n].id )
  58.   listaNegra[tfm.get.room.playerList[n].id] = 1
  59.  end
  60. end
  61. eventNewGame ()
  62. posicaoX = 1
  63. posicaoY = 2
  64. tipo = 0
  65. invocador = "opa"
  66. function invocarPiso (nome)
  67.  if  (listaNegra[tfm.get.room.playerList[nome].id] == 1) then
  68.   tfm.exec.removePhysicObject ( tfm.get.room.playerList[nome].id )
  69.   pisoaleatorio = {0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 14, 1, 2, 3, 4, 5, 6, 7, 10, 11, 14, 100}
  70.   posicaoX = tfm.get.room.playerList[nome].x
  71.   posicaoY = tfm.get.room.playerList[nome].y
  72.   tipo = pisoaleatorio[math.random(1, 22)]
  73.    if (tipo == 100) then
  74.     bombTime[tfm.get.room.playerList[nome].id] = 7
  75.     bombX[tfm.get.room.playerList[nome].id] = posicaoX
  76.     bombY[tfm.get.room.playerList[nome].id] = posicaoY
  77.     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})
  78.     listaNegra[tfm.get.room.playerList[nome].id] = 0
  79.     tfm.exec.displayParticle ( 37, posicaoX, posicaoY, 0, 0, 0, 0, nil)
  80.     else
  81.     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}
  82.     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}
  83.     fric = frictable[tipo]
  84.     rest = resttable[tipo]
  85.    if (tipo == 14) then
  86.     fric = math.random(frictable[0], frictable[13])
  87.     rest = math.random(resttable[0], resttable[13])
  88.    end
  89.     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})
  90.     tfm.exec.displayParticle ( 37, posicaoX, posicaoY, 0, 0, 0, 0, nil)
  91.    end
  92.   end
  93.  end
  94. function eventKeyboard ( jogador, codigoTecla, pressionando, posicaoX, posicaoY )
  95.  if (codigoTecla == 32) then
  96.   invocarPiso (jogador)
  97.  end
  98. end
  99.  
  100. function eventPlayerDied ( jogador )
  101.  tfm.exec.respawnPlayer ( jogador )
  102. end
  103.  
  104. -- comandos v
  105. system.disableChatCommandDisplay ( "start", true )
  106. system.disableChatCommandDisplay ( "r", true )
  107. system.disableChatCommandDisplay ( "remove", true )
  108. system.disableChatCommandDisplay ( "skip", true )
  109.  
  110. function eventChatCommand ( jogador, comando )
  111.  if (comando == "start") then
  112.   start(jogador)
  113.  end
  114.  if (comando == "r") then
  115.   tfm.exec.killPlayer ( jogador )
  116.   tfm.exec.respawnPlayer ( jogador )
  117.  end
  118.  if (comando == "remove") then
  119.   tfm.exec.removePhysicObject ( tfm.get.room.playerList[jogador].id )
  120.  end
  121.  if (comando == "skip") then
  122.    eventNewGame ()
  123.   end
  124.  end
  125.  
  126. function eventPlayerWon ( jogador, tempo, tempoRespawn )
  127.   tfm.exec.respawnPlayer ( jogador )
  128. end
  129.  
  130.  
  131. --ajuda v
  132.  
  133. function ajuda (clicker)
  134.  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 )
  135. end
  136.  ui.addTextArea ( 1, "<a href='event:teste'>Ajuda", nil, 6, 376, 0, 0, 0x324650, 0x213540, 1, true )
  137. function eventTextAreaCallback ( id, jogador, callback )
  138.  if (id == 1) then
  139.   ajuda (jogador)
  140.  end
  141. end
  142. function eventNewPlayer ( jogador )
  143.  system.bindKeyboard ( jogador , 32, true, true)
  144.  system.bindKeyboard ( jogador , 65, true, true)
  145.  tfm.exec.respawnPlayer ( jogador )
  146.  listaNegra[tfm.get.room.playerList[jogador].id] = 1
  147.  ui.addTextArea ( 1, "<a href='event:teste'>Ajuda", nil, 6, 376, 0, 0, 0x324650, 0x213540, 1, true)
  148.  bombTime[tfm.get.room.playerList[jogador].id] = -1
  149.  bombX[tfm.get.room.playerList[jogador].id] = -1
  150.  bombY[tfm.get.room.playerList[jogador].id] = -1
  151. end
  152. table.foreach(tfm.get.room.playerList, eventNewPlayer)
  153. --eventLoop v
  154. function eventLoop ( tempoAtual, tempoRestante )
  155.  if (tempoRestante <= 0) then
  156.   eventNewGame ()
  157.  end
  158.  table.foreach(tfm.get.room.playerList, bomba)
  159. end
Add Comment
Please, Sign In to add comment