Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
Version 0.9.9.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Real-Gecko committed Sep 29, 2016
1 parent 958a66f commit 9f3eaa3
Show file tree
Hide file tree
Showing 12 changed files with 444 additions and 338 deletions.
23 changes: 23 additions & 0 deletions BonVoyage.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@PART[Malemute_RoverCab]
{
MODULE
{
name = BonVoyageModule
}
}

@PART[KER_RoverCab]
{
MODULE
{
name = BonVoyageModule
}
}

@PART[WBI_BuffaloCab]
{
MODULE
{
name = BonVoyageModule
}
}
44 changes: 27 additions & 17 deletions BonVoyage.sln
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BonVoyage", "BonVoyage\BonVoyage.csproj", "{05CFDB95-994A-4C5D-9840-C6D1A86918C2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{05CFDB95-994A-4C5D-9840-C6D1A86918C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05CFDB95-994A-4C5D-9840-C6D1A86918C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05CFDB95-994A-4C5D-9840-C6D1A86918C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05CFDB95-994A-4C5D-9840-C6D1A86918C2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BonVoyage", "BonVoyage\BonVoyage.csproj", "{05CFDB95-994A-4C5D-9840-C6D1A86918C2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{05CFDB95-994A-4C5D-9840-C6D1A86918C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05CFDB95-994A-4C5D-9840-C6D1A86918C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05CFDB95-994A-4C5D-9840-C6D1A86918C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05CFDB95-994A-4C5D-9840-C6D1A86918C2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.TextStylePolicy = $1
$1.FileWidth = 120
$1.TabsToSpaces = False
$1.EolMarker = Unix
$1.inheritsSet = VisualStudio
$1.inheritsScope = text/plain
$1.scope = text/plain
EndGlobalSection
EndGlobal
81 changes: 69 additions & 12 deletions BonVoyage/ActiveRover.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,79 @@
using System;
using System.Collections.Generic;

namespace BonVoyage
{
public class ActiveRover
{
public string name;
public string bodyName;
public class ActiveRover {
public struct WayPoint {
public double latitude;
public double longitude;
public WayPoint(double lat, double lon) {
latitude = lat;
longitude = lon;
}
}

public string status;
public double toTravel;
public MapObject mapObject;

public Vessel vessel;
public ConfigNode vesselConfigNode;
public double lastTime;
public double targetLatitude;
public double targetLongitude;
public double averageSpeed;
public ActiveRover (string name, string bodyName, string status, double toTravel, MapObject mapObject)
{
this.name = name;
this.bodyName = bodyName;
this.status = status;
this.toTravel = toTravel;
this.mapObject = mapObject;
public double distanceTravelled;
public double distanceToTarget;
public bool solarPowered;
public bool bvActive;
public ConfigNode BVModule;
public List<WayPoint> path;
public ActiveRover(Vessel v) {
vessel = v;

vesselConfigNode = new ConfigNode ();
vessel.protoVessel.Save (vesselConfigNode);

// This is annoying
var BVPart = vesselConfigNode.GetNode ("PART", "name", "BonVoyageModule");
if (BVPart == null)
BVPart = vesselConfigNode.GetNode ("PART", "name", "Malemute.RoverCab");
if (BVPart == null)
BVPart = vesselConfigNode.GetNode ("PART", "name", "KER.RoverCab");
if (BVPart == null)
BVPart = vesselConfigNode.GetNode ("PART", "name", "WBI.BuffaloCab");
if (BVPart == null)
return;

BVModule = BVPart.GetNode ("MODULE", "name", "BonVoyageModule");
if (BVModule == null)
return;

bvActive = bool.Parse (BVModule.GetValue ("isActive"));

lastTime = double.Parse (BVModule.GetValue ("lastTime"));
distanceTravelled = double.Parse (BVModule.GetValue ("distanceTravelled"));
distanceToTarget = double.Parse (BVModule.GetValue ("distanceToTarget"));
solarPowered = bool.Parse (BVModule.GetValue ("solarPowered"));
targetLatitude = double.Parse (BVModule.GetValue ("targetLatitude"));
targetLongitude = double.Parse (BVModule.GetValue ("targetLongitude"));
averageSpeed = double.Parse(BVModule.GetValue ("averageSpeed"));
path = new List<WayPoint> ();
DecodePath ();
}

private void DecodePath() {
string p = BVModule.GetValue("pathEncoded");
if (p == null)
return;
char[] separators = new char[] { ';' };
string[] wps = p.Split (separators, StringSplitOptions.RemoveEmptyEntries);
foreach (var wp in wps) {
string[] latlon = wp.Split (':');
path.Add (new WayPoint (double.Parse(latlon [0]), double.Parse(latlon [1])));
// path.Add(new WayPoint(LongBitsToDouble(latlon[0]), LongBitsToDouble(latlon[1])));
}
path.Reverse (); // Don't ask me...
}
}
}
Expand Down
Loading

0 comments on commit 9f3eaa3

Please sign in to comment.