Advertisement
Bolodefchoco_LUAXML

[Biblioteca] Execs

Dec 2nd, 2015
1,289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.39 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 02/12/2015
  3. --Last update: 21/05/2016
  4. --[[ Notes:
  5.     tfm.exec.respawnPlayer
  6.         Does:
  7.             Revive um jogador, se houver segundo e terceiro argumentos, ele será teletransportado para estes x,y após reviver.
  8.         Args:
  9.             n --> Jogador
  10.             x --> Posição horizontal para mover.
  11.             y --> Posição vertical para mover.
  12.     tfm.exec.giveCheese
  13.         Does:
  14.             Dá queijo à um jogador, e se win for true, dará toca (vitória)
  15.         Args:
  16.             n --> Jogador
  17.             win --> Boolean para dar toca
  18.     system.bindKeyboard
  19.         Does:
  20.             Habilita alguma tecla para algum jogador.
  21.         Args:
  22.             n --> Jogador
  23.             k --> Tabela de teclas (Exemplo: {0,1,2,3})
  24.             d --> Boolean caso o bind seja down.
  25.             a --> Ativar (true) ou desativar (false)
  26.     tfm.exec.getPosition
  27.         Does:
  28.             Retorna a posição do rato.
  29.         Args:
  30.             n --> Jogador
  31.     tfm.exec.movePhysicObject
  32.         Does:
  33.             Move um piso já existente
  34.         Args:
  35.             id --> Id do piso
  36.             x --> Nova posição horizontal x
  37.             y --> Nova posição vertical y
  38.     tfm.exec.getPhysicObjectProperties
  39.         Does:
  40.             Retorna as propriedades do piso
  41.         Args:
  42.             id --> Id do piso
  43. ]]--
  44.  
  45. do
  46.     local respawnPlayer=tfm.exec.respawnPlayer
  47.     tfm.exec.respawnPlayer=function(n,x,y)
  48.         if tfm.get.room.playerList[n].isDead then
  49.             respawnPlayer(n)
  50.             if x and y then
  51.                 tfm.exec.movePlayer(n,x,y,false)
  52.             end
  53.         end
  54.     end
  55.  
  56.     local giveCheese=tfm.exec.giveCheese
  57.     tfm.exec.giveCheese=function(n,win)
  58.         giveCheese(n)
  59.         if win then tfm.exec.playerVictory(n) end
  60.     end
  61.  
  62.     local bindKeyboard=system.bindKeyboard
  63.     system.bindKeyboard=function(n,k,d,a)
  64.         if type(k) == "table" then
  65.             for k,v in next,k do
  66.                 bindKeyboard(n,v,d,a)
  67.             end
  68.         else
  69.             bKeyboard(n,k,d,a)
  70.         end
  71.     end
  72.  
  73.  
  74.     local addPhysicObject = {tfm.exec.addPhysicObject,{}}
  75.     tfm.exec.addPhysicObject = function(id,x,y,properties)
  76.         addPhysicObject[1](id,x,y,properties)
  77.         addPhysicObject[2][id] = assert(properties,"[Physic Object] A physic object must have properties")
  78.     end
  79.     tfm.exec.movePhysicObject = function(id,x,y)
  80.         if addPhysicObject[2][id] then
  81.             tfm.exec.addPhysicObject(id,x,y,addPhysicObject[2][id])
  82.         end
  83.     end
  84.     tfm.exec.getPhysicObjectProperties = function(id)
  85.         if addPhysicObject[2][id] then
  86.             return addPhysicObject[2][id]
  87.         end
  88.     end
  89. end
  90.  
  91. tfm.exec.getPosition=function(n)
  92.     return tfm.get.room.playerList[n].x,tfm.get.room.playerList[n].y,tfm.get.room.playerList[n].isFacingRight
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement