Skip to content

Commit

Permalink
V1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodrigv committed Apr 2, 2017
1 parent 10b357f commit 9ee05ca
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
= v1.1.0
- Extending to 2000km. Compiled for KSP 1.2.9
= v1.0.0
- Release
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"CHANGE_LOG_URL":"https://github.com/jrodrigv/PhysicsRangeExtender/raw/master/PhysicsRangeExtender/Distribution/GameData/PhysicsRangeExtender/ChangeLog.txt",
"VERSION": {
"MAJOR": 1,
"MINOR": 0,
"MINOR": 1,
"PATCH": 0
},
"KSP_VERSION": {
Expand Down
Binary file not shown.
29 changes: 15 additions & 14 deletions PhysicsRangeExtender/PhysicsRangeExtender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ namespace PhysicsRangeExtender
[KSPAddon(KSPAddon.Startup.FlightAndKSC, false)]
public class PhysicsRangeExtender : MonoBehaviour
{
private readonly VesselRanges.Situation _maxSituation = new VesselRanges.Situation(181000, 190000, 200000, 172900);
private const int RangeInKm = 2000;
private readonly VesselRanges.Situation _maxSituation = new VesselRanges.Situation(RangeInKm * 1000 - 15, RangeInKm * 1000 - 10, RangeInKm*1000, RangeInKm * 1000 - 20);

void Start()
{
FloatingOrigin.fetch.threshold = Mathf.Pow(200000 + 3500, 2);
FloatingOrigin.fetch.threshold = Mathf.Pow(RangeInKm * 1000 + 3500, 2);

GameEvents.onVesselSwitching.Add(ApplyPhysRange);
GameEvents.onVesselCreate.Add(ApplyPhysRange);
GameEvents.onVesselGoOnRails.Add(ApplyPhysRange);
GameEvents.onVesselGoOffRails.Add(ApplyPhysRange);
GameEvents.onVesselLoaded.Add(ApplyPhysRange);
GameEvents.onVesselSwitchingToUnloaded.Add(ApplyPhysRange);

ApplyPhysRange();

Expand All @@ -36,18 +38,17 @@ public void ApplyPhysRange()
{
try
{
foreach (var v in FlightGlobals.Vessels)
v.vesselRanges = new VesselRanges(new VesselRanges
{
escaping = _maxSituation,
flying = _maxSituation,
landed = _maxSituation,
orbit = _maxSituation,
prelaunch = _maxSituation,
splashed = _maxSituation,
subOrbital = _maxSituation
});

int vesselsCount = FlightGlobals.Vessels.Count;
for (int i = 0; i < vesselsCount; i++)
{
FlightGlobals.Vessels[i].vesselRanges.escaping = _maxSituation;
FlightGlobals.Vessels[i].vesselRanges.flying = _maxSituation;
FlightGlobals.Vessels[i].vesselRanges.landed = _maxSituation;
FlightGlobals.Vessels[i].vesselRanges.orbit = _maxSituation;
FlightGlobals.Vessels[i].vesselRanges.prelaunch = _maxSituation;
FlightGlobals.Vessels[i].vesselRanges.splashed = _maxSituation;
FlightGlobals.Vessels[i].vesselRanges.subOrbital = _maxSituation;
}
}
catch (Exception e)
{
Expand Down
12 changes: 4 additions & 8 deletions PhysicsRangeExtender/PhysicsRangeExtender.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,12 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>G:\GAMES\KERBAL\Kerbal Space Program_DEV_12\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
<HintPath>G:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>G:\GAMES\KERBAL\Kerbal Space Program_DEV_12\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>G:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion PhysicsRangeExtender/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyVersion("1.1.0")]

0 comments on commit 9ee05ca

Please sign in to comment.