|
36 | 36 |
|
37 | 37 | -- spot targets by casting a ray in a random direction
|
38 | 38 | function HumanBehaviors.LookForTargets(AI, Owner, Skill)
|
39 |
| - local viewAngDeg = RangeRand(50, 120) * (0.5 + Skill / 200) |
| 39 | + local viewAngDeg = RangeRand(50, 120) * Owner.Perceptiveness * (0.5 + Skill / 200) |
40 | 40 | if AI.deviceState == AHuman.AIMING then
|
41 | 41 | AI.Ctrl:SetState(Controller.AIM_SHARP, true) -- reinforce sharp aim controller state to enable SharpLength in LookForMOs
|
42 |
| - viewAngDeg = 15 + (Skill / 10) |
| 42 | + viewAngDeg = 15 * Owner.Perceptiveness + (Skill / 10) |
43 | 43 | end
|
44 | 44 |
|
45 | 45 | local FoundMO = Owner:LookForMOs(viewAngDeg, rte.grassID, false)
|
@@ -500,6 +500,13 @@ function HumanBehaviors.Sentry(AI, Owner, Abort)
|
500 | 500 | elseif AI.SentryFacing and Owner.HFlipped ~= AI.SentryFacing then
|
501 | 501 | Owner.HFlipped = AI.SentryFacing -- turn to the direction we have been order to guard
|
502 | 502 | break -- restart this behavior
|
| 503 | + elseif math.random() < Owner.Perceptiveness then |
| 504 | + |
| 505 | + -- turn around occasionally if there is open space behind our back |
| 506 | + local backAreaRay = Vector(-math.random(FrameMan.PlayerScreenWidth/4, FrameMan.PlayerScreenWidth/2) * Owner.FlipFactor, 0):DegRotate(math.random(-25, 25) * Owner.Perceptiveness) |
| 507 | + if not SceneMan:CastStrengthRay(Owner.EyePos, backAreaRay, 10, Vector(), 10, rte.grassID, SceneMan.SceneWrapsX) then |
| 508 | + Owner.HFlipped = Owner.FlipFactor == 1 and true or false |
| 509 | + end |
503 | 510 | end
|
504 | 511 | end
|
505 | 512 | end
|
|
0 commit comments