Advertisement
Guest User

PlaceBloc

a guest
May 28th, 2014
1,550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.42 KB | None | 0 0
  1. -- By Nicolasledu
  2. tfm.exec.disableAutoNewGame(true)
  3. tfm.exec.disableAutoShaman(true)
  4. tfm.exec.disableAutoTimeLeft(true)
  5. tfm.exec.newGame(0)
  6.  
  7. prop = {}
  8. prop[0] = {type=0,width=40,height=40,friction=0.3,restitution=0.2}
  9. prop[1] = {type=1,width=40,height=40,friction=0,restitution=0.2}
  10. prop[2] = {type=2,width=40,height=40,friction=0,restitution=1.2}
  11. prop[3] = {type=3,width=40,height=40,friction=0,restitution=20}
  12. prop[4] = {type=4,width=40,height=40,friction=20,restitution=0.2}
  13. prop[5] = {type=5,width=40,height=40,friction=0.3,restitution=0.2}
  14. prop[6] = {type=6,width=40,height=40,friction=0.3,restitution=0.2}
  15. prop[7] = {type=7,width=40,height=40,friction=0.1,restitution=0.2}
  16. prop[8] = {type=8,width=40,height=40,friction=0.3,restitution=0.2,miceCollision=false}
  17. prop[9] = {type=9,width=40,height=40,friction=0.3,restitution=0.2}
  18. prop[10] = {type=10,width=40,height=40,friction=0.3,restitution=0}
  19. prop[11] = {type=11,width=40,height=40,friction=0.05,restitution=0.1}
  20. prop[12] = {type=12,width=40,height=40,friction=0.3,restitution=0.2,color=0xaaaaaa}
  21. prop[13] = {type=13,width=20,friction=0.3,restitution=0.2,color=0xaaaaaa}
  22.  
  23.  
  24.  
  25. function eventTextAreaCallback(idt,name,callback)
  26.     if callback=="place" then
  27.         local bloc = blocplayer[name]
  28.         tfm.exec.addPhysicObject(idt,blocx[idt] + 20,blocy[idt] + 20,prop[tonumber(bloc)] or prop[0])
  29.         ui.addTextArea(idt, "<a href='event:remove'><p align='center'><font size='20'><r>•</font></p></a>", nil, blocx[idt] + 5, blocy[idt] +8, 30, 30,nil,nil,0,false)
  30.     elseif callback=="remove" then
  31.         tfm.exec.removePhysicObject(idt)
  32.         ui.addTextArea(idt, "<a href='event:place'><p align='center'><font size='20'>•</font></p></a>", nil, blocx[idt] + 5, blocy[idt] +8, 30, 30,nil,nil,0,false)
  33.     end
  34. end
  35. function eventNewPlayer(p)
  36. tfm.exec.respawnPlayer(p)
  37. end
  38. function eventPlayerDied(p)
  39. tfm.exec.respawnPlayer(p)
  40. end
  41. function eventPlayerWon(p)
  42. tfm.exec.respawnPlayer(p)
  43. end
  44.  
  45. function eventChatCommand(playerName, command)
  46.     if command:sub(0,4) == "type" then
  47.         blocplayer[playerName] = command:sub(5)
  48.     end
  49. end
  50. function eventNewGame()
  51. blocplayer = {}
  52.  
  53. for playerName,p in pairs(tfm.get.room.playerList) do
  54.     blocplayer[playerName] = 0
  55. end
  56. xp = 0
  57. yp = 0
  58. id = 0
  59. blocx = {}
  60. blocy = {}
  61. for a = 1,200 do
  62. id = id + 1
  63. blocx[id] = xp
  64. blocy[id] = yp
  65. ui.addTextArea(id, "<a href='event:place'><p align='center'><font size='20'>•</font></p></a>", nil, xp+5, yp+8, 30, 30,nil,nil,0,false)
  66.  
  67. xp = xp+40
  68. if xp == 800 then
  69. xp = 0
  70. yp = yp + 40
  71. end
  72. end
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement