Skip to content

Commit 2709f01

Browse files
committed
Fix AIs having perfect aim with rubber sniper, resolves #867
1 parent 0295e89 commit 2709f01

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

Assets/Prefabs/UI/LoadingScreen.prefab

+2
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ MonoBehaviour:
187187
see while aiming! Try combining it with an easy to aim barrel <sprite name="barrel_white">.
188188
- 99% of gambling addicts stop bidding right before they win a gun part in the
189189
auction!
190+
- Some gun parts may have advantages or disadvantages on specific maps due to how
191+
they work!
190192
transitionScreen: {fileID: 3396547481487014123}
191193
mandatoryDuration: 4
192194
normalRotationSpeed: 60

Assets/Prefabs/UI/Scoreboards.prefab

+4
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ MonoBehaviour:
111111
- FOR CBT (COG AND BOLT TINKERING)
112112
- FOR CBT (CROSS-BROWSER TESTING)
113113
- FOR SINKING POINT NUMBERS
114+
- FOR SINGNING DISTANCE FIELDS
115+
- IN 17 OPTIMALLY PACKED SQUARES
116+
- FOR HUGE STANDARD DEVIATION IN CRIME DATASET
117+
- FOR BITSHIFTING THE ODDS TO THEIR FAVOR
114118
nextCrimeSound: {fileID: 11400000, guid: b85c2d27bf39bda4787e149b19385438, type: 2}
115119
victoryProgressSound: {fileID: 11400000, guid: eda79fdd8cc569c439c8c885d19dc633, type: 2}
116120
newCrimeDelay: 1

Assets/Scripts/Gamestate/AIManager.cs

+9-11
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public List<PlayerManager> TrackedPlayers
5454
private NavMeshEvent onLinkEnd;
5555
private AmmoBoxCollector ammoBoxCollector;
5656
private Coroutine airDisablingRoutine;
57-
private bool isJumpCooldown = false;
57+
private bool hasInaccurateAugment = false;
5858

5959
private void Start()
6060
{
@@ -150,6 +150,9 @@ public override void SetGun(Transform offset)
150150
var barrel = ChoosePart(identity.Barrel, identity.Barrels, StaticInfo.Singleton.StartingBarrel);
151151
var extension = ChoosePart(identity.Extension, identity.Extensions, StaticInfo.Singleton.StartingExtension);
152152

153+
if (extension != null)
154+
hasInaccurateAugment = extension.id == "Rubber";
155+
153156
var gun = GunFactory.InstantiateGunAI(body, barrel, extension, this, offset);
154157
gunController = gun.GetComponent<GunController>();
155158
gunController.Initialize();
@@ -220,8 +223,10 @@ private void UpdateAimTarget(GunStats stats)
220223
{
221224
if (!ShootingTarget)
222225
return;
226+
227+
var badAimMultiplier = hasInaccurateAugment ? 4f : 1f;
223228
gunController.target = ShootingTarget.position
224-
+ new Vector3(Random.Range(-1f, 1f), 0, Random.Range(-1f, 1f))
229+
+ new Vector3(Random.Range(-1f, 1f) * badAimMultiplier, 0, Random.Range(-1f, 1f) * badAimMultiplier)
225230
* (transform.position - ShootingTarget.position).magnitude * 0.1f;
226231
}
227232

@@ -284,7 +289,7 @@ private void FindPlayers()
284289
// TODO do not default to shooting target??? what's this for?
285290
aiMovement.Target = ShootingTarget;
286291
var isStrafeDistance = closestDistance < 10f;
287-
aiMovement.enabled = isStrafeDistance && !agent.currentOffMeshLinkData.activated && !isJumpCooldown;
292+
aiMovement.enabled = isStrafeDistance && !agent.currentOffMeshLinkData.activated;
288293

289294
if (ShootingTarget != null)
290295
{
@@ -379,7 +384,7 @@ private void AnimateJump()
379384
{
380385
OffMeshLinkData offMeshLinkData = agent.currentOffMeshLinkData;
381386

382-
if (offMeshLinkData.activated && !isJumpCooldown)
387+
if (offMeshLinkData.activated)
383388
{
384389
var distance = Vector3.Distance(offMeshLinkData.startPos, offMeshLinkData.endPos);
385390
if (offMeshLinkData.linkType != OffMeshLinkType.LinkTypeDropDown)
@@ -392,13 +397,6 @@ private void AnimateJump()
392397
}
393398
}
394399

395-
private IEnumerator JumpCoolDown()
396-
{
397-
isJumpCooldown = true;
398-
yield return new WaitForSeconds(1f);
399-
isJumpCooldown = false;
400-
}
401-
402400
private void AnimateStopCrouch()
403401
{
404402
animator.SetBool("Crouching", false);

0 commit comments

Comments
 (0)