Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xml = [[]]
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableMortCommand(true)
- tfm.exec.disableMinimalistMode(true)
- tfm.exec.newGame('7446134')
- admin = "Zigwin#0000"
- playerData = {}
- map = 1
- killer = ""
- killerStartPos = {}
- exitPos = {}
- gameStarted = false
- function eventChatCommand(playerName, message)
- if playerName == admin then
- if message:sub(1,9) == 'selectMap' then
- map = message:sub(11)
- end
- if message == 'startGame' and not gameStarted then
- do
- local players = 0
- for _ in next, tfm.get.room.playerList do
- players = players + 1
- end
- if players <= 1 then
- print("<r>Need at least 2 players to start!</r>")
- return
- end
- end
- -- Загрузить данные о карте (генераторы, хмл и т.д.)
- setMapData(map)
- local playerList = {} -- Список имен игроков
- for name, data in next,playerData do
- data.isAlive = true -- Сделать всех живими
- table.insert(playerList, name)
- end
- tfm.exec.newGame(xml)
- -- Убийца
- killer = playerList[math.random(1,#playerList)]
- playerData[killer].respawnCooldown = 60
- tfm.exec.setNameColor(killer, 0xff0000)
- tfm.exec.killPlayer(killer)
- gameStarted = true
- map = nil
- end
- if message == 'endGame' and gameStarted then
- gameStarted = false
- map = 1
- playerData[killer].respawnCooldown = 0
- killer = ""
- killerStartPos = {}
- exitPos = {}
- generatorsInfo = {}
- hooksList = {}
- xml = [[]]
- for name, data in next,playerData do
- data.isAlive = false -- Сделать всех живими
- ui.removeTextArea(0, name)
- ui.removeTextArea(1, name)
- ui.removeTextArea(2, name)
- ui.removeTextArea(3, name)
- ui.removeTextArea(5, name)
- end
- tfm.exec.newGame('7446134')
- end
- end
- end
- function eventNewPlayer(playerName)
- tfm.exec.bindKeyboard(playerName, 32, true, true)
- tfm.exec.bindKeyboard(playerName, 32, false, true)
- system.bindKeyboard(playerName, 65, true, true)
- system.bindKeyboard(playerName, 68, true, true)
- system.bindKeyboard(playerName, 37, true, true)
- system.bindKeyboard(playerName, 39, true, true)
- playerData[playerName]={
- isAlive = false,
- isOnHook = false, -- Висит ли на крюке
- isFacingRight = true,
- swapTimer = false, -- я уже сам не знаю что это
- item = "",
- isHoldingSpace=false,
- activity="",
- generatorId=0,
- hookId = 0,
- isWon = false
- }
- end
- for name, data in next, tfm.get.room.playerList do
- eventNewPlayer(name)
- tfm.exec.setPlayerScore(name, 0)
- end
- local generatorsInfo = {}
- local hooksList = {}
- function setMapData(mapId)
- local mapsData =
- {
- {-- 1 Map
- generatorsInfo = {
- {x1=425,x2=475,y1=85,y2=125,progress=0,isRepaired=false,},
- {x1=935,x2=985,y1=25,y2=65,progress=0,isRepaired=false,},
- {x1=1425,x2=1475,y1=85,y2=125,progress=0,isRepaired=false,},
- {x1=1515,x2=1565,y1=250,y2=290,progress=0,isRepaired=false,},
- },
- hooksList = {
- {x1 = 530,x2 = 570,y1 = 315,y2 = 355,item = "",isBroken = false,timer = 60,breakProgress = 0,},
- {x1 = 830,x2 = 870,y1 = 315,y2 = 355,item = "",isBroken = false,timer = 60,breakProgress = 0,},
- {x1 = 1855,x2 = 1895,y1 = 315,y2 = 355,item = "",isImmortal = true,timer = 60,breakProgress = 0,},
- {x1 = 1925,x2 = 1965,y1 = 315,y2 = 355,item = "",isImmortal = true,timer = 60,breakProgress = 0,},
- },
- xml = [[<C><P Ca="" L="2400" /><Z><S><S P="0,0,0.3,0,0,0,0,0" L="80" X="1310" c="4" Y="270" T="10" H="60" /><S X="1272" L="241" H="80" c="4" Y="248" T="10" P="0,0,0.3,0,-45,0,0,0" /><S P="0,0,0.3,0,-180,0,0,0" L="300" X="1865" c="4" Y="260" T="10" H="200" /><S H="350" L="210" o="6a7495" X="895" c="4" Y="175" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0,-180,0,0,0" L="280" X="1172" c="4" Y="364" T="10" H="90" /><S H="60" L="70" X="1595" c="3" Y="346" T="10" P="0,0,0.3,0,45,0,0,0" /><S L="50" X="425" H="50" Y="-25" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0,-45,0,0,0" L="140" H="80" c="3" Y="380" T="10" X="1310" /><S X="1795" L="410" H="50" c="4" Y="375" T="5" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0,0,0,0,0,0" L="400" o="0" X="2200" c="3" N="" Y="200" T="12" H="400" /><S X="1795" L="410" H="10" c="3" Y="355" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" H="50" X="455" Y="-25" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="100" H="100" X="650" Y="371" T="6" P="0,0,0.3,0.2,-45,0,0,0" /><S L="50" X="475" H="10" Y="-45" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" X="495" H="50" Y="-25" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0,-45,0,0,0" L="70" H="40" c="3" Y="338" T="10" X="990" /><S X="1010" L="20" H="100" c="3" Y="350" T="10" P="0,0,0.3,0,0,0,0,0" /><S L="100" X="750" H="100" Y="371" T="6" P="0,0,0.3,0.2,45,0,0,0" /><S L="50" H="10" X="475" Y="-5" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S X="695" L="610" H="50" c="4" Y="375" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S H="400" L="400" o="0" X="200" c="3" N="" Y="200" T="12" P="0,0,0,0,0,0,0,0" /><S H="20" L="590" X="1295" c="4" N="" Y="310" T="10" P="0,0,0.3,0,0,0,0,0" /><S X="1575" L="25" H="140" c="2" Y="72" T="1" P="0,0,0,0.2,180,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="260" X="1130" c="3" Y="310" T="14" H="20" /><S H="20" L="260" X="1460" c="3" Y="310" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S X="1460" L="260" H="90" c="4" Y="365" T="10" P="0,0,0.3,0,-180,0,0,0" /><S H="60" L="10" X="1020" c="3" Y="106" T="1" P="0,0,0,0.2,0,0,0,0" /><S P="0,0,0,0.2,180,0,0,0" L="25" H="140" c="2" Y="75" T="1" X="1014" /><S P="0,0,0.3,0.2,0,0,0,0" L="310" X="1175" c="1" Y="390" T="5" H="20" /><S H="60" L="20" X="1030" c="1" Y="350" T="5" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0,0,0,0,0" L="20" X="1340" c="3" Y="195" T="10" H="120" /><S H="180" L="20" X="1010" c="3" Y="165" T="10" P="0,0,0.3,0,0,0,0,0" /><S H="120" L="20" X="1580" c="3" Y="195" T="10" P="0,0,0.3,0,0,0,0,0" /><S P="0,0,0.3,0,0,0,0,0" L="550" H="50" c="2" N="" Y="160" T="10" X="1295" /><S P="0,0,0.3,0,0,0,0,0" L="590" H="20" c="1" Y="10" T="10" X="1295" /><S H="10" L="1600" X="1175" c="3" Y="-5" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S X="1775" L="120" H="44" c="1" Y="258" T="5" P="0,0,0,0,0,0,0,0" /><S P="0,0,0,0,20,0,0,0" L="120" H="250" c="1" Y="139" T="5" X="1815" /><S H="200" L="200" X="1900" c="1" Y="100" T="5" P="0,0,0,0,0,0,0,0" /><S P="0,0,0.3,0.2,20,0,0,0" L="30" o="6a7495" X="1714" c="4" Y="197" T="12" H="100" /><S H="10" L="170" X="1273" c="3" Y="200" T="14" P="0,0,1,0.2,-45,0,0,0" /><S P="0,0,0.3,0.2,-0,0,0,0" L="220" H="10" c="3" Y="140" T="14" X="1130" /><S X="1450" L="240" H="10" c="3" Y="140" T="14" P="0,0,0.3,0.2,-0,0,0,0" /><S P="0,0,0.3,0.2,-0,0,0,0" L="240" X="1450" c="3" Y="180" T="14" H="10" /><S H="10" L="50" X="1374" c="3" Y="230" T="14" P="0,0,0.3,0.2,-0,0,0,0" /><S L="100" X="700" H="100" Y="350" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S L="60" H="10" X="700" Y="200" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" X="730" H="70" Y="170" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" H="70" X="675" Y="170" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,-15,0,0,0" L="200" H="40" c="4" Y="191" T="5" X="457" /><S H="50" L="170" X="475" c="3" Y="160" T="6" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0,0,0,0,0" L="70" X="965" c="3" Y="95" T="10" H="40" /><S L="20" X="746" H="10" Y="140" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="20" H="10" X="660" Y="140" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" X="530" H="50" Y="375" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" H="50" X="570" Y="375" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="610" X="695" H="10" Y="355" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="50" H="10" X="550" Y="395" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" X="870" H="50" Y="375" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" H="50" X="830" Y="375" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="50" X="850" H="10" Y="395" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" H="50" X="1855" Y="375" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" X="1895" H="50" Y="375" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" X="1965" H="50" Y="375" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" X="1925" H="50" Y="375" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="50" H="10" X="1875" Y="395" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="50" X="1945" H="10" Y="396" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S H="10" L="50" o="948616" X="450" c="4" Y="90" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S H="10" L="10" o="1f1f1f" X="430" c="4" Y="130" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="12" o="1f1f1f" X="470" Y="123" T="13" c="4" H="10" /><S P="0,0,0.3,0.2,0,0,0,0" L="50" o="1f1f1f" X="450" c="4" Y="110" T="12" H="30" /><S L="10" o="948616" X="470" H="10" Y="123" T="13" c="4" P="0,0,0.3,0.2,0,0,0,0" /><S H="10" L="50" o="948616" X="1450" c="4" Y="90" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="50" o="1f1f1f" X="1450" c="4" Y="110" T="12" H="30" /><S P="0,0,0.3,0.2,0,0,0,0" L="12" o="1f1f1f" H="10" Y="123" T="13" c="4" X="1470" /><S H="10" L="10" o="1f1f1f" X="1430" c="4" Y="130" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" o="948616" H="10" X="1470" Y="123" T="13" c="4" P="0,0,0.3,0.2,0,0,0,0" /><S H="30" L="50" o="1f1f1f" X="1540" c="4" Y="275" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="50" o="948616" X="1540" c="4" Y="255" T="12" H="10" /><S P="0,0,0.3,0.2,0,0,0,0" L="10" o="1f1f1f" X="1520" c="4" Y="295" T="12" H="10" /><S L="12" o="1f1f1f" H="10" X="1560" Y="288" T="13" c="4" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="10" o="948616" X="1560" Y="288" T="13" c="4" H="10" /><S P="0,0,0.3,0.2,0,0,0,0" L="12" o="1f1f1f" X="980" Y="63" T="13" c="4" H="10" /><S P="0,0,0.3,0.2,0,0,0,0" L="50" o="1f1f1f" X="960" c="4" Y="50" T="12" H="30" /><S H="10" L="10" o="1f1f1f" X="940" c="4" Y="70" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S L="10" o="948616" X="980" H="10" Y="63" T="13" c="4" P="0,0,0.3,0.2,0,0,0,0" /><S H="10" L="50" o="948616" X="960" c="4" Y="30" T="12" P="0,0,0.3,0.2,0,0,0,0" /></S><D><P X="460" Y="110" T="37" P="0,0" /><P X="435" Y="105" T="126" P="0,1" /><P X="1460" Y="110" T="37" P="0,0" /><P X="1435" Y="108" T="126" P="0,1" /><P P="0,0" Y="275" T="37" X="1550" /><P P="0,1" Y="270" T="126" X="1525" /><P X="970" Y="50" T="37" P="0,0" /><P C="2f2f2f" Y="0" T="34" X="790" P="0,0" /><DS Y="335" X="590" /><P C="545454,0" Y="135" T="117" P="0,0" X="790" /><P C="2f2f2f,1b1d1c,1c1c1c" Y="300" T="129" X="1375" P="0,0" /><P C="545454,1c1c1c,0" Y="235" T="128" X="1374" P="1,0" /><P X="1051" Y="381" T="106" P="1,0" /><P X="1039" Y="320" T="107" P="1,0" /><P X="1099" Y="242" T="112" P="0,0" /><P P="0,0" Y="252" T="121" X="1469" /><P C="545454,1c1c1c,0" Y="300" T="128" P="0,0" X="1474" /><P C="2f2f2f,1b1d1c,1c1c1c" Y="300" T="129" P="0,0" X="1425" /><P P="0,0" Y="201" T="123" X="1433" /><P P="0,0" Y="348" T="118" X="1707" /><P X="1875" Y="350" T="116" P="1,0" /><P P="1,0" Y="350" T="116" X="1945" /><P X="550" Y="350" T="116" P="1,0" /><P P="1,0" Y="350" T="116" X="850" /><P X="700" Y="300" T="1" P="1,0" /></D><O><O C="1" Y="121" X="1183" P="0" /></O></Z></C>]],
- killerStartPos = {1850,330},
- exitPos = {x1 = 400,x2 = 500,y1 = 200,y2 = 400}
- },
- }
- generatorsInfo = mapsData[mapId].generatorsInfo
- hooksList = mapsData[mapId].hooksList
- xml = mapsData[mapId].xml
- exitPos = mapsData[mapId].exitPos
- killerStartPos = mapsData[mapId].killerStartPos
- end
- function showProgress(playerName, remove)
- print("Showing Progress...")
- local y = tfm.get.room.playerList[playerName].y
- if not remove then
- if playerData[playerName].activity == "repairGenerator" then
- ui.addTextArea(-10, '',playerName, 360, y - 100, 80, 10, nil, nil, 0.7, true)
- ui.addTextArea(-11, '',playerName, 360, y - 100, generatorsInfo[playerData[playerName].generatorId].progress, 10, nil, nil, 0.7, true)
- elseif playerData[playerName].activity == "breakHook" then
- ui.addTextArea(-10, '',playerName, 360, y - 100, 80, 10, nil, nil, 0.7, true)
- ui.addTextArea(-11, '',playerName, 360, y - 100, hooksList[playerData[playerName].hookId].breakProgress*4, 10, nil, nil, 0.7, true)
- end
- else
- ui.removeTextArea(-10, playerName)
- ui.removeTextArea(-11, playerName)
- end
- end
- function eventPlayerRespawn(playerName)
- -- Если при респавне игрок на крюке то телепорт к крюку
- if playerData[playerName].isOnHook then
- local hook = hooksList[playerData[playerName].hookId]
- tfm.exec.movePlayer(playerName, hook.x1 + 25, hook.y2 + 25)
- end
- print(playerName.." respawned")
- end
- function checkKillersPos(isFacingRight, x1, y1, x2, y2)
- -- 5px вперед - дальность захвата (в ту сторону в которую смотрит игрок)
- if isFacingRight then
- return x1 + 5 > x2 and x1 < x2 and y1 - 20 < y2 and y1 + 20 > y2
- else
- return x1 - 5 < x2 and x1 > x2 and y1 - 20 < y2 and y1 + 20 > y2
- end
- end
- function checkGenerators()
- local a = 0
- for _, data in next,generatorsInfo do
- if data.isRepaired then a = a + 1 end
- end
- print(a)
- return a == #generatorsInfo
- end
- function eventKeyboard(playerName, keyCode, down, xPlayerPosition, yPlayerPosition)
- -- Если жив
- if playerData[playerName].isAlive then
- -- Нажатие Влево
- if keyCode==65 or keyCode==37 then
- playerData[playerName].isFacingRight = false
- playerData[playerName].swapTimer = true
- -- Если у убийцы нет ничего в руках то ускорение
- if playerName == killer and playerData[killer].item == "" then
- tfm.exec.movePlayer(playerName, 0, 0, nil, -50)
- end
- -- Нажатие Вправо
- elseif keyCode==68 or keyCode==39 then
- playerData[playerName].isFacingRight = true
- playerData[playerName].swapTimer = true
- -- Если у убийцы нет ничего в руках то ускорение
- if playerName == killer and playerData[killer].item == "" then
- tfm.exec.movePlayer(playerName, 0, 0, nil, 50)
- end
- end
- end
- -- Пробел (убийца)
- if keyCode == 32 then
- if playerName == killer then
- if playerData[playerName].item == "" then
- -- Ловля игроков
- local playersCatched = {}
- local playerTaken = ""
- if playerData[playerName].isFacingRight then
- for name, data in next,tfm.get.room.playerList do
- if name ~= playerName then
- if checkKillersPos(true, xPlayerPosition, yPlayerPosition, data.x, data.y) then
- table.insert(playersCatched, name)
- end
- end
- end
- else
- for name, data in next,tfm.get.room.playerList do
- if name ~= playerName then
- if checkKillersPos(false, xPlayerPosition, yPlayerPosition, data.x, data.y) then
- table.insert(playersCatched, name)
- end
- end
- end
- end
- -- Если поймано больше чем 1 то ловится случайный
- if #playersCatched == 1 then
- playerTaken = playersCatched[1]
- playerData[playerName].item = playerTaken
- tfm.exec.killPlayer(playerTaken)
- elseif #playersCatched > 1 then
- playerTaken = playersCatched[math.random(1,#playersCatched)]
- playerData[playerName].item = playerTaken
- tfm.exec.killPlayer(playerTaken)
- end
- else
- -- Если уже есть предмет (игрок пойман)
- -- то проверка на вешание на крюк
- for id, data in next, hooksList do
- if data.item == "" and not data.isBroken and playerData[killer].item ~= "" then
- if xPlayerPosition - 50 < data.x1 and xPlayerPosition + 50 > data.x1 and yPlayerPosition > data.y1 and yPlayerPosition < data.y2 then
- data.item = playerData[killer].item
- local player = playerData[killer].item
- playerData[player].isOnHook = true
- playerData[player].hookId = id
- tfm.exec.respawnPlayer(player)
- playerData[killer].item = ""
- end
- end
- end
- end
- elseif playerData[playerName].isAlive then
- -- Пробел игрок
- if down then
- -- При нажатии на пробел и если видна подсказка
- playerData[playerName].isHoldingSpace = true
- tfm.exec.playEmote(playerName, 27)
- else
- -- Когда отпустили пробел
- playerData[playerName].isHoldingSpace = false
- showProgress(playerName, true)
- end
- end
- end
- end
- function eventLoop(currentTime, timeRemaining)
- if gameStarted then
- if checkGenerators() then
- for i=1,10 do
- tfm.exec.displayParticle(2, math.random(exitPos.x1, exitPos.x2), math.random(exitPos.y1, exitPos.y2))
- end
- end
- for playerName, data in next, playerData do
- if playerName ~= killer then
- if not data.isWon then
- if checkGenerators() then
- if tfm.get.room.playerList[playerName].x > exitPos.x1 and tfm.get.room.playerList[playerName].x < exitPos.x2 and tfm.get.room.playerList[playerName].y > exitPos.y1 and tfm.get.room.playerList[playerName].y < exitPos.y2 then
- tfm.exec.giveCheese(playerName)
- tfm.exec.playerVictory(playerName)
- tfm.exec.setPlayerScore(playerName, 1, true)
- data.isWon = true
- end
- end
- end
- end
- -- Если определено что игрок возле объекта с котором возможно взаимодействие то другие не проверяются
- -- (Не может быть два таких объекта в одном месте)
- local checkDone = false
- -- Генератор
- for genId, genData in next, generatorsInfo do
- -- Проверка координат
- if tfm.get.room.playerList[playerName].x > genData.x1 and tfm.get.room.playerList[playerName].x < genData.x2 and tfm.get.room.playerList[playerName].y > genData.y1 and tfm.get.room.playerList[playerName].y < genData.y2 then
- -- Если не починен
- if not genData.isRepaired then
- data.generatorId = genId
- data.activity = "repairGenerator"
- checkDone = true
- else
- -- Если починен то появление частиц
- tfm.exec.displayParticle(0, math.random(genData.x1,genData.x2), math.random(300,350), nil, nil, nil, nil, playerName)
- end
- end
- end
- -- Крюк
- if not checkDone then
- for hookId, hookData in next, hooksList do
- if not hookData.isImmortal then
- if not hookData.isBroken then
- if tfm.get.room.playerList[playerName].x > hookData.x1 and tfm.get.room.playerList[playerName].x < hookData.x2 and tfm.get.room.playerList[playerName].y > hookData.y1 and tfm.get.room.playerList[playerName].y < hookData.y2 then
- data.hookId = hookId
- data.activity = "breakHook"
- end
- end
- end
- end
- end
- -- Игрок совершает действие (Держит пробел)
- if data.isHoldingSpace then
- if data.activity == "repairGenerator" then
- -- Генератор не починен
- if not generatorsInfo[data.generatorId].isRepaired then
- -- Проверка координт
- if tfm.get.room.playerList[playerName].x > generatorsInfo[playerData[playerName].generatorId].x1 and tfm.get.room.playerList[playerName].x < generatorsInfo[playerData[playerName].generatorId].x2 and tfm.get.room.playerList[playerName].y > generatorsInfo[playerData[playerName].generatorId].y1 and tfm.get.room.playerList[playerName].y < generatorsInfo[playerData[playerName].generatorId].y2 then
- -- Увеличение прогресса
- generatorsInfo[data.generatorId].progress = generatorsInfo[data.generatorId].progress + 4
- -- Если прогресс достигнут то генератор починен
- if generatorsInfo[data.generatorId].progress >= 80 then
- generatorsInfo[data.generatorId].isRepaired = true
- generatorsInfo[playerData[playerName].generatorId].progress = 80
- showProgress(playerName, true)
- end
- tfm.exec.playEmote(playerName, 27)
- showProgress(playerName)
- else
- -- Убрать прогресс
- showProgress(playerName, true)
- end
- end
- elseif data.activity == "breakHook" then
- if not hooksList[data.hookId].isBroken then
- if tfm.get.room.playerList[playerName].x > hooksList[data.hookId].x1 and tfm.get.room.playerList[playerName].x < hooksList[data.hookId].x2 and tfm.get.room.playerList[playerName].y > hooksList[data.hookId].y1 and tfm.get.room.playerList[playerName].y < hooksList[data.hookId].y2 then
- hooksList[data.hookId].breakProgress = hooksList[data.hookId].breakProgress + 2
- if hooksList[data.hookId].breakProgress >= 20 then
- hooksList[data.hookId].isBroken = true
- hooksList[playerData[playerName].hookId].breakProgress = 20
- -- Если был повешан игрок то его освобождение
- if hooksList[data.hookId].item ~= "" then
- playerData[hooksList[data.hookId].item].isOnHook = false
- tfm.exec.respawnPlayer(hooksList[data.hookId].item)
- tfm.exec.movePlayer(hooksList[data.hookId].item, hooksList[data.hookId].x1 + 25, hooksList[data.hookId].y1)
- showProgress(playerName, true)
- end
- end
- showProgress(playerName)
- else
- showProgress(playerName, true)
- end
- end
- end
- end
- -- Область видимости
- if data.isAlive then
- -- При повороте промежуток времени для изменения области видимости
- if data.swapTimer == true then
- data.swapTimer = false
- if data.isFacingRight then
- ui.removeTextArea(0, playerName)
- ui.removeTextArea(1, playerName)
- -- Left
- ui.addTextArea(0, "", playerName, 0, 0, 250, 400, 0x000001, 0x000001, 1, true)
- -- Right
- if data.isOnHook then
- ui.addTextArea(1, "", playerName, 550, 0, 250, 400, 0x000001, 0x000001, 1, true)
- else
- ui.addTextArea(1, "", playerName, 700, 0, 100, 400, 0x000001, 0x000001, 1, true)
- end
- else
- ui.removeTextArea(0, playerName)
- ui.removeTextArea(1, playerName)
- -- Right
- ui.addTextArea(0, "", playerName, 550, 0, 250, 400, 0x000001, 0x000001, 1, true)
- -- Left
- if data.isOnHook then
- ui.addTextArea(1, "", playerName, 0, 0, 250, 400, 0x000001, 0x000001, 1, true)
- else
- ui.addTextArea(1, "", playerName, 0, 0, 100, 400, 0x000001, 0x000001, 1, true)
- end
- end
- -- Сверху и снизу
- if tfm.get.room.playerList[playerName].y > 260 then
- ui.addTextArea(2, "", playerName, 0, tfm.get.room.playerList[playerName].y-350, 800, 200, 0x000001, 0x000001, 1, true)
- ui.addTextArea(3, "", playerName, 0, tfm.get.room.playerList[playerName].y+20, 800, 200, 0x000001, 0x000001, 1, true)
- elseif tfm.get.room.playerList[playerName].y < 180 then
- ui.addTextArea(2, "", playerName, 0, tfm.get.room.playerList[playerName].y-350, 800, 200, 0x000001, 0x000001, 1, true)
- ui.addTextArea(3, "", playerName, 0, tfm.get.room.playerList[playerName].y+20, 800, 400, 0x000001, 0x000001, 1, true)
- else
- -- Посередине
- ui.removeTextArea(0, playerName)
- ui.removeTextArea(3, playerName)
- ui.addTextArea(1, "", playerName, 500, 0, 300, 400, 0x000001, 0x000001, 1, true)
- ui.addTextArea(2, "", playerName, 0, 0, 300, 400, 0x000001, 0x000001, 1, true)
- end
- else
- if playerName == killer and playerData[playerName].respawnCooldown > 0 then
- ui.addTextArea(5, "", playerName, -5,-5,820,420, 0x000001, 0x000001, 1, true)
- else
- ui.removeTextArea(5, playerName)
- end
- -- Сверху и снизу
- if tfm.get.room.playerList[playerName].y > 260 then
- ui.addTextArea(2, "", playerName, 0, tfm.get.room.playerList[playerName].y-350, 800, 200, 0x000001, 0x000001, 1, true)
- ui.addTextArea(3, "", playerName, 0, tfm.get.room.playerList[playerName].y+20, 800, 200, 0x000001, 0x000001, 1, true)
- elseif tfm.get.room.playerList[playerName].y < 180 then
- ui.addTextArea(2, "", playerName, 0, tfm.get.room.playerList[playerName].y-350, 800, 200, 0x000001, 0x000001, 1, true)
- ui.addTextArea(3, "", playerName, 0, tfm.get.room.playerList[playerName].y+20, 800, 400, 0x000001, 0x000001, 1, true)
- else
- -- Посередине
- ui.removeTextArea(0, playerName)
- ui.removeTextArea(3, playerName)
- ui.addTextArea(1, "", playerName, 500, 0, 300, 400, 0x000001, 0x000001, 1, true)
- ui.addTextArea(2, "", playerName, 0, 0, 300, 400, 0x000001, 0x000001, 1, true)
- end
- end
- else
- ui.removeTextArea(0, playerName)
- ui.removeTextArea(1, playerName)
- ui.removeTextArea(2, playerName)
- ui.removeTextArea(3, playerName)
- end
- -- Пойманный игрок
- if playerName == killer then
- if playerData[killer].respawnCooldown > 0 then
- playerData[killer].respawnCooldown = playerData[killer].respawnCooldown - 1
- if playerData[killer].respawnCooldown == 0 then
- tfm.exec.respawnPlayer(playerName)
- tfm.exec.movePlayer(playerName, killerStartPos[1], killerStartPos[2])
- tfm.exec.setNameColor(playerName, 0xff0000)
- killerStartPos = nil
- end
- end
- ui.addTextArea(-1000, "<p align='center'><font color='#dd0000'>"..data.item, nil, tfm.get.room.playerList[killer].x-100, tfm.get.room.playerList[killer].y-50, 200, 0, nil, nil, 0)
- end
- -- Если на крюке
- if data.isOnHook then
- hooksList[data.hookId].timer = hooksList[data.hookId].timer - 1
- if hooksList[data.hookId].timer == 0 then
- data.isOnHook = false
- hooksList[data.hookId].isBroken = true
- tfm.exec.killPlayer(playerName)
- playerData[playerName].isAlive = false
- local deadPlayers = 0
- for name, data in next, playerData do
- if name ~= killer then
- if not data.isAlive then
- deadPlayers = deadPlayers + 1
- end
- end
- end
- if deadPlayers >= math.ceil(#playerData/2) then
- tfm.exec.giveCheese(killer)
- tfm.exec.playerVictory(killer)
- end
- elseif hooksList[data.hookId].timer == 10 then
- tfm.exec.setNameColor(playerName, 0xAC0300)
- elseif hooksList[data.hookId].timer == 20 then
- tfm.exec.setNameColor(playerName, 0xCC7E1A)
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement