Skip to content

Commit

Permalink
7.3 Pre - 1.2 Compatibility Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BobPalmer committed Sep 14, 2016
1 parent 2c761e9 commit 632e3cd
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 61 deletions.
15 changes: 6 additions & 9 deletions Firespitter/Firespitter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\..\..\KSP_DEV\GameData\Firespitter\Plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand All @@ -33,25 +33,21 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\KSP_DEV\KSP_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Assembly-CSharp-firstpass, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\KSP_DEV\KSP_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="KSPUtil">
<HintPath>..\..\..\KSP_DEV\KSP_Data\Managed\KSPUtil.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, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="UnityEngine">
<HintPath>..\..\..\KSP_DEV\KSP_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
Expand Down Expand Up @@ -157,7 +153,8 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy Firespitter.dll D:\Dropbox\KSP_DEV\GameData\Firespitter\Plugins</PostBuildEvent>
<PostBuildEvent>"D:\Games\pdb2mdb\pdb2mdb.exe" "$(TargetFileName)"
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
2 changes: 1 addition & 1 deletion Firespitter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 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("7.1.*")]
[assembly: AssemblyVersion("7.3.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
4 changes: 2 additions & 2 deletions Firespitter/aero/FSwingBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public virtual bool isMaster()
private Vector3 ctrllSrfDefRot = new Vector3();
private Vector3 flapDefRot = new Vector3();

private ControlSurface stockWingModule;
private ModuleControlSurface stockWingModule;
private FSliftSurface mainLift;
private float mainLiftAreaDefault;

Expand Down Expand Up @@ -475,7 +475,7 @@ public override void OnStart(PartModule.StartState state)
if (affectStockWingModule)
{
//Debug.Log("FSwing: getting stock wing module");
stockWingModule = part as ControlSurface;
stockWingModule = part.FindModuleImplementing<ModuleControlSurface>();
if (stockWingModule != null)
{
//Debug.Log("FSwing: success");
Expand Down
4 changes: 2 additions & 2 deletions Firespitter/aero/FSwingletRangeAdjustment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public class FSwingletRangeAdjustment : PartModule
{
private float defaultRange;
ControlSurface winglet = new ControlSurface();
ModuleControlSurface winglet = new ModuleControlSurface();
private bool FARActive = false;

[KSPField]
Expand Down Expand Up @@ -115,7 +115,7 @@ public override void OnStart(PartModule.StartState state)
else
{
//winglet = part.Modules.OfType<ControlSurface>().FirstOrDefault();
winglet = part as ControlSurface;
winglet = part.FindModuleImplementing<ModuleControlSurface>();
defaultRange = winglet.ctrlSurfaceRange;
if (!currentControlRangeSet)
{
Expand Down
8 changes: 5 additions & 3 deletions Firespitter/cockpit/FSfuelGauge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ private void getResourceList()
resourceList.Clear();
vesselNumParts = vessel.Parts.Count;
foreach (Part part in vessel.parts)
{
foreach (PartResource resource in part.Resources)
{
{
var rCount = part.Resources.Count;
for (int i = 0; 0 < rCount; ++i)
{
var resource = part.Resources[i];
if (resource.resourceName == resourceName)
{
resourceList.Add(resource);
Expand Down
4 changes: 3 additions & 1 deletion Firespitter/cockpit/FSmonitorInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ private void getResourceList()
vesselNumParts = vessel.Parts.Count;
foreach (Part part in vessel.parts)
{
foreach (PartResource resource in part.Resources)
var rCount = part.Resources.Count;
for (int i = 0; 0 < rCount; ++i)
{
var resource = part.Resources[i];
if (!resourceDictionary.ContainsKey(resource.resourceName))
{
resourceDictionary.Add(resource.resourceName, new Vector2d(resource.amount, resource.maxAmount));
Expand Down
12 changes: 6 additions & 6 deletions Firespitter/customization/FSfuelSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ private void assignResourcesToPart(bool calledByPlayer)

private void setupTankInPart(Part currentPart, bool calledByPlayer)
{
currentPart.Resources.list.Clear();
currentPart.Resources.dict = new DictionaryValueList<int, PartResource>();
PartResource[] partResources = currentPart.GetComponents<PartResource>();
for (int i = 0; i < partResources.Length; i++)
{
DestroyImmediate(partResources[i]);
}
//for (int i = 0; i < partResources.Length; i++)
//{
// DestroyImmediate(partResources[i]);
//}

for (int tankCount = 0; tankCount < tankList.Count; tankCount++)
{
Expand Down Expand Up @@ -220,7 +220,7 @@ private void setupTankInPart(Part currentPart, bool calledByPlayer)
}
}
}
currentPart.Resources.UpdateList();

updateWeight(currentPart, selectedTankSetup);
updateCost();
}
Expand Down
62 changes: 31 additions & 31 deletions Firespitter/tools/FSversionCheck.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
using UnityEngine;
using System.Reflection;

[KSPAddon(KSPAddon.Startup.MainMenu, true)]
public class FSversionCheck : MonoBehaviour
{
static int CompatibleWithMajor = 1;
static int CompatibleWithMinor = 0;
static int CompatibleWithRevision = 5;
static System.Version FSversion;
//[KSPAddon(KSPAddon.Startup.MainMenu, true)]
//public class FSversionCheck : MonoBehaviour
//{
// static int CompatibleWithMajor = 1;
// static int CompatibleWithMinor = 0;
// static int CompatibleWithRevision = 5;
// static System.Version FSversion;

public void Start()
{
FSversion = Assembly.GetExecutingAssembly().GetName().Version;
Debug.Log("firespitter.dll version: " + FSversion.ToString() + ", compiled for KSP " + CompatibleWithMajor + "." + CompatibleWithMinor + "." + CompatibleWithRevision);
}
// public void Start()
// {
// FSversion = Assembly.GetExecutingAssembly().GetName().Version;
// Debug.Log("firespitter.dll version: " + FSversion.ToString() + ", compiled for KSP " + CompatibleWithMajor + "." + CompatibleWithMinor + "." + CompatibleWithRevision);
// }

public static bool IsCompatible()
{
// public static bool IsCompatible()
// {

if (Versioning.version_major != CompatibleWithMajor
||
Versioning.version_minor != CompatibleWithMinor
||
Versioning.Revision != CompatibleWithRevision)
{
//warnPlayer();
return false;
}
else
return true;
}
// if (Versioning.version_major != CompatibleWithMajor
// ||
// Versioning.version_minor != CompatibleWithMinor
// ||
// Versioning.Revision != CompatibleWithRevision)
// {
// //warnPlayer();
// return false;
// }
// else
// return true;
// }

internal static bool IsUnityCompatible()
{
return true;
}
}
// internal static bool IsUnityCompatible()
// {
// return true;
// }
//}
16 changes: 10 additions & 6 deletions Firespitter/wheel/FSexternalLandingGearControl.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

using ModuleWheels;

public class FSexternalLandingGearControl : PartModule
{
private ModuleLandingGear gear;
private ModuleWheelDeployment gear;
private ModuleWheelBrakes brakes;

public override void OnStart(PartModule.StartState state)
{
base.OnStart(state);
gear = part.GetComponent<ModuleLandingGear>();
gear = part.GetComponent<ModuleWheelDeployment>();
brakes = part.GetComponent<ModuleWheelBrakes>();
if (gear != null)
{
gear.Events["LowerLandingGear"].guiActiveUnfocused = true;
Expand All @@ -19,18 +23,18 @@ public override void OnStart(PartModule.StartState state)
[KSPEvent(name = "brakesOn", guiActive = true, active = true, guiName = "Brakes On", externalToEVAOnly = true, unfocusedRange = 6f, guiActiveUnfocused = true)]
public void brakesOnEvent()
{
if (gear != null)
if (gear != null && brakes != null)
{
gear.brakesEngaged = true;
brakes.BrakeAction(new KSPActionParam(KSPActionGroup.Brakes, KSPActionType.Activate));
}
}

[KSPEvent(name = "brakesOff", guiActive = true, active = true, guiName = "Brakes Off", externalToEVAOnly = true, unfocusedRange = 6f, guiActiveUnfocused = true)]
public void brakesOffEvent()
{
if (gear != null)
if (gear != null && brakes != null)
{
gear.brakesEngaged = false;
brakes.BrakeAction(new KSPActionParam(KSPActionGroup.Brakes, KSPActionType.Deactivate));
}
}

Expand Down

0 comments on commit 632e3cd

Please sign in to comment.