Skip to content

Commit

Permalink
fix #27
Browse files Browse the repository at this point in the history
  • Loading branch information
BahamutoD committed Apr 23, 2016
1 parent ec5483c commit bf2ff6a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions BahaTurret/ModuleWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,14 @@ void Update()
if(weaponState == WeaponStates.Enabled && (TimeWarp.WarpMode != TimeWarp.Modes.HIGH || TimeWarp.CurrentRate == 1))
{
userFiring = (BDInputUtils.GetKey(BDInputSettingsFields.WEAP_FIRE_KEY) && (vessel.isActiveVessel || BDArmorySettings.REMOTE_SHOOTING) && !MapView.MapIsEnabled && !aiControlled);
if(!pointingAtSelf && (userFiring || autoFire || agHoldFiring) && (yawRange == 0 || (maxPitch - minPitch) == 0 || turret.TargetInRange(finalAimTarget, 10, float.MaxValue)))
if((userFiring || autoFire || agHoldFiring) && (yawRange == 0 || (maxPitch - minPitch) == 0 || turret.TargetInRange(finalAimTarget, 10, float.MaxValue)))
{
if(eWeaponType == WeaponTypes.Ballistic || eWeaponType == WeaponTypes.Cannon)
if(useRippleFire && (pointingAtSelf || isOverheated))
{
StartCoroutine(IncrementRippleIndex(0));
finalFire = false;
}
else if(eWeaponType == WeaponTypes.Ballistic || eWeaponType == WeaponTypes.Cannon)
{
finalFire = true;
}
Expand Down Expand Up @@ -919,20 +924,14 @@ private void Fire()
}

float timeGap = (60/roundsPerMinute) * TimeWarp.CurrentRate;

if(Time.time-timeFired > timeGap && !isOverheated && !pointingAtSelf)
if(Time.time-timeFired > timeGap && !isOverheated && !pointingAtSelf && !Misc.CheckMouseIsOnGui() && WMgrAuthorized())
{
bool effectsShot = false;
//Transform[] fireTransforms = part.FindModelTransforms("fireTransform");
for(int i = 0; i < fireTransforms.Length; i++)
{
if(!Misc.CheckMouseIsOnGui() && WMgrAuthorized() && (BDArmorySettings.INFINITE_AMMO || part.RequestResource(ammoName, requestResourceAmount)>0))
if((BDArmorySettings.INFINITE_AMMO || part.RequestResource(ammoName, requestResourceAmount)>0))
{
if(useRippleFire)
{
StartCoroutine(IncrementRippleIndex(initialFireDelay * TimeWarp.CurrentRate));
}

Transform fireTransform = fireTransforms[i];
spinningDown = false;

Expand Down Expand Up @@ -1126,7 +1125,10 @@ private void Fire()
}
}


if(useRippleFire)
{
StartCoroutine(IncrementRippleIndex(initialFireDelay * TimeWarp.CurrentRate));
}
}
else
{
Expand Down Expand Up @@ -1292,10 +1294,7 @@ void CheckWeaponSafety()
}
}

if(useRippleFire && (pointingAtSelf || isOverheated))
{
StartCoroutine(IncrementRippleIndex(0));
}

}

void RunTrajectorySimulation()
Expand Down
Binary file modified BahaTurret/bin/Release/BahaTurret.dll
Binary file not shown.
Binary file modified BahaTurret/obj/x86/Release/BahaTurret.dll
Binary file not shown.

0 comments on commit bf2ff6a

Please sign in to comment.