Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
AniruddhKSP authored Oct 4, 2020
1 parent 2e43bd5 commit e8c5807
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
13 changes: 9 additions & 4 deletions BeamedPowerPropulsion/AblativeEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ public void Start()
{
Debug.LogError(("BeamedPowerPropulsion.AblativeEngine : ModuleEnginesFX not found on part-" + this.part.partName));
}
engine.throttleInstant = false;
engine.throttleResponseRate /= 5;
engine.engineSpoolTime = 5;
receiver = new ReceivedPower();
try
{
Expand Down Expand Up @@ -143,7 +140,15 @@ public void FixedUpdate()
received_power = 0f;
State = engineOff;
}
ReceivedPower = (float)Math.Round(received_power, 1);

if (received_power > 0f)
{
ReceivedPower = (float)Math.Round(received_power, 1);
}
else
{
ReceivedPower = 0f;
}

// code related to engine module
float currentisp = engine.realIsp;
Expand Down
16 changes: 15 additions & 1 deletion BeamedPowerPropulsion/ThermalEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public void Start()
Debug.LogError(("BeamedPowerPropulsion.ThermalEngine : ModuleEnginesFX not found on part-" + this.part.partName));
}
receiver = new ReceivedPower();
engine.throttleResponseRate /= 5;
Fields["CoreTemp"].guiUnits = "K/" + maxCoreTemp.ToString() + "K";
Fields["SkinTemp"].guiUnits = "K/" + maxSkinTemp.ToString() + "K";

Expand Down Expand Up @@ -173,6 +172,18 @@ private void AddHeatToReceiverCore()
this.part.AddSkinThermalFlux(heatExcess * 0.4); // waste heat from receiver + waste heat from engine
}

private void LockGimbal()
{
if (this.part.Modules.Contains<ModuleGimbal>() && engine.GetCurrentThrust() < 1f)
{
this.part.Modules.GetModule<ModuleGimbal>().gimbalActive = false;
}
else if (this.part.Modules.Contains<ModuleGimbal>() && engine.GetCurrentThrust() > 1f)
{
this.part.Modules.GetModule<ModuleGimbal>().gimbalActive = true;
}
}

public void FixedUpdate()
{
if (HighLogic.LoadedSceneIsFlight)
Expand Down Expand Up @@ -215,6 +226,8 @@ public void FixedUpdate()
{
engine.thrustPercentage = 0f;
}

LockGimbal();
}
}

Expand Down Expand Up @@ -265,6 +278,7 @@ public void Update()
else if (HighLogic.LoadedSceneIsFlight)
{
engine.thrustPercentage = Mathf.Clamp((float)Math.Round(percentThrust * 100, 2), 0f, 100f);
LockGimbal();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ReceivedPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void Directional(Part thisPart, int counter, bool Listening, float percen
}

receivedpower *= relativistic.RedOrBlueShift(VesselList[counter], thisPart.vessel, state, out state);
if (useFacingVector && FractionalFlux(source, dest, thisPart) > 0)
if (useFacingVector)
{
receivedpower *= FractionalFlux(source, dest, thisPart);
}
Expand Down

0 comments on commit e8c5807

Please sign in to comment.