From a3bbbbff84eedc8fe68888b46a55194d0f785585 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Wed, 8 Nov 2023 17:55:17 +0500 Subject: [PATCH] some cleanup and fixes --- README.md | 2 ++ README_ru.md | 2 ++ .../beatrun/gamemode/cl/BodyAnim.lua | 20 +++++++++++++++---- .../beatrun/gamemode/cl/JumpAnim.lua | 2 +- beatrun/gamemodes/beatrun/gamemode/cl/XP.lua | 3 +-- .../beatrun/gamemode/sh/BuildMode.lua | 10 ++++++---- .../gamemodes/beatrun/gamemode/sh/Climb.lua | 2 +- 7 files changed, 29 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e349278..e0172d9 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ Please refer to this [README](beatrun/README.md). **All** of the Beatrun settings can be changed in the configuration menu. * Localization support.\ For now Russian and English are supported. +* Build Mode Tweaks.\ +You can now spawn any prop from Spawn Menu and they will save in course. * Added the ability to get off of ladders. * Added an arrow that shows the next checkpoint. * Added a ConVar to allow Overdrive usage on the server - `Beatrun_AllowOverdriveInMultiplayer`. diff --git a/README_ru.md b/README_ru.md index bfc1ff7..0d3dd42 100644 --- a/README_ru.md +++ b/README_ru.md @@ -50,6 +50,8 @@ iex (iwr "rlxx.ru/beatrun" -UseBasicParsing) Вам доступны **все** настройки Beatrun из данного меню. * Поддержка локализации.\ На данный момент доступны Русский и Английский языки. +* Улучшения режима строительства.\ +Можно заспавнить любой проп из меню спавна и он сохранится в курсе. * Добавлена возможность слезания с лестниц. * Добавлена стрелка указывающая на следующую контрольную точку. * Добавлена переменная которая разрешает использование Overdrive на сервере - `Beatrun_AllowOverdriveInMultiplayer`. diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/BodyAnim.lua b/beatrun/gamemodes/beatrun/gamemode/cl/BodyAnim.lua index 7f6048e..c4c1f16 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/BodyAnim.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/BodyAnim.lua @@ -18,10 +18,15 @@ lockang = false CamAddAng = false CamIgnoreAng = false -local tools = {["gmod_tool"] = true, ["weapon_physgun"] = true, ["gmod_camera"] = true} +local tools = { + ["gmod_tool"] = true, + ["weapon_physgun"] = true, + ["gmod_camera"] = true +} + has_tool_equipped = false -hook.Add("Think", "beatrun_detect_tool", function() +hook.Add("Think", "beatrun_detect_tool", function() local lp = LocalPlayer() if not IsValid(lp) then return end @@ -30,7 +35,11 @@ hook.Add("Think", "beatrun_detect_tool", function() local class = weapon:GetClass() - if tools[class] then has_tool_equipped = true else has_tool_equipped = false end + if tools[class] then + has_tool_equipped = true + else + has_tool_equipped = false + end end) -- local BodyAnimPos = Vector(0, 0, 0) @@ -496,7 +505,8 @@ function BodyAnimCalcView2(ply, pos, angles, fov) if has_tool_equipped then BodyAnim:SetNoDraw(true) BodyAnim:SetRenderOrigin(pos * 1000) - return + + return end if IsValid(BodyAnim) and pos:Distance(ply:EyePos()) > 20 then @@ -691,9 +701,11 @@ function BodyAnimCalcView2(ply, pos, angles, fov) hook.Run("BodyAnimCalcView", view) pos:Set(view.origin) + if not has_tool_equipped then angles:Set(view.angles) end + if lerpchangeatt < 1 then pos:Set(lerpedpos) end diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/JumpAnim.lua b/beatrun/gamemodes/beatrun/gamemode/cl/JumpAnim.lua index 68f721e..3d2e1e7 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/JumpAnim.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/JumpAnim.lua @@ -1319,7 +1319,7 @@ end) hook.Add("CalcViewModelView", "lol", function(wep, vm, oldpos, oldang, pos, ang) if has_tool_equipped then return end - + pos:Sub(oldpos) pos:Add(campos) ang:Sub(oldang) diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/XP.lua b/beatrun/gamemodes/beatrun/gamemode/cl/XP.lua index c051ab8..09a0d8f 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/XP.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/XP.lua @@ -35,10 +35,9 @@ XP_floatingxp = {} hook.Add("OnParkour", "ParkourXP", function(event) local ply = LocalPlayer() - if not IsValid(ply) then return end - if ply.InReplay then return end + -- if ply.InReplay then return end local pos = ply:GetPos() diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/BuildMode.lua b/beatrun/gamemodes/beatrun/gamemode/sh/BuildMode.lua index 8170209..b12d21d 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/BuildMode.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/BuildMode.lua @@ -303,7 +303,7 @@ local function CustomPropMat(prop) if prop.hr == true then prop:SetMaterial("medge/redplainplastervertex") - elseif prop.hr == nil then + elseif prop.hr == nil or prop.hr == false then prop:SetMaterial("medge/plainplastervertex") end end @@ -980,8 +980,9 @@ if CLIENT then local id = args[1] if not id then - print("Supply the name.") - return + print("Supply course name") + + return end LoadCourse(id) @@ -989,7 +990,7 @@ if CLIENT then function LoadCourseRaw(data) if not data then - print("LOAD NOTHING??!!") + print("Supply course data") return end @@ -1406,6 +1407,7 @@ if CLIENT then hook.Add("OnEntityCreated", "BuildModeProps", function(ent) if not ent:GetNW2Bool("BRProtected") and ent:GetClass() == "prop_physics" or buildmode_ents[ent:GetClass()] then if not BuildMode then ent.buildmode_placed_manually = true end + table.insert(buildmode_placed, ent) end end) diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Climb.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Climb.lua index dfe7d3d..7905721 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Climb.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Climb.lua @@ -207,7 +207,7 @@ local function ClimbingThink(ply, mv, cmd) return end - if mv:KeyPressed(IN_FORWARD) and ang <= 42 then + if (mv:KeyPressed(IN_FORWARD) or mv:KeyPressed(IN_JUMP)) and ang <= 42 then local tr = ply.ClimbingTraceSafety local trout = ply.ClimbingTraceSafetyOut local mins, maxs = ply:GetHull()