From 958f5676b54b3b43d6a8421d1238b46e6d67519f Mon Sep 17 00:00:00 2001 From: relaxtakenotes <91839650+relaxtakenotes@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:51:30 +0500 Subject: [PATCH] some grapple stuff - better icon - disable moving along with entity in mp due to it being impossible to predict - disallow grappling on the sky lol --- .../beatrun/content/materials/brcross.png | Bin 0 -> 559 bytes .../gamemodes/beatrun/gamemode/sh/Grapple.lua | 22 ++++++++++++------ beatrun/gamemodes/beatrun/gamemode/shared.lua | 2 +- version.txt | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 beatrun/gamemodes/beatrun/content/materials/brcross.png diff --git a/beatrun/gamemodes/beatrun/content/materials/brcross.png b/beatrun/gamemodes/beatrun/content/materials/brcross.png new file mode 100644 index 0000000000000000000000000000000000000000..8af7432bd9a6dd49a1672427794cb52e59d7d7d8 GIT binary patch literal 559 zcmV+~0?_@5P)KLZ*U+R`sCEkzKl)gj5&q@hY_5?)@_euSf22N!q0z{yc?Q2YY_Kym8e z5Fvwu2%hQO!{u_psMvL#(bD64NQRTZj^-}DnS22ry9f-;mW=gZvQj}U-ZdMsK&I8^7~DvX`q=i;%7(# z0QDumeUek>JSdI;1Rwwb2tYIQdA$PcU9HptEtXwdEg(5P1B?pTg*4d6t7@SB6_}FC x{SVsm8|@fMovKeW3P1n?a2&u3009600{|t}6GvDV!j1p{002ovPDHLkV1m2b-@X6< literal 0 HcmV?d00001 diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua index 85dd7b6..5c10b35 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua @@ -2,6 +2,9 @@ if CLIENT then local disable_grapple = CreateClientConVar("Beatrun_DisableGrapple", 0, true, true, language.GetPhrase("beatrun.convars.disablegrapple"), 0, 1) local circle = Material("circlesmooth.png", "nocull smooth") + local brcross = Material("brcross.png", "nocull smooth") + + local rotate_timer = 0 hook.Add("HUDPaint", "grappleicon", function() local ply = LocalPlayer() @@ -26,8 +29,8 @@ if CLIENT then cam.End3D() surface.SetDrawColor(255, 255, 255) - surface.SetMaterial(circle) - surface.DrawTexturedRect(w2s.x - SScaleX(4), w2s.y - SScaleY(4), SScaleX(8), SScaleY(8)) + surface.SetMaterial(brcross) + surface.DrawTexturedRectRotated(w2s.x, w2s.y, SScaleX(32), SScaleY(32), math.fmod(rotate_timer * 100, 360)) return end @@ -37,14 +40,16 @@ if CLIENT then local trout = ply:GetEyeTrace() local dist = trout.HitPos:DistToSqr(ply:GetPos()) - if trout.Fraction > 0 and dist < 2750000 and dist > 90000 then + if not trout.HitSky and trout.Fraction > 0 and dist < 2750000 and dist > 90000 then cam.Start3D() local w2s = trout.HitPos:ToScreen() cam.End3D() + rotate_timer = rotate_timer + FrameTime() + surface.SetDrawColor(255, 255, 255) - surface.SetMaterial(circle) - surface.DrawTexturedRect(w2s.x - SScaleX(4), w2s.y - SScaleY(4), SScaleX(8), SScaleY(8)) + surface.SetMaterial(brcross) + surface.DrawTexturedRectRotated(w2s.x, w2s.y, SScaleX(32), SScaleY(32), math.fmod(rotate_timer * 100, 360)) end end) end @@ -72,7 +77,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd) local trout = ply:GetEyeTrace() local dist = trout.HitPos:DistToSqr(mv:GetOrigin()) - if trout.Fraction > 0 and dist < 2750000 and dist > 90000 and mv:KeyPressed(IN_JUMP) then + if not trout.HitSky and trout.Fraction > 0 and dist < 2750000 and dist > 90000 and mv:KeyPressed(IN_JUMP) then local vel = mv:GetVelocity() vel.z = -math.abs(vel.z) @@ -156,7 +161,10 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd) ent:SetNWVector("gpos", ent:GetPos()) local delta = ent:GetNWVector("gpos", Vector(0,0,0)) - ent:GetNWVector("glastpos", Vector(0, 0, 0)) - ply:SetGrapplePos(ply:GetGrapplePos() + delta) + + if game.SinglePlayer() then // this is pretty much impossible to predict, so lets keep it only for sp + ply:SetGrapplePos(ply:GetGrapplePos() + delta) + end end if mv:KeyDown(IN_ATTACK) and mv:GetOrigin().z < ply:GetGrapplePos().z - 64 then diff --git a/beatrun/gamemodes/beatrun/gamemode/shared.lua b/beatrun/gamemodes/beatrun/gamemode/shared.lua index df11015..0e2ff16 100644 --- a/beatrun/gamemodes/beatrun/gamemode/shared.lua +++ b/beatrun/gamemodes/beatrun/gamemode/shared.lua @@ -1,4 +1,4 @@ -VERSION_GLOBAL = "1.0.23" +VERSION_GLOBAL = "1.0.24" VERSION_LATEST = "" VERSION_CHECKED = false diff --git a/version.txt b/version.txt index 1c2de38..321816a 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.23 \ No newline at end of file +1.0.24 \ No newline at end of file