From 34be3ed82a3a324178115d2f65090ef3c473a28d Mon Sep 17 00:00:00 2001 From: Jonathan Bayer Date: Wed, 7 Apr 2021 11:35:11 -0400 Subject: [PATCH] Added ability to start follow while in water Fixed issue of kerbals not moving in new KSP version 1.11.2 --- Changelog.txt | 4 ++ EvaFollower.version | 4 +- GameData/EvaFollower/EvaFollower.version | 4 +- Source/AssemblyVersion.cs | 2 +- Source/ControlTypes/EvaPatrol.cs | 4 +- Source/EvaContainer.cs | 24 ++++++++--- Source/EvaFollower.csproj | 28 +++++++----- Source/EvaLogic.cs | 54 +++++++++++++++--------- Source/EvaModule.cs | 2 +- deploy.bat | 10 ++++- 10 files changed, 90 insertions(+), 46 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 1fb7f6b..4df281a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Changelog +1.1.1.12 + Added ability to start follow while in water + Fixed issue of kerbals not moving in new KSP version 1.11.2 + 1.1.1.11 Added missing kerbal part kerbalEVAfemaleFuture diff --git a/EvaFollower.version b/EvaFollower.version index 6379b9d..7ad1b1d 100644 --- a/EvaFollower.version +++ b/EvaFollower.version @@ -10,7 +10,7 @@ "MAJOR": 1, "MINOR": 1, "PATCH": 1, - "BUILD": 11 + "BUILD": 12 }, "KSP_VERSION": { "MAJOR": 1, @@ -19,7 +19,7 @@ }, "KSP_VERSION_MIN": { "MAJOR": 1, - "MINOR": 8, + "MINOR": 11, "PATCH": 0 } } diff --git a/GameData/EvaFollower/EvaFollower.version b/GameData/EvaFollower/EvaFollower.version index f3c864a..c0a14ff 100644 --- a/GameData/EvaFollower/EvaFollower.version +++ b/GameData/EvaFollower/EvaFollower.version @@ -10,7 +10,7 @@ "MAJOR": 1, "MINOR": 1, "PATCH": 1, - "BUILD": 10 + "BUILD": 11 }, "KSP_VERSION": { "MAJOR": 1, @@ -19,7 +19,7 @@ }, "KSP_VERSION_MIN": { "MAJOR": 1, - "MINOR": 8, + "MINOR": 11, "PATCH": 0 } } diff --git a/Source/AssemblyVersion.cs b/Source/AssemblyVersion.cs index e096747..dd42fbd 100644 --- a/Source/AssemblyVersion.cs +++ b/Source/AssemblyVersion.cs @@ -5,4 +5,4 @@ using System.Reflection; - [assembly: AssemblyVersion("1.1.1.10")] + [assembly: AssemblyVersion("1.1.1.11")] diff --git a/Source/ControlTypes/EvaPatrol.cs b/Source/ControlTypes/EvaPatrol.cs index aba2c0b..4a1a262 100644 --- a/Source/ControlTypes/EvaPatrol.cs +++ b/Source/ControlTypes/EvaPatrol.cs @@ -174,7 +174,7 @@ public void GenerateLine() { lineRenderer.positionCount = actions.Count+1; - for (int i = 0; i < actions.Count; i++) + for (int i = 0; i < actions.Count - 1; i++) { lineRenderer.SetPosition(i, Util.GetWorldPos3DLoad(actions[i].position)); } @@ -192,7 +192,7 @@ private void setLine(Vector3d position) public EvaPatrol() { - if (EvaSettings.displayDebugLines) + //if (EvaSettings.displayDebugLines) // disabled since this option can be enabled during the game { lineRenderer = new GameObject().AddComponent(); diff --git a/Source/EvaContainer.cs b/Source/EvaContainer.cs index 611e406..c53fcc5 100644 --- a/Source/EvaContainer.cs +++ b/Source/EvaContainer.cs @@ -1,5 +1,6 @@ using System; using UnityEngine; +using System.Reflection; namespace MSD.EvaFollower { @@ -49,7 +50,6 @@ public bool AllowPatrol public bool AllowRunning { get { - if (mode == Mode.Patrol) { return patrol.AllowRunning; @@ -105,10 +105,13 @@ public bool Loaded public bool OnALadder { get { return eva.OnALadder; } } + MethodInfo removeRBAnchor = null; + public EvaContainer(Guid flightID) { this.flightID = flightID; this.loaded = false; + removeRBAnchor = typeof(KerbalEVA).GetMethod("RemoveRBAnchor", BindingFlags.NonPublic | BindingFlags.Instance); } public void Load(KerbalEVA eva) @@ -375,8 +378,9 @@ private bool AbleToMove() { Rigidbody rigidbody = null; eva.GetComponentCached(ref rigidbody); - return (!eva.isEnabled) | (!eva.isRagdoll) | (!rigidbody.isKinematic); + return (!eva.isEnabled) | (!eva.isRagdoll) | (!rigidbody.isKinematic); } + /// /// Move the current kerbal to target. /// @@ -409,13 +413,21 @@ internal void Move(Vector3d move, float speed) eva.GetComponentCached(ref rigidbody); //move - if(rigidbody != null){ - rigidbody.MovePosition(rigidbody.position + move); - } + if(rigidbody != null) + { + RemoveRBAnchor(eva); + rigidbody.MovePosition(rigidbody.position + move); + } } } - #endregion +#endregion + } + + void RemoveRBAnchor(KerbalEVA eva) + { + if (removeRBAnchor != null) + removeRBAnchor.Invoke(eva, null); //, parametersArray); } internal void CheckModeIsNone() diff --git a/Source/EvaFollower.csproj b/Source/EvaFollower.csproj index 2bd3831..89328c5 100644 --- a/Source/EvaFollower.csproj +++ b/Source/EvaFollower.csproj @@ -16,7 +16,7 @@ true - full + portable false bin\Debug\ DEBUG;TRACE @@ -71,25 +71,31 @@ - start /D D:\Users\jbb\github\EvaFollower /WAIT deploy.bat $(TargetDir) $(TargetFileName) + +set KSPDIR=$(KSPDIR) +IF "%25KSPDIR%25"=="" ( + ECHO Configuration error - KSPDIR not specified in project. -if $(ConfigurationName) == Release ( + ECHO Either set KSPDIR environment variable or edit BetterLoadSaveGame.Common.props + PAUSE - start /D D:\Users\jbb\github\EvaFollower /WAIT buildRelease.bat $(TargetDir) $(TargetFileName) + GOTO DONE +) -) - - - -set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE\texttransform.exe" +start /D $(SolutionDir) /WAIT deploy.bat $(TargetDir) $(TargetFileName) $(TargetName) +if $(ConfigurationName) == Release ( + start /D $(SolutionDir) /WAIT buildRelease.bat $(TargetDir) $(TargetFileName) $(TargetName) -%25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion.tt +) + + + "$(DevEnvDir)\texttransform.exe" "$(ProjectDir)AssemblyVersion.tt"