Skip to content

Commit

Permalink
Made weapons action group fireable. Toggles firing on and off.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yskinator committed Sep 14, 2015
1 parent c7ab7b2 commit 2979c4d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion BahaTurret/ModuleWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ public enum WeaponStates{Enabled, Disabled, PoweringUp, PoweringDown}
Vector3 fixedLeadOffset = Vector3.zero;
float targetLeadDistance = 0;

//Fired via an action group
private bool agFired = false;

//SPECAL FEATURES

Expand Down Expand Up @@ -307,6 +309,12 @@ public void AGToggle(KSPActionParam param)
Toggle();
}

[KSPAction("Fire Weapon ON/OFF")]
public void AGFire(KSPActionParam param)
{
agFired = !agFired;
}


//PartWindow buttons
[KSPEvent(guiActive = true, guiActiveEditor = false, guiName = "Toggle")]
Expand Down Expand Up @@ -465,7 +473,7 @@ void Update()
{


userFiring = (BDInputUtils.GetKey(BDInputSettingsFields.WEAP_FIRE_KEY) && (vessel.isActiveVessel || BDArmorySettings.REMOTE_SHOOTING) && !MapView.MapIsEnabled && !aiControlled);
userFiring = (BDInputUtils.GetKey(BDInputSettingsFields.WEAP_FIRE_KEY) && (vessel.isActiveVessel || BDArmorySettings.REMOTE_SHOOTING) && !MapView.MapIsEnabled && !aiControlled) || agFired ;
if((userFiring || autoFire) && (yawRange == 0 || (maxPitch-minPitch) == 0 || turret.TargetInRange(finalAimTarget, 10, float.MaxValue)))
{
if(eWeaponType == WeaponTypes.Ballistic || eWeaponType == WeaponTypes.Cannon)
Expand Down

0 comments on commit 2979c4d

Please sign in to comment.