Skip to content

Commit

Permalink
Merge pull request #33 from Falki-git/dev
Browse files Browse the repository at this point in the history
Fix UniversalTime entries for KSP2 0.1.4
  • Loading branch information
Falki-git authored Sep 1, 2023
2 parents d2e8cc2 + ea55437 commit bf1695f
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 19 deletions.
4 changes: 2 additions & 2 deletions MicroEngineerProject/MicroEngineer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BepInEx.BaseLib" Version="5.4.21" Publicize="true" />
<PackageReference Include="SpaceWarp" Version="1.4.0"/>
<PackageReference Include="KerbalSpaceProgram2.GameLibs" Version="0.1.3" PrivateAssets="all"/>
<PackageReference Include="SpaceWarp" Version="1.4.0" />
<PackageReference Include="KerbalSpaceProgram2.GameLibs" Version="0.1.4" PrivateAssets="all" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="echo Killing task KSP2_x64.exe&#xD;&#xA;taskkill /f /fi &quot;pid gt 0&quot; /im KSP2_x64.exe&#xD;&#xA;&#xD;&#xA;echo Copying output .dll&#xD;&#xA;xcopy /y &quot;$(TargetDir)$(ProjectName).dll&quot; &quot;$(KSP2DIR)\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;&#xD;&#xA;echo Copying output .pdb&#xD;&#xA;xcopy /y &quot;$(TargetDir)$(ProjectName).pdb&quot; &quot;$(KSP2DIR)\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;&#xD;&#xA;echo Starting KSP2_x64.exe&#xD;&#xA;powershell &quot;start-process &quot;&quot;$(KSP2DIR)\KSP2_x64.exe&quot;&quot;&quot;" />
Expand Down
12 changes: 1 addition & 11 deletions MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,5 @@ public virtual string UnitDisplay
}

public virtual void RefreshData() { }
}

public class AltUnit
{
[JsonProperty]
public bool IsActive;
[JsonProperty]
public string Unit;
[JsonProperty]
public float Factor;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public TimeToNode()
public override void RefreshData()
{
List<ManeuverNodeData> nodes = Utility.ActiveVessel?.SimulationObject?.FindComponent<ManeuverPlanComponent>()?.GetNodes();
EntryValue = nodes?.ElementAtOrDefault(base.SelectedNodeIndex)?.Time - GameManager.Instance.Game.UniverseModel.UniversalTime;
EntryValue = nodes?.ElementAtOrDefault(base.SelectedNodeIndex)?.Time - Utility.UniversalTime;
}
}

Expand Down
3 changes: 2 additions & 1 deletion MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ public SoiTransition()
{
Name = "SOI trans.";
Description = "Shows the amount of time it will take to transition to another Sphere Of Influence.";
EntryType = EntryType.Time;
Category = MicroEntryCategory.Orbital;
IsDefault = false;
BaseUnit = "s";
Expand All @@ -498,7 +499,7 @@ public SoiTransition()

public override void RefreshData()
{
EntryValue = Utility.ActiveVessel.Orbit.UniversalTimeAtSoiEncounter - GameManager.Instance.Game.UniverseModel.UniversalTime;
EntryValue = Utility.ActiveVessel.Orbit.UniversalTimeAtSoiEncounter - Utility.UniversalTime;
}
}
}
2 changes: 1 addition & 1 deletion MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace MicroMod
{
[BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.3.0")]
[BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.3.1")]
[BepInDependency(SpaceWarpPlugin.ModGuid, SpaceWarpPlugin.ModVer)]
public class MicroEngineerMod : BaseSpaceWarpPlugin
{
Expand Down
17 changes: 17 additions & 0 deletions MicroEngineerProject/MicroEngineer/Utilities/AltUnit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Newtonsoft.Json;

namespace MicroMod
{
/// <summary>
/// An alternative unit, activated by double-clicking the entry
/// </summary>
public class AltUnit
{
[JsonProperty]
public bool IsActive;
[JsonProperty]
public string Unit;
[JsonProperty]
public float Factor;
}
}
2 changes: 1 addition & 1 deletion MicroEngineerProject/MicroEngineer/Utilities/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class Utility
public static GameStateConfiguration GameState;
public static MessageCenter MessageCenter;
public static VesselDeltaVComponent VesselDeltaVComponentOAB;
public static double UniversalTime => GameManager.Instance.Game.UniverseModel.UniversalTime;
public static double UniversalTime => GameManager.Instance.Game.UniverseModel.UniverseTime;

/// <summary>
/// Refreshes the ActiveVessel and CurrentManeuver
Expand Down
4 changes: 2 additions & 2 deletions Staging/BepInEx/plugins/micro_engineer/swinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Micro Engineer",
"description": "Get in-flight and VAB information about your current vessel",
"source": "https://github.com/Micrologist/MicroEngineer",
"version": "1.3.0",
"version": "1.3.1",
"version_check": "https://raw.githubusercontent.com/Micrologist/MicroEngineer/main/Staging/BepInEx/plugins/micro_engineer/swinfo.json",
"dependencies": [
{
Expand All @@ -24,7 +24,7 @@
}
],
"ksp2_version": {
"min": "0.1.0",
"min": "0.1.4",
"max": "*"
}
}

0 comments on commit bf1695f

Please sign in to comment.