@@ -235,11 +235,10 @@ end
235235
236236function HumanBehaviors .GetGrenadeAngle (AimPoint , TargetVel , StartPos , muzVel )
237237 local Dist = SceneMan :ShortestDistance (StartPos , AimPoint , false );
238- local range = Dist .Magnitude ;
239238
240239 -- compensate for gravity if the point we are trying to hit is more than 2m away
241- if range > 40 then
242- local timeToTarget = range / muzVel ;
240+ if Dist : MagnitudeIsGreaterThan ( 40 ) then
241+ local timeToTarget = Dist . Magnitude / muzVel ;
243242
244243 -- lead the target if target speed and projectile TTT is above the threshold
245244 if (timeToTarget * TargetVel .Magnitude ) > 0.5 then
@@ -1452,8 +1451,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
14521451 local RandomWpt = WptList [test ];
14531452 if RandomWpt then
14541453 Dist = SceneMan :ShortestDistance (Owner .Pos , RandomWpt .Pos , false );
1455- local mag = Dist .Magnitude ;
1456- if mag < 50 and mag < SceneMan :ShortestDistance (Owner .Pos , Waypoint .Pos , false ).Magnitude / 3 then
1454+ if Dist :MagnitudeIsLessThan (50 ) and Dist :MagnitudeIsLessThan (SceneMan :ShortestDistance (Owner .Pos , Waypoint .Pos , false ).Magnitude * 0.33 ) then
14571455 -- this waypoint is closer, check LOS
14581456 if - 1 == SceneMan :CastObstacleRay (Owner .Pos , Dist , Vector (), Vector (), Owner .ID , Owner .IgnoresWhichTeam , rte .grassID , 4 ) then
14591457 Waypoint = RandomWpt ; -- go here instead
@@ -2993,8 +2991,8 @@ function HumanBehaviors.ShootArea(AI, Owner, Abort)
29932991
29942992 -- check if we can fire at the AimPoint
29952993 local Trace = SceneMan :ShortestDistance (Owner .EyePos , AimPoint , false );
2996- local rayLenght = SceneMan :CastObstacleRay (Owner .EyePos , Trace , Vector (), Vector (), rte .NoMOID , Owner .IgnoresWhichTeam , rte .grassID , 11 );
2997- if Trace . Magnitude * 0.67 < rayLenght then
2994+ local rayLength = SceneMan :CastObstacleRay (Owner .EyePos , Trace , Vector (), Vector (), rte .NoMOID , Owner .IgnoresWhichTeam , rte .grassID , 11 );
2995+ if Trace : MagnitudeIsLessThan ( rayLength * 1.5 ) then
29982996 break ; -- the AimPoint is close enough to the target, start shooting
29992997 end
30002998
0 commit comments