From 6fd0f963baa4a1cfc3f5ef3e443192d03719c0bc Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Mon, 22 May 2023 01:07:44 +0500 Subject: [PATCH] Fixed hook on courses Fixed course loading if it's not compressed --- FIXES.md | 4 +++- beatrun/gamemodes/beatrun/gamemode/cl/Menu_Course.lua | 8 ++++---- beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua | 2 +- beatrun/gamemodes/beatrun/gamemode/sh/sh_buildmode.lua | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/FIXES.md b/FIXES.md index 4af90e0..48799a0 100644 --- a/FIXES.md +++ b/FIXES.md @@ -7,4 +7,6 @@ * Возможность удалять зиплайны от Zipline Gun на ПКМ. # Фиксы с предыдущей версии -* Теперь точно починил сохранение курсов. \ No newline at end of file +* Теперь точно починил сохранение курсов. +* Фикс раскачивающихся верёвок в курсах. +* Фикс загрузки курса если он не сжат. \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/Menu_Course.lua b/beatrun/gamemodes/beatrun/gamemode/cl/Menu_Course.lua index 5feeafc..de0f763 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/Menu_Course.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/Menu_Course.lua @@ -53,11 +53,11 @@ function OpenCourseMenu(ply) for k, v in pairs(files) do local data = file.Read(dir .. v, "DATA") - data = util.Decompress(data) + course = util.Decompress(data) or data - if data then - data = util.JSONToTable(data) - local courseentry = AEUI:AddText(courselist, data[5] or "ERROR", "AEUILarge", 10, 40 * #courselist.elements) + if course then + course = util.JSONToTable(course) + local courseentry = AEUI:AddText(courselist, course[5] or "ERROR", "AEUILarge", 10, 40 * #courselist.elements) courseentry.courseid = v:Split(".txt")[1] function courseentry:onclick() diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua index 0bd20ca..f9f47c1 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua @@ -52,7 +52,7 @@ local zpunchstart = Angle(2, 0, 0) hook.Add("SetupMove", "Grapple", function(ply, mv, cmd) if ply:GetMantle() ~= 0 or ply:GetClimbing() ~= 0 then return end - if not ply:Alive() or Course_Name ~= "" then return end + if not ply:Alive() or (Course_Name ~= "" and ply:GetNW2Int("CPNum", 1) ~= -1 and not ply:GetNW2Entity("Swingrope")) then return end if GetGlobalBool(GM_INFECTION) --[[and not ply:GetNW2Entity("Swingrope")]] then return end local activewep = ply:GetActiveWeapon() diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/sh_buildmode.lua b/beatrun/gamemodes/beatrun/gamemode/sh/sh_buildmode.lua index 648d2f4..bb50f31 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/sh_buildmode.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/sh_buildmode.lua @@ -602,7 +602,7 @@ if SERVER then function Beatrun_ReadCourse(data) game.CleanUpMap() - local a = util.Decompress(data) + local a = util.Decompress(data) or data local crc = util.CRC(a) local data = util.JSONToTable(a)