1- local ClimbingTimes = {5 , 1.25 , 1 , 1 , nil , 2 }
2-
3- --[[
4- local CLIMB_HANG = 1
5- local CLIMB_HEAVEUP = 2
6- local CLIMB_STRAFELEFT = 3
7- local CLIMB_STRAFERIGHT = 4
8- local CLIMB_FOLDEDSTART = 5
9- local CLIMB_FOLDEDHEAVEUP = 6
10-
11-
12- local climb1 = {
13- followplayer = false,
14- animmodelstring = "new_climbanim",
15- allowmove = true,
16- lockang = false,
17- ignorez = true,
18- smoothend = true,
19- AnimString = "climb1"
20- }
21-
22- local climbstrings = {"climb1", "climb2"}
23- ]]
1+ local ClimbingTimes = { 5 , 1.25 , 1 , 1 , nil , 2 }
242
253if game .SinglePlayer () and SERVER then
264 util .AddNetworkString (" Climb_SPFix" )
@@ -60,7 +38,7 @@ local function ClimbingEnd(ply, mv, cmd)
6038 local trout = util .TraceHull (tr )
6139
6240 if trout .Hit then
63- local trout = {}
41+ trout = {}
6442 tr .output = trout
6543 local start = tr .start
6644
@@ -101,9 +79,8 @@ local function ClimbingThink(ply, mv, cmd)
10179 if mv :KeyPressed (IN_FORWARD ) and ply :GetClimbingDelay () < CurTime () + 0.65 or mv :KeyDown (IN_FORWARD ) and ply :GetClimbingDelay () < CurTime () then
10280 ParkourEvent (" hangfoldedheaveup" , ply )
10381 ply .FootstepLand = false
104- timer .Simple (0.35 , function ()
105- ply :PlayStepSound (1 )
106- end )
82+ timer .Simple (0.35 , function () ply :PlayStepSound (1 ) end )
83+
10784 ply :SetClimbing (6 )
10885 ply :SetClimbingTime (0 )
10986 elseif ply :GetClimbingDelay () < CurTime () then
@@ -184,7 +161,7 @@ local function ClimbingThink(ply, mv, cmd)
184161 ply :SetClimbing (0 )
185162 ply :SetSafetyRollKeyTime (CurTime () + 0.1 )
186163 ParkourEvent (" hangjump" , ply )
187- if SERVER then
164+ if SERVER then
188165 ply :EmitSound (" WallrunRelease.Concrete" )
189166 timer .Simple (0.025 , function ()
190167 ply :EmitSound (" WallrunRelease.Concrete" )
@@ -198,15 +175,15 @@ local function ClimbingThink(ply, mv, cmd)
198175 BodyLimitX = 90
199176 BodyLimitY = 180
200177
201- local ang = ply :EyeAngles ()
178+ ang = ply :EyeAngles ()
202179 ang .x = 0
203180 ang .z = 0
204181 BodyAnim :SetAngles (ang )
205182 elseif game .SinglePlayer () then
206183 ply :SendLua (" lockang2=false lockang=false BodyLimitX=90 BodyLimitY=180 local ang=LocalPlayer():EyeAngles() ang.x=0 ang.z=0 BodyAnim:SetAngles(ang)" )
207184 end
208185
209- local ang = cmd :GetViewAngles ()
186+ ang = cmd :GetViewAngles ()
210187 ang .x = math.min (ang .x , 0 )
211188 ang = ang :Forward ()
212189 ang :Mul (350 )
@@ -267,10 +244,10 @@ local function ClimbingThink(ply, mv, cmd)
267244 ply .FootstepLand = false
268245 ParkourEvent (" climbheave" , ply )
269246 timer .Simple (0.6 , function ()
270- ply :PlayStepSound (1 )
247+ ply :PlayStepSound (1 )
271248 end )
272249 timer .Simple (1 , function ()
273- ply :PlayStepSound (1 )
250+ ply :PlayStepSound (1 )
274251 end )
275252 end
276253 end
@@ -291,7 +268,6 @@ local function ClimbingThink(ply, mv, cmd)
291268 local start = mv :GetOrigin () + wallang :Forward () * 20 + Vector (0 , 0 , 100 ) + dir
292269 local wallmat = trout .MatType
293270 local handstepsoft = HANDSTEPS_SOFT_LUT [wallmat ] or " ConcreteSoft"
294- local handstephard = HANDSTEPS_HARD_LUT [wallmat ] or " ConcreteHard"
295271
296272
297273 tr .start = start
@@ -325,36 +301,27 @@ local function ClimbingThink(ply, mv, cmd)
325301
326302 util .TraceHull (tr )
327303
328- if not trout .Hit then
329- ply :SetClimbingEndOld (ply :GetClimbingEnd ())
330- ply :SetClimbing (isright and 4 or 3 )
331- ply :SetClimbingStart (mv :GetOrigin ())
332- ply :SetClimbingEnd (mv :GetOrigin () + dir )
333- ply :SetClimbingTime (0 )
334-
335- tr .start = mv :GetOrigin () + ply :GetClimbingAngle ():Forward () * 20 + Vector (0 , 0 , 100 ) + dir
336- tr .endpos = tr .start - Vector (0 , 0 , 80 )
337-
338- if isright then
339- ParkourEvent (" hangstraferight" , ply )
340- timer .Simple (0.4 , function ()
341- ply :EmitSound (" Handsteps." .. handstepsoft )
342- end )
343- timer .Simple (0.9 , function ()
344- ply :EmitSound (" Handsteps." .. handstepsoft )
345- end )
346- else
347- ParkourEvent (" hangstrafeleft" , ply )
348- timer .Simple (0.4 , function ()
349- ply :EmitSound (" Handsteps." .. handstepsoft )
350- end )
351- timer .Simple (0.9 , function ()
352- ply :EmitSound (" Handsteps." .. handstepsoft )
353- end )
354- end
355-
356- ply :SetClimbingDelay (CurTime () + 0.9 )
304+ if trout .Hit then return end
305+ ply :SetClimbingEndOld (ply :GetClimbingEnd ())
306+ ply :SetClimbing (isright and 4 or 3 )
307+ ply :SetClimbingStart (mv :GetOrigin ())
308+ ply :SetClimbingEnd (mv :GetOrigin () + dir )
309+ ply :SetClimbingTime (0 )
310+
311+ tr .start = mv :GetOrigin () + ply :GetClimbingAngle ():Forward () * 20 + Vector (0 , 0 , 100 ) + dir
312+ tr .endpos = tr .start - Vector (0 , 0 , 80 )
313+
314+ if isright then
315+ ParkourEvent (" hangstraferight" , ply )
316+ timer .Simple (0.4 , function () ply :EmitSound (" Handsteps." .. handstepsoft ) end )
317+ timer .Simple (0.9 , function () ply :EmitSound (" Handsteps." .. handstepsoft ) end )
318+ else
319+ ParkourEvent (" hangstrafeleft" , ply )
320+ timer .Simple (0.4 , function () ply :EmitSound (" Handsteps." .. handstepsoft ) end )
321+ timer .Simple (0.9 , function () ply :EmitSound (" Handsteps." .. handstepsoft ) end )
357322 end
323+
324+ ply :SetClimbingDelay (CurTime () + 0.9 )
358325 end
359326 end
360327 end
@@ -488,16 +455,15 @@ local function ClimbingCheck(ply, mv, cmd)
488455 if IsValid (trout .Entity ) and trout .Entity .NoClimbing then return end
489456
490457 ply :SetClimbingAngle (wallang )
491-
492- local wallmat = trout .MatType
493- local tr = ply .ClimbingTraceEnd
494- local trout = ply .ClimbingTraceEndOut
458+
459+ local wallmat = trout .MatType
495460 local upvalue = ply :GetWallrun () == 1 and Vector (0 , 0 , 90 ) or Vector (0 , 0 , 65 )
496461 local plymins , plymaxs = ply :GetHull ()
497462 local handstepsoft = HANDSTEPS_SOFT_LUT [wallmat ] or " ConcreteSoft"
498463 local handstephard = HANDSTEPS_HARD_LUT [wallmat ] or " ConcreteHard"
499- local handsteprelease = HANDSTEPS_RELEASE_LUT [wallmat ] or " ConcreteRelease"
500464
465+ trout = ply .ClimbingTraceEndOut
466+ tr = ply .ClimbingTraceEnd
501467 tr .start = mv :GetOrigin () + wallang :Forward () * 45 + upvalue
502468 tr .endpos = tr .start - Vector (0 , 0 , 90 )
503469 tr .maxs = plymaxs
@@ -557,8 +523,8 @@ local function ClimbingCheck(ply, mv, cmd)
557523 return
558524 end
559525
560- local tr = ply .ClimbingTraceSafety
561- local trout = ply .ClimbingTraceSafetyOut
526+ tr = ply .ClimbingTraceSafety
527+ trout = ply .ClimbingTraceSafetyOut
562528
563529 tr .filter = ply
564530 tr .start = endpos
@@ -585,8 +551,6 @@ local function ClimbingCheck(ply, mv, cmd)
585551 if trout .Hit then return end
586552
587553 -- local steep = trout.HitNormal:Distance(Vector(0, 0, 1)) > 0.01
588- local tr = ply .ClimbingTraceSafety
589- local trout = ply .ClimbingTraceSafetyOut
590554
591555 tr .start = mv :GetOrigin ()
592556 tr .endpos = tr .start + Vector (0 , 0 , 75 )
@@ -596,8 +560,6 @@ local function ClimbingCheck(ply, mv, cmd)
596560 if trout .Hit then return end
597561
598562 local origin = mv :GetOrigin ()
599- local tr = ply .ClimbingTraceSafety
600- local trout = ply .ClimbingTraceSafetyOut
601563
602564 tr .start = startpos
603565 tr .endpos = startpos
@@ -684,10 +646,10 @@ local function ClimbingCheck(ply, mv, cmd)
684646
685647 if wr ~= 0 then
686648 ply :SetWallrun (0 )
687- ply :EmitSound (" Wallrun." .. wallrun )
649+ ply :EmitSound (" Wallrun." .. wallrun )
688650 ply :EmitSound (" Cloth.MovementRun" )
689651 timer .Simple (0.9 , function ()
690- ply :EmitSound (" Handsteps." .. handstepsoft )
652+ ply :EmitSound (" Handsteps." .. handstepsoft )
691653 end )
692654 end
693655
@@ -714,9 +676,7 @@ local function ClimbingCheck(ply, mv, cmd)
714676 local folded = mv :GetVelocity ().z < - 400
715677
716678 if folded then
717- local tr = ply .ClimbingTraceSafety
718- local trout = ply .ClimbingTraceSafetyOut
719- local mins , maxs = ply :GetCollisionBounds ()
679+ mins , maxs = ply :GetCollisionBounds ()
720680 mins .z = maxs .z * 0.25
721681
722682 tr .start = ply :GetClimbingEnd ()
@@ -750,50 +710,43 @@ local function ClimbingCheck(ply, mv, cmd)
750710
751711 if wr == 1 then
752712 event = " climb"
753- wallangc .x = - 30
713+ wallangc .x = - 30
754714 elseif lastvel .z < - 200 then
755715 event = " climbhard2"
756- timer .Simple (0.05 , function ()
757- ply :EmitSound (" Handsteps." .. handstephard )
758- end )
759- timer .Simple (0.7 , function ()
760- ply :EmitSound (" Handsteps." .. handstepsoft )
761- end )
716+ timer .Simple (0.05 , function () ply :EmitSound (" Handsteps." .. handstephard ) end )
717+ timer .Simple (0.7 , function () ply :EmitSound (" Handsteps." .. handstepsoft ) end )
718+
762719 if lastvel .z < - 250 then
763720 ply :FaithVO (" Faith.Impact" )
764721 else
765722 ply :FaithVO (" Faith.ImpactSoft" )
766723 end
767724 else
768- if event then
769- timer .Simple (0.2 , function ()
770- ply :EmitSound (" Handsteps." .. handstephard )
771- end )
772- end
725+ timer .Simple (0.15 , function ()
726+ ply :EmitSound (" Handsteps." .. handstephard )
727+ end )
773728 end
774729
775730 ParkourEvent (event , ply )
776731 end
777732
778733 ply .wallang = wallang
779734
780- if IsFirstTimePredicted () then
781- if CLIENT or game .SinglePlayer () then
782- if wallmat == MAT_CONCRETE then
783- timer .Simple (0.05 , function ()
784- ply :EmitSound (" Bump.Concrete" )
785- end )
786- end
735+ if game .SinglePlayer () or CLIENT and IsFirstTimePredicted () then
736+ if wallmat == MAT_CONCRETE then
737+ timer .Simple (0.05 , function ()
738+ ply :EmitSound (" Bump.Concrete" )
739+ end )
787740 end
788741
789- ply :EmitSound (" Handsteps." .. handstephard )
742+ ply :EmitSound (" Handsteps." .. handstephard )
790743 ply :EmitSound (" Cloth.FallShortMedium" )
791744
792745 if CLIENT and IsFirstTimePredicted () then
793746 ply .OrigEyeAng = wallang
794747 lockang2 = true
795748
796- if folded then
749+ if folded then
797750 DoImpactBlur (8 )
798751 lockang2 = false
799752 lockang = true
0 commit comments