Advertisement
suxonov

Untitled

May 12th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.78 KB | None | 0 0
  1. module = {
  2.         messages = {
  3.             en = {
  4.                 chat_welcome = '<J>%s, welcome to #towerdefense<PT> v. beta_1<J>\nType <b>!help</b> or press <b>[H]</b> for more information!';
  5.                 chat_help = '<N>If you\'re a <CH>shaman <N>use <i>F2-F5</i> to choose a tower. Press <b>[Ctrl]</b> to open towers-list.\nIf you\'re a <V>mouse<N> try to get the cheese.\n\nGoog luck!';
  6.                 chat_shaman = '<N>You\'re the <CH>shaman<N>! You have 10 seconds to place a towers.\nUse <i>F2-F5</i> to choose a tower and <b>arrow</b> to put it on the map!';
  7.             };
  8.    
  9.             ru = {
  10.                 chat_welcome = '<J>%s, добро пожаловать в #towerdefense<PT> v. beta_1<J>\nНапиши <b>!help</b> или нажми английскую <b>[H]</b>, чтобы узнать больше.';
  11.                 chat_help = '<N>Если Вы - <CH>шаман <N>используйте <i>F2-F5</i> чтобы выбрать башню. Нажмите <b>[Ctrl]</b>, чтобы открыть список башен.\nЕсли Вы - <V>мышь<N> попытайтесь взять сыр.\n\nУдачи!';
  12.                 chat_shaman = '<N>Вы - <CH>шаман<N>! У Вас есть 10 секунд, чтобы расположить башни!\nИспользуйте <i>F2-F5</i> чтобы выбрать башню и <b>стрелку</b>, чтобы расположить ее на карте!';
  13.             };
  14.         };
  15.         towers = {
  16.                 [1] = {call = 'Cannon Tower'; price = 6; obj = 18};
  17.                 [2] = {call = 'Ball Tower'; price = 3; obj = 6};
  18.                 [3] = {call = 'Bomb Tower'; price = 4, obj = 23};
  19.                 [4] = {call = 'Spirit Tower'; price = 3, obj = 24}
  20.         };
  21.         maps = {
  22.                 1387919
  23.        
  24.         };
  25.         coords = {
  26.             -- [''] = {x = ; y = }
  27.                 ['@1387919'] = {x = 25; y = 329}
  28.         };
  29.         }
  30.  
  31. towerdefense = {
  32.     INIT = function()
  33.         tfm.exec.newGame(module.maps[math.random(#module.maps)])
  34.     end;
  35.    
  36.     setTower = function(x, y, angle)
  37.         if angle == 0 then
  38.             system.newTimer(function() tfm.exec.addShamanObject (17, x, y, 180, 100, 150, false) end, 2000, true)
  39.         else
  40.             system.newTimer(function() tfm.exec.addShamanObject (17, x, y, -angle, 100, 150, false) end, 2000, true)
  41.         end
  42.     end;
  43. }
  44.  
  45. user = {
  46.     bindShaman = function()
  47.         for name,player in pairs(tfm.get.room.playerList) do
  48.             if player.isShaman then
  49.                 for i,keys in ipairs({17, 113}) do
  50.                     system.bindKeyboard(name, keys, true, true)
  51.                 end
  52.             end
  53.             if not player.isShaman then
  54.                 for i,keys in ipairs({17, 113}) do
  55.                     system.bindKeyboard(name, keys, true, false)
  56.                 end
  57.             end
  58.         end
  59.     end;
  60.    
  61.     spawn = function()
  62.         local i = tfm.get.room.currentMap
  63.         for name, player in pairs(tfm.get.room.playerList) do
  64.             if not player.isShaman then
  65.                 tfm.exec.movePlayer(name, module.coords[i].x, 200)
  66.             end
  67.         end
  68.     end;
  69. }
  70.  
  71. UI = {
  72.     openShop = function(g)
  73.         ui.addTextArea(0, "", g, 248, 104, 296, 203, 0x10151a, 0x10151a, 1, true)
  74.         ui.addTextArea(3, "<v><b><p align='center'><font size='15'>Shop</font></p>", g, 256, 72, 87, 40, 0x32454f, 0x32454f, 1, true)
  75.         ui.addTextArea(2, "", g, 243, 103, 165, 202, 0x648fa3, 0x648fa3, 1, true)
  76.         ui.addTextArea(1, "", g, 245, 104, 296, 203, 0x32454f, 0x32454f, 1, true)
  77.         ui.addTextArea(6, "", g, 249, 280, 283, 16, 0x648fa3, 0x648fa3, 1, true)
  78.         ui.addTextArea(8, "", g, 253, 283, 283, 16, 0x10151a, 0x10151a, 1, true)
  79.         ui.addTextArea(5, "<a href='event:close'><p align='center'>Close</p></a>", g, 251, 281, 283, 16, 0x32454f, 0x32454f, 1, true)
  80.     end;
  81. }
  82.  
  83. function eventNewGame()
  84.     started = true
  85.     user.bindShaman()
  86. end
  87.  
  88. function eventSummoningEnd (name, id, x, y, angle, xSpeed, ySpeed, other)
  89.     towerdefense.setTower(x, y, angle)
  90. end
  91.  
  92. function eventKeyboard(name, key, d, x, y)
  93.     if key == 17 then
  94.         UI.openShop(name)
  95.     end
  96. end
  97.  
  98. function eventLoop(time, rem)
  99.     if time >= 10000 and started == true then
  100.         started = false
  101.         user.spawn()
  102.     end
  103. end
  104.  
  105. towerdefense.INIT()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement