Skip to content

Commit

Permalink
Merge pull request #11 from Bit-Studios/feature-vessel-landed
Browse files Browse the repository at this point in the history
Added Vessel Landed State fix
  • Loading branch information
jan-bures authored Mar 13, 2023
2 parents 8a0c87c + d8c3674 commit 2858657
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 280 deletions.
279 changes: 6 additions & 273 deletions CommunityFixes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,289 +5,22 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>true</ImplicitUsings>
<RestoreAdditionalProjectSources>
https://api.nuget.org/v3/index.json;
https://nuget.bepinex.dev/v3/index.json
</RestoreAdditionalProjectSources>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>external_dlls\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>external_dlls\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="SpaceWarp">
<HintPath>external_dlls\SpaceWarp.dll</HintPath>
</Reference>
<Reference Include="Unity.Addressables">
<HintPath>external_dlls\Unity.Addressables.dll</HintPath>
</Reference>
<Reference Include="Unity.Analytics.DataPrivacy">
<HintPath>external_dlls\Unity.Analytics.DataPrivacy.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst">
<HintPath>external_dlls\Unity.Burst.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil">
<HintPath>external_dlls\Unity.Burst.Cecil.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil.Mdb">
<HintPath>external_dlls\Unity.Burst.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil.Pdb">
<HintPath>external_dlls\Unity.Burst.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Cecil.Rocks">
<HintPath>external_dlls\Unity.Burst.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="Unity.Burst.Unsafe">
<HintPath>external_dlls\Unity.Burst.Unsafe.dll</HintPath>
</Reference>
<Reference Include="Unity.Collections">
<HintPath>external_dlls\Unity.Collections.dll</HintPath>
</Reference>
<Reference Include="Unity.Collections.LowLevel.ILSupport">
<HintPath>external_dlls\Unity.Collections.LowLevel.ILSupport.dll</HintPath>
</Reference>
<Reference Include="Unity.Formats.USD.Runtime">
<HintPath>external_dlls\Unity.Formats.USD.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.InputSystem">
<HintPath>external_dlls\Unity.InputSystem.dll</HintPath>
</Reference>
<Reference Include="Unity.Jobs">
<HintPath>external_dlls\Unity.Jobs.dll</HintPath>
</Reference>
<Reference Include="Unity.Mathematics">
<HintPath>external_dlls\Unity.Mathematics.dll</HintPath>
</Reference>
<Reference Include="Unity.MemoryProfiler">
<HintPath>external_dlls\Unity.MemoryProfiler.dll</HintPath>
</Reference>
<Reference Include="Unity.Postprocessing.Runtime">
<HintPath>external_dlls\Unity.Postprocessing.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.ResourceManager">
<HintPath>external_dlls\Unity.ResourceManager.dll</HintPath>
</Reference>
<Reference Include="Unity.ScriptableBuildPipeline">
<HintPath>external_dlls\Unity.ScriptableBuildPipeline.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>external_dlls\Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="Unity.Timeline">
<HintPath>external_dlls\Unity.Timeline.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>external_dlls\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AccessibilityModule">
<HintPath>external_dlls\UnityEngine.AccessibilityModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AIModule">
<HintPath>external_dlls\UnityEngine.AIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AndroidJNIModule">
<HintPath>external_dlls\UnityEngine.AndroidJNIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<HintPath>external_dlls\UnityEngine.AnimationModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ARModule">
<HintPath>external_dlls\UnityEngine.ARModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>external_dlls\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<HintPath>external_dlls\UnityEngine.AudioModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ClothModule">
<HintPath>external_dlls\UnityEngine.ClothModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ClusterInputModule">
<HintPath>external_dlls\UnityEngine.ClusterInputModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ClusterRendererModule">
<HintPath>external_dlls\UnityEngine.ClusterRendererModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>external_dlls\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CrashReportingModule">
<HintPath>external_dlls\UnityEngine.CrashReportingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.DirectorModule">
<HintPath>external_dlls\UnityEngine.DirectorModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.DSPGraphModule">
<HintPath>external_dlls\UnityEngine.DSPGraphModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.GameCenterModule">
<HintPath>external_dlls\UnityEngine.GameCenterModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.GIModule">
<HintPath>external_dlls\UnityEngine.GIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.GridModule">
<HintPath>external_dlls\UnityEngine.GridModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.HotReloadModule">
<HintPath>external_dlls\UnityEngine.HotReloadModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule">
<HintPath>external_dlls\UnityEngine.ImageConversionModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>external_dlls\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>external_dlls\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputModule">
<HintPath>external_dlls\UnityEngine.InputModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.JSONSerializeModule">
<HintPath>external_dlls\UnityEngine.JSONSerializeModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.LocalizationModule">
<HintPath>external_dlls\UnityEngine.LocalizationModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ParticleSystemModule">
<HintPath>external_dlls\UnityEngine.ParticleSystemModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PerformanceReportingModule">
<HintPath>external_dlls\UnityEngine.PerformanceReportingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Physics2DModule">
<HintPath>external_dlls\UnityEngine.Physics2DModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>external_dlls\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ProfilerModule">
<HintPath>external_dlls\UnityEngine.ProfilerModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule">
<HintPath>external_dlls\UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ScreenCaptureModule">
<HintPath>external_dlls\UnityEngine.ScreenCaptureModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.SharedInternalsModule">
<HintPath>external_dlls\UnityEngine.SharedInternalsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.SpatialTracking">
<HintPath>external_dlls\UnityEngine.SpatialTracking.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.SpriteMaskModule">
<HintPath>external_dlls\UnityEngine.SpriteMaskModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.SpriteShapeModule">
<HintPath>external_dlls\UnityEngine.SpriteShapeModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.StreamingModule">
<HintPath>external_dlls\UnityEngine.StreamingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.SubstanceModule">
<HintPath>external_dlls\UnityEngine.SubstanceModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.SubsystemsModule">
<HintPath>external_dlls\UnityEngine.SubsystemsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TerrainModule">
<HintPath>external_dlls\UnityEngine.TerrainModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TerrainPhysicsModule">
<HintPath>external_dlls\UnityEngine.TerrainPhysicsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TestRunner">
<HintPath>external_dlls\UnityEngine.TestRunner.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextCoreModule">
<HintPath>external_dlls\UnityEngine.TextCoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>external_dlls\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TilemapModule">
<HintPath>external_dlls\UnityEngine.TilemapModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TLSModule">
<HintPath>external_dlls\UnityEngine.TLSModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>external_dlls\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIElementsModule">
<HintPath>external_dlls\UnityEngine.UIElementsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIElementsNativeModule">
<HintPath>external_dlls\UnityEngine.UIElementsNativeModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>external_dlls\UnityEngine.UIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UmbraModule">
<HintPath>external_dlls\UnityEngine.UmbraModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UNETModule">
<HintPath>external_dlls\UnityEngine.UNETModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityAnalyticsModule">
<HintPath>external_dlls\UnityEngine.UnityAnalyticsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityConnectModule">
<HintPath>external_dlls\UnityEngine.UnityConnectModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityCurlModule">
<HintPath>external_dlls\UnityEngine.UnityCurlModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityTestProtocolModule">
<HintPath>external_dlls\UnityEngine.UnityTestProtocolModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestAssetBundleModule">
<HintPath>external_dlls\UnityEngine.UnityWebRequestAssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestAudioModule">
<HintPath>external_dlls\UnityEngine.UnityWebRequestAudioModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestModule">
<HintPath>external_dlls\UnityEngine.UnityWebRequestModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestTextureModule">
<HintPath>external_dlls\UnityEngine.UnityWebRequestTextureModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestWWWModule">
<HintPath>external_dlls\UnityEngine.UnityWebRequestWWWModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VehiclesModule">
<HintPath>external_dlls\UnityEngine.VehiclesModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VFXModule">
<HintPath>external_dlls\UnityEngine.VFXModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VideoModule">
<HintPath>external_dlls\UnityEngine.VideoModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VirtualTexturingModule">
<HintPath>external_dlls\UnityEngine.VirtualTexturingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VRModule">
<HintPath>external_dlls\UnityEngine.VRModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.WindModule">
<HintPath>external_dlls\UnityEngine.WindModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.XR.LegacyInputHelpers">
<HintPath>external_dlls\UnityEngine.XR.LegacyInputHelpers.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.XRModule">
<HintPath>external_dlls\UnityEngine.XRModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BepInEx.BaseLib" Version="5.4.21" />
<PackageReference Include="HarmonyX" Version="2.10.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="SpaceWarp" Version="0.4.0" />
<PackageReference Include="UnityEngine.Modules" Version="2020.3.33" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy /y &quot;$(TargetPath)&quot; &quot;$(ProjectDir)\dist\community_fixes\&quot;&#xA;xcopy /y &quot;$(ProjectDir)\swinfo.json&quot; &quot;$(ProjectDir)\dist\community_fixes\&quot;&#xA;xcopy /y &quot;$(ProjectDir)\license&quot; &quot;$(ProjectDir)\dist\community_fixes\&quot;&#xA;echo f | xcopy /y &quot;$(ProjectDir)\README.md&quot; &quot;$(ProjectDir)\dist\community_fixes\README.txt&quot;&#xA;" />
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ This project aims to bring together community bug fixes for Kerbal Space Program

## Compatibility
- Tested with Kerbal Space Program 2 v0.1.0.0.20892
- Requires **[SpaceWarp 0.4+](https://github.com/SpaceWarpDev/SpaceWarp/releases/tag/spacewarp-0.4.0)**
- Requires **[SpaceWarp 0.4+](https://github.com/SpaceWarpDev/SpaceWarp/releases/)**

## Implemented fixes
- **Separation CommNet Fix** by [munix](https://github.com/jan-bures) - Fixes CommNet disconnecting after separating two controllable vessels.
- **Sticky Orbit Markers** by [munix](https://github.com/jan-bures) - Makes Ap/Pe and other orbit markers stay pinned when plotting a maneuver.
- **KSP 2 Save Fix** by [jayouimet](https://github.com/jayouimet) - Replaces the Control Owner Part to the first available Command module or to the Root part if not found when it is set to null.
- **Vessel Landed State Fix*** by [munix](https://github.com/jan-bures) - Checks if the vessel's state is Landed when not actually near the ground and resets it.

_*This fix is experimental and untested for now - if you are experiencing the bug with its fix enabled, please create an issue [here](https://github.com/Bit-Studios/CommunityFixes/issues)._

## Planned fixes
To see what fixes are planned to be implemented, you can visit the [Issues page](https://github.com/Bit-Studios/CommunityFixes/issues) on the project's GitHub.
Expand Down
10 changes: 5 additions & 5 deletions src/CommunityFixesMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ public class CommunityFixesMod : BaseSpaceWarpPlugin
{
public const string ModGuid = "com.github.communityfixes";
public const string ModName = "Community Fixes";
public const string ModVer = "0.1.0";
public const string ModVer = "0.3.0";

private static readonly Assembly _assembly = typeof(CommunityFixesMod).Assembly;
private static readonly Assembly Assembly = typeof(CommunityFixesMod).Assembly;
private CommunityFixesConfig _config;

public override void OnInitialized()
{
Type[] types;
try
{
types = _assembly.GetTypes();
types = Assembly.GetTypes();
}
catch (Exception ex)
{
Expand Down Expand Up @@ -53,7 +53,7 @@ public override void OnInitialized()
Logger.LogInfo($"{ModName} finished loading.");
}

internal bool LoadFix(Type type)
private bool LoadFix(Type type)
{
var fixName = GetFixName(type);

Expand All @@ -72,7 +72,7 @@ internal bool LoadFix(Type type)
}
else
{
fix = _assembly.CreateInstance(type.FullName!) as IFix;
fix = Assembly.CreateInstance(type.FullName!) as IFix;
}

if (fix == null)
Expand Down
16 changes: 16 additions & 0 deletions src/Fix/VesselLandedState/VesselLandedStateFix.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using KSP.Sim.impl;

namespace CommunityFixes.Fix.VesselLandedState;

[Fix("Vessel Landed State")]
public class VesselLandedStateFix: BaseFix
{
private void LateUpdate()
{
var vessel = Game.ViewController.GetActiveSimVessel();
if (vessel != null && vessel.Situation == VesselSituations.Landed && vessel.AltitudeFromTerrain > 50)
{
vessel.Landed = false;
}
}
}
2 changes: 1 addition & 1 deletion swinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Community Fixes",
"description": "Community project that aims to bring together bug fixes for KSP 2.",
"source": "https://github.com/Bit-Studios/CommunityFixes",
"version": "0.1.0",
"version": "0.3.0",
"dependencies": [],
"ksp2_version": {
"min": "0.1.0",
Expand Down

0 comments on commit 2858657

Please sign in to comment.