Skip to content

Commit f227962

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

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
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

+7-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public List<PlayerManager> TrackedPlayers
5555
private AmmoBoxCollector ammoBoxCollector;
5656
private Coroutine airDisablingRoutine;
5757
private bool isJumpCooldown = false;
58+
private bool hasInaccurateAugment = false;
5859

5960
private void Start()
6061
{
@@ -150,6 +151,9 @@ public override void SetGun(Transform offset)
150151
var barrel = ChoosePart(identity.Barrel, identity.Barrels, StaticInfo.Singleton.StartingBarrel);
151152
var extension = ChoosePart(identity.Extension, identity.Extensions, StaticInfo.Singleton.StartingExtension);
152153

154+
if (extension != null)
155+
hasInaccurateAugment = extension.id == "Rubber";
156+
153157
var gun = GunFactory.InstantiateGunAI(body, barrel, extension, this, offset);
154158
gunController = gun.GetComponent<GunController>();
155159
gunController.Initialize();
@@ -220,8 +224,10 @@ private void UpdateAimTarget(GunStats stats)
220224
{
221225
if (!ShootingTarget)
222226
return;
227+
228+
var badAimMultiplier = hasInaccurateAugment ? 4f : 1f;
223229
gunController.target = ShootingTarget.position
224-
+ new Vector3(Random.Range(-1f, 1f), 0, Random.Range(-1f, 1f))
230+
+ new Vector3(Random.Range(-1f, 1f) * badAimMultiplier, 0, Random.Range(-1f, 1f) * badAimMultiplier)
225231
* (transform.position - ShootingTarget.position).magnitude * 0.1f;
226232
}
227233

0 commit comments

Comments
 (0)