diff --git a/GameData/AVTOL/Plugins/AVTOL.dll b/GameData/AVTOL/Plugins/AVTOL.dll new file mode 100644 index 0000000..81f5760 Binary files /dev/null and b/GameData/AVTOL/Plugins/AVTOL.dll differ diff --git a/GameData/MagicSmokeIndustries/Plugins/AVTOL.dll b/GameData/MagicSmokeIndustries/Plugins/AVTOL.dll deleted file mode 100644 index ccc9c9e..0000000 Binary files a/GameData/MagicSmokeIndustries/Plugins/AVTOL.dll and /dev/null differ diff --git a/Source/AVTOL.cs b/Source/AVTOL.cs index e02aaec..2fb1eca 100644 --- a/Source/AVTOL.cs +++ b/Source/AVTOL.cs @@ -10,22 +10,26 @@ namespace AVTOL { public class AVTOL:PartModule { - [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Pitch Neutral%", guiFormat = "0"), + [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Pitch Neutral%"), UI_FloatRange(minValue = 0f, maxValue = 100f, stepIncrement = 1f)] public float pitchNeutral = 100f; - [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Pitch Range%", guiFormat = "0"), + [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Pitch Range%"), UI_FloatRange(minValue = -100f, maxValue = 100f, stepIncrement = 1f)] public float pitchRange = 0f; + + [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Phase Angle"), + UI_FloatRange(minValue = 0f, maxValue = 180f, stepIncrement = 5f)] + public float phaseAngle = 90f; - [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "IR Sync:"), - UI_Toggle(disabledText = "Off", enabledText = "On")] - public bool usePhaseAngle = false; - - [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Phase Angle", guiFormat = "0"), - UI_FloatRange(minValue = -180f, maxValue = 180f, stepIncrement = 5f)] - public float phaseAngle = 90f; + [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Max Angle"), + UI_FloatRange(minValue = 0f, maxValue = 180f, stepIncrement = 5f)] + public float maxAngle = 90f; - [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Vertical Cutoff", guiFormat = "0"), + [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Step Angle"), + UI_FloatRange(minValue = -90f, maxValue = 90f, stepIncrement = 0.5f)] + public float stepAngle = 22.5f; + + [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Vertical Cutoff"), UI_FloatRange(minValue = 1f, maxValue = 100f, stepIncrement = 1f)] public float verticalspeed = 100f; @@ -47,10 +51,22 @@ public void toggleSystem(KSPActionParam param) SetThrustPercentage(100f); } } - + [KSPAction("Increase Phase Angle")] + public void increasePhaseAngle(KSPActionParam param) + { + phaseAngle += stepAngle; + if (phaseAngle > maxAngle) + phaseAngle = maxAngle; + } + [KSPAction("Decrease Phase Angle")] + public void DecreasePhaseAngle(KSPActionParam param) + { + phaseAngle -= stepAngle; + if (phaseAngle < 0f) + phaseAngle = 0f; + } private ModuleEngines engine; private ModuleEnginesFX engineFX; - private MuMech.MuMechToggle muMechToggle; public override void OnStart(StartState state) { if (state == StartState.Editor) @@ -60,14 +76,6 @@ public override void OnStart(StartState state) engine = (ModuleEngines)part.Modules["ModuleEngines"]; if (part.Modules.Contains("ModuleEnginesFX")) engineFX = (ModuleEnginesFX)part.Modules["ModuleEnginesFX"]; - foreach (Part p in vessel.parts) - { - if (p.Modules.Contains("MuMechToggle")) - { - muMechToggle = (MuMech.MuMechToggle)p.Modules["MuMechToggle"]; - return; - } - } } public void FixedUpdate() @@ -76,10 +84,13 @@ public void FixedUpdate() this.Fields["pitchNeutral"].guiActiveEditor = showMenu; this.Fields["pitchRange"].guiActive = showMenu; this.Fields["pitchRange"].guiActiveEditor = showMenu; - this.Fields["usePhaseAngle"].guiActive = showMenu; - this.Fields["usePhaseAngle"].guiActiveEditor = showMenu; - this.Fields["phaseAngle"].guiActive = showMenu; this.Fields["phaseAngle"].guiActiveEditor = showMenu; + this.Fields["phaseAngle"].guiActive = showMenu; + this.Fields["maxAngle"].guiActive = showMenu; + this.Fields["maxAngle"].guiActiveEditor = showMenu; + this.Fields["stepAngle"].guiActive = showMenu; + this.Fields["stepAngle"].guiActiveEditor = showMenu; + this.Fields["verticalspeed"].guiActive = showMenu; this.Fields["verticalspeed"].guiActiveEditor = showMenu; @@ -93,12 +104,8 @@ public void FixedUpdate() float T = pitchNeutral; T *= (1f - (float)vessel.verticalSpeed / verticalspeed); + T *= Mathf.Sin(phaseAngle / 57.259f); T = Mathf.Clamp(T, 0f, 100f); - if(muMechToggle!=null && usePhaseAngle) - { - T *= Mathf.Cos((muMechToggle.rotation - phaseAngle)/57.259f); - } - T += pitchRange * vessel.ctrlState.pitch; SetThrustPercentage(T); diff --git a/Source/AVTOL.csproj b/Source/AVTOL.csproj index 100bf1f..cc35234 100644 --- a/Source/AVTOL.csproj +++ b/Source/AVTOL.csproj @@ -35,13 +35,6 @@ D:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp.dll - - False - D:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp-firstpass.dll - - - D:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\GameData\MagicSmokeIndustries\Plugins\InfernalRobotics.dll - diff --git a/Source/AVTOL.v12.suo b/Source/AVTOL.v12.suo index fae4203..04b461c 100644 Binary files a/Source/AVTOL.v12.suo and b/Source/AVTOL.v12.suo differ