mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-27 20:43:02 +05:00
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
This commit is contained in:
parent
e38c6b5d2d
commit
958f5676b5
4 changed files with 17 additions and 9 deletions
BIN
beatrun/gamemodes/beatrun/content/materials/brcross.png
Normal file
BIN
beatrun/gamemodes/beatrun/content/materials/brcross.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 559 B |
|
@ -2,6 +2,9 @@ if CLIENT then
|
||||||
local disable_grapple = CreateClientConVar("Beatrun_DisableGrapple", 0, true, true, language.GetPhrase("beatrun.convars.disablegrapple"), 0, 1)
|
local disable_grapple = CreateClientConVar("Beatrun_DisableGrapple", 0, true, true, language.GetPhrase("beatrun.convars.disablegrapple"), 0, 1)
|
||||||
|
|
||||||
local circle = Material("circlesmooth.png", "nocull smooth")
|
local circle = Material("circlesmooth.png", "nocull smooth")
|
||||||
|
local brcross = Material("brcross.png", "nocull smooth")
|
||||||
|
|
||||||
|
local rotate_timer = 0
|
||||||
|
|
||||||
hook.Add("HUDPaint", "grappleicon", function()
|
hook.Add("HUDPaint", "grappleicon", function()
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
|
@ -26,8 +29,8 @@ if CLIENT then
|
||||||
cam.End3D()
|
cam.End3D()
|
||||||
|
|
||||||
surface.SetDrawColor(255, 255, 255)
|
surface.SetDrawColor(255, 255, 255)
|
||||||
surface.SetMaterial(circle)
|
surface.SetMaterial(brcross)
|
||||||
surface.DrawTexturedRect(w2s.x - SScaleX(4), w2s.y - SScaleY(4), SScaleX(8), SScaleY(8))
|
surface.DrawTexturedRectRotated(w2s.x, w2s.y, SScaleX(32), SScaleY(32), math.fmod(rotate_timer * 100, 360))
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -37,14 +40,16 @@ if CLIENT then
|
||||||
local trout = ply:GetEyeTrace()
|
local trout = ply:GetEyeTrace()
|
||||||
local dist = trout.HitPos:DistToSqr(ply:GetPos())
|
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()
|
cam.Start3D()
|
||||||
local w2s = trout.HitPos:ToScreen()
|
local w2s = trout.HitPos:ToScreen()
|
||||||
cam.End3D()
|
cam.End3D()
|
||||||
|
|
||||||
|
rotate_timer = rotate_timer + FrameTime()
|
||||||
|
|
||||||
surface.SetDrawColor(255, 255, 255)
|
surface.SetDrawColor(255, 255, 255)
|
||||||
surface.SetMaterial(circle)
|
surface.SetMaterial(brcross)
|
||||||
surface.DrawTexturedRect(w2s.x - SScaleX(4), w2s.y - SScaleY(4), SScaleX(8), SScaleY(8))
|
surface.DrawTexturedRectRotated(w2s.x, w2s.y, SScaleX(32), SScaleY(32), math.fmod(rotate_timer * 100, 360))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -72,7 +77,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
|
||||||
local trout = ply:GetEyeTrace()
|
local trout = ply:GetEyeTrace()
|
||||||
local dist = trout.HitPos:DistToSqr(mv:GetOrigin())
|
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()
|
local vel = mv:GetVelocity()
|
||||||
vel.z = -math.abs(vel.z)
|
vel.z = -math.abs(vel.z)
|
||||||
|
|
||||||
|
@ -156,7 +161,10 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
|
||||||
ent:SetNWVector("gpos", ent:GetPos())
|
ent:SetNWVector("gpos", ent:GetPos())
|
||||||
|
|
||||||
local delta = ent:GetNWVector("gpos", Vector(0,0,0)) - ent:GetNWVector("glastpos", Vector(0, 0, 0))
|
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
|
end
|
||||||
|
|
||||||
if mv:KeyDown(IN_ATTACK) and mv:GetOrigin().z < ply:GetGrapplePos().z - 64 then
|
if mv:KeyDown(IN_ATTACK) and mv:GetOrigin().z < ply:GetGrapplePos().z - 64 then
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
VERSION_GLOBAL = "1.0.23"
|
VERSION_GLOBAL = "1.0.24"
|
||||||
VERSION_LATEST = ""
|
VERSION_LATEST = ""
|
||||||
VERSION_CHECKED = false
|
VERSION_CHECKED = false
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1.0.23
|
1.0.24
|
Loading…
Reference in a new issue