Skip to content

Commit

Permalink
Added ability to start follow while in water
Browse files Browse the repository at this point in the history
 Fixed issue of kerbals not moving in new KSP version 1.11.2
  • Loading branch information
linuxgurugamer committed Apr 7, 2021
1 parent a304407 commit 34be3ed
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 46 deletions.
4 changes: 4 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions EvaFollower.version
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"MAJOR": 1,
"MINOR": 1,
"PATCH": 1,
"BUILD": 11
"BUILD": 12
},
"KSP_VERSION": {
"MAJOR": 1,
Expand All @@ -19,7 +19,7 @@
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 8,
"MINOR": 11,
"PATCH": 0
}
}
4 changes: 2 additions & 2 deletions GameData/EvaFollower/EvaFollower.version
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"MAJOR": 1,
"MINOR": 1,
"PATCH": 1,
"BUILD": 10
"BUILD": 11
},
"KSP_VERSION": {
"MAJOR": 1,
Expand All @@ -19,7 +19,7 @@
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 8,
"MINOR": 11,
"PATCH": 0
}
}
2 changes: 1 addition & 1 deletion Source/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

using System.Reflection;

[assembly: AssemblyVersion("1.1.1.10")]
[assembly: AssemblyVersion("1.1.1.11")]
4 changes: 2 additions & 2 deletions Source/ControlTypes/EvaPatrol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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<LineRenderer>();

Expand Down
24 changes: 18 additions & 6 deletions Source/EvaContainer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using UnityEngine;
using System.Reflection;

namespace MSD.EvaFollower
{
Expand Down Expand Up @@ -49,7 +50,6 @@ public bool AllowPatrol
public bool AllowRunning
{
get {

if (mode == Mode.Patrol)
{
return patrol.AllowRunning;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -375,8 +378,9 @@ private bool AbleToMove()
{
Rigidbody rigidbody = null;
eva.GetComponentCached<Rigidbody>(ref rigidbody);
return (!eva.isEnabled) | (!eva.isRagdoll) | (!rigidbody.isKinematic);
return (!eva.isEnabled) | (!eva.isRagdoll) | (!rigidbody.isKinematic);
}

/// <summary>
/// Move the current kerbal to target.
/// </summary>
Expand Down Expand Up @@ -409,13 +413,21 @@ internal void Move(Vector3d move, float speed)
eva.GetComponentCached<Rigidbody>(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()
Expand Down
28 changes: 17 additions & 11 deletions Source/EvaFollower.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
Expand Down Expand Up @@ -71,25 +71,31 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>start /D D:\Users\jbb\github\EvaFollower /WAIT deploy.bat $(TargetDir) $(TargetFileName)
<PostBuildEvent>
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

)

)</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
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</PreBuildEvent>
)</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>"$(DevEnvDir)\texttransform.exe" "$(ProjectDir)AssemblyVersion.tt"</PreBuildEvent>
</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 All @@ -114,4 +120,4 @@ set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Com
</Reference>
<Reference Include="System.Xml" />
</ItemGroup>
</Project>
</Project>
54 changes: 34 additions & 20 deletions Source/EvaLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,63 @@ namespace MSD.EvaFollower
[KSPAddon(KSPAddon.Startup.Flight, false)]
public class EvaLogic : MonoBehaviour
{
//List<IDetection> detectionSystems = new List<IDetection>();
//List<IDetection> detectionSystems = new List<IDetection>();

public EvaLogic(){
public EvaLogic()
{

//detectionSystems.Add (new DeadSpaceDetection ());
}
//detectionSystems.Add (new DeadSpaceDetection ());
}

public void Start()
{
EvaDebug.DebugWarning("EvaLogic.Start()");

GameEvents.onHideUI.Add(onHideUI);
}
bool uiHidden = false;
void onHideUI()
{
uiHidden = !uiHidden;
}
public void OnDestroy()
{
EvaDebug.DebugWarning("EvaLogic.OnDestroy()");
GameEvents.onHideUI.Remove(onHideUI);
}

public void FixedUpdate(){
// Update detection systems.
//foreach (var detection in detectionSystems) {
// detection.UpdateMap (EvaController.instance.collection);
//}
}
public void FixedUpdate()
{
// Update detection systems.
//foreach (var detection in detectionSystems) {
// detection.UpdateMap (EvaController.instance.collection);
//}
}

public void Update()
{
if (!FlightGlobals.ready || PauseMenu.isOpen)
return;

// Replace this with a check to see if GUI is hidden
if (Input.GetKeyDown(KeyCode.F2) && HighLogic.CurrentGame.Parameters.CustomParams<EvaFollowerMiscSettings>().displayDebugLinesSetting) {
EvaSettings.displayDebugLines = !EvaSettings.displayDebugLines;
foreach (EvaContainer container in EvaController.instance.collection) {
if (EvaSettings.displayDebugLines == uiHidden && HighLogic.CurrentGame.Parameters.CustomParams<EvaFollowerMiscSettings>().displayDebugLinesSetting)
{

//EvaSettings.displayDebugLines = !EvaSettings.displayDebugLines;
EvaSettings.displayDebugLines = !uiHidden;
foreach (EvaContainer container in EvaController.instance.collection)
{
container.togglePatrolLines();
}
}

if (Input.GetKeyDown (KeyCode.B)) {
foreach (EvaContainer container in EvaController.instance.collection) {
container.EVA.PackToggle ();
}
}

if (Input.GetKeyDown(KeyCode.B))
{
foreach (EvaContainer container in EvaController.instance.collection)
{
container.EVA.PackToggle();
}
}

try
{
foreach (EvaContainer eva in EvaController.instance.collection.ToArray())
Expand Down
2 changes: 1 addition & 1 deletion Source/EvaModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void SetEvents()
if (!currentContainer.Loaded)
return;

if (!currentContainer.EVA.vessel.Landed) {
if (!currentContainer.EVA.vessel.Landed && !currentContainer.EVA.vessel.Splashed) {
return;
}

Expand Down
10 changes: 9 additions & 1 deletion deploy.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

@echo off

rem H is the destination game folder
Expand All @@ -9,11 +8,20 @@ rem but not always

set H=%KSPDIR%

set H=R:\KSP_1.11.2

set GAMEDIR=EvaFollower
set GAMEDATA="GameData"
set VERSIONFILE=%GAMEDIR%.version

set DP0=r:\dp0\kspdev

copy /Y "%1%2" "%GAMEDATA%\%GAMEDIR%\Plugins"
copy /Y "%1%3".pdb "%GAMEDATA%\%GAMEDIR%\Plugins"

copy /Y %VERSIONFILE% %GAMEDATA%\%GAMEDIR%

xcopy /y /s /I %GAMEDATA%\%GAMEDIR% "%H%\GameData\%GAMEDIR%"
xcopy /y /s /I %GAMEDATA%\%GAMEDIR% "%DP0%\GameData\%GAMEDIR%"

rem pause

0 comments on commit 34be3ed

Please sign in to comment.