Skip to content

Commit

Permalink
Fix telescope + coil not shooting straight
Browse files Browse the repository at this point in the history
  • Loading branch information
toberge committed Jul 2, 2024
1 parent f9b0208 commit 6944a9b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Assets/Scripts/Augment/AugmentImplementations/Telescope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ public class Telescope : GunExtension
void Start()
{
gunController = transform.parent.GetComponent<GunController>();
if (!gunController || !gunController.Player || !gunController.Player.HUDController)
if (!gunController)
return;

// Remove path altering modifiers so bullets always travel straight!
gunController.GetComponentInChildren<GunBarrel>()?
.GetModifiers()
.Where(modifier => modifier is ZigzagPathModifier or SpiralPathModifier)
.FirstOrDefault()?
.Detach(gunController.projectile);

if (!gunController.Player || !gunController.Player.HUDController)
return;

var playerMovement = gunController.Player.GetComponent<PlayerMovement>();
Expand All @@ -35,13 +45,6 @@ void Start()
gunMeshes = gunController.GetComponentsInChildren<MeshRenderer>().ToList();
gunSkinMeshes = gunController.GetComponentsInChildren<SkinnedMeshRenderer>().ToList();

// Remove path altering modifiers so bullets always travel straight!
gunController.GetComponentInChildren<GunBarrel>()?
.GetModifiers()
.Where(modifier => modifier is ZigzagPathModifier || modifier is SpiralPathModifier)
.FirstOrDefault()?
.Detach(gunController.projectile);

if (MatchController.Singleton)
MatchController.Singleton.onRoundEnd += CancelZoom;
}
Expand Down

0 comments on commit 6944a9b

Please sign in to comment.