-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from DMagic1/dev
Version 11rc3
- Loading branch information
Showing
35 changed files
with
1,585 additions
and
567 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ACTIVE_TEXTURE_MANAGER_CONFIG | ||
{ | ||
folder = SCANsat | ||
enabled = true | ||
OVERRIDES | ||
{ | ||
SCANsat/Icons/.* | ||
{ | ||
compress = true | ||
mipmaps = false | ||
scale = 1 | ||
max_size = 0 | ||
make_not_readable = false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("SCANmechjeb")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("SCANmechjeb")] | ||
[assembly: AssemblyCopyright("Copyright © 2015")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("a96b8661-cfef-40ab-8798-f701b97808c4")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.1.3.0")] | ||
[assembly: AssemblyFileVersion("1.1.3.0")] | ||
[assembly: AssemblyInformationalVersion ("v11rc3")] | ||
|
||
[assembly: KSPAssembly ("SCANmechjeb", 0, 1)] | ||
[assembly: KSPAssemblyDependency ("SCANsat", 1, 1)] | ||
[assembly: KSPAssemblyDependency("MechJeb2", 2, 4)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
| ||
|
||
using UnityEngine; | ||
|
||
namespace SCANmechjeb | ||
{ | ||
[KSPAddon(KSPAddon.Startup.Flight, false)] | ||
class SCANmechStarter : MonoBehaviour | ||
{ | ||
private MonoBehaviour SCANmechjebInt; | ||
|
||
private void Start() | ||
{ | ||
if (SCANmechjebMainMenu.Loaded) | ||
{ | ||
print("[SCANsatMechJeb] Starting SCANsat - MechJeb Interface..."); | ||
SCANmechjebInt = gameObject.AddComponent<SCANmechjeb>(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
| ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using SCANsat; | ||
using SCANsat.SCAN_Data; | ||
using SCANsat.SCAN_Platform; | ||
using log = SCANsat.SCAN_Platform.Logging.ConsoleLogger; | ||
using palette = SCANsat.SCAN_UI.UI_Framework.SCANpalette; | ||
using MuMech; | ||
|
||
using UnityEngine; | ||
|
||
namespace SCANmechjeb | ||
{ | ||
class SCANmechjeb : SCAN_MBE | ||
{ | ||
private const string siteName = "MechJeb Landing Target"; | ||
private Vessel v; | ||
private MechJebCore core; | ||
private MechJebModuleTargetController target; | ||
private DisplayModule guidanceModule; | ||
private SCANwaypoint way; | ||
private SCANdata data; | ||
private Vector2d coords = new Vector2d(); | ||
private bool selectingTarget, selectingInMap, shutdown; | ||
|
||
protected override void LateUpdate() | ||
{ | ||
if (shutdown) | ||
return; | ||
|
||
if (!HighLogic.LoadedSceneIsFlight || !FlightGlobals.ready) | ||
return; | ||
|
||
if (SCANcontroller.controller == null) | ||
{ | ||
way = null; | ||
return; | ||
} | ||
|
||
v = FlightGlobals.ActiveVessel; | ||
|
||
if (v == null) | ||
{ | ||
SCANcontroller.controller.MechJebLoaded = false; | ||
way = null; | ||
return; | ||
} | ||
|
||
if (v.mainBody != SCANcontroller.controller.MechJebTargetBody) | ||
SCANcontroller.controller.MechJebTargetBody = v.mainBody; | ||
|
||
data = SCANUtil.getData(v.mainBody); | ||
|
||
if (data == null) | ||
{ | ||
SCANcontroller.controller.MechJebLoaded = false; | ||
way = null; | ||
return; | ||
} | ||
|
||
if (v.FindPartModulesImplementing<MechJebCore>().Count <= 0) | ||
{ | ||
SCANcontroller.controller.MechJebLoaded = false; | ||
way = null; | ||
return; | ||
} | ||
|
||
core = v.GetMasterMechJeb(); | ||
|
||
if (core == null) | ||
{ | ||
SCANcontroller.controller.MechJebLoaded = false; | ||
way = null; | ||
return; | ||
} | ||
|
||
if (HighLogic.CurrentGame.Mode != Game.Modes.SANDBOX) | ||
{ | ||
if (guidanceModule == null) | ||
guidanceModule = (DisplayModule)core.GetComputerModule("MechJebModuleLandingGuidance"); | ||
|
||
if (guidanceModule == null) | ||
{ | ||
SCANcontroller.controller.MechJebLoaded = false; | ||
way = null; | ||
return; | ||
} | ||
|
||
if (!guidanceModule.unlockChecked) | ||
return; | ||
|
||
if (guidanceModule.hidden) | ||
{ | ||
SCANcontroller.controller.MechJebLoaded = false; | ||
shutdown = true; | ||
way = null; | ||
return; | ||
} | ||
} | ||
|
||
target = core.target; | ||
|
||
if (target == null) | ||
{ | ||
SCANcontroller.controller.MechJebLoaded = false; | ||
way = null; | ||
return; | ||
} | ||
|
||
if (!SCANcontroller.controller.MechJebLoaded) | ||
{ | ||
SCANcontroller.controller.MechJebLoaded = true; | ||
RenderingManager.AddToPostDrawQueue(1, drawTarget); | ||
} | ||
|
||
if (SCANcontroller.controller.MechJebTarget != null) | ||
{ | ||
way = SCANcontroller.controller.MechJebTarget; | ||
} | ||
|
||
if (SCANcontroller.controller.MechJebSelecting) | ||
{ | ||
way = null; | ||
selectingTarget = true; | ||
if (SCANcontroller.controller.MechJebSelectingActive) | ||
selectingInMap = true; | ||
else | ||
selectingInMap = false; | ||
coords = SCANcontroller.controller.MechJebTargetCoords; | ||
return; | ||
} | ||
else if (selectingTarget) | ||
{ | ||
selectingTarget = false; | ||
if (selectingInMap) | ||
{ | ||
selectingInMap = false; | ||
coords = SCANcontroller.controller.MechJebTargetCoords; | ||
way = new SCANwaypoint(coords.y, coords.x, siteName); | ||
target.SetPositionTarget(SCANcontroller.controller.MechJebTargetBody, way.Latitude, way.Longitude); | ||
} | ||
} | ||
|
||
selectingInMap = false; | ||
selectingTarget = false; | ||
|
||
if (target.Target == null) | ||
{ | ||
way = null; | ||
return; | ||
} | ||
|
||
if (target.targetBody != v.mainBody) | ||
{ | ||
way = null; | ||
return; | ||
} | ||
|
||
if (!(target.Target is PositionTarget)) | ||
{ | ||
way = null; | ||
return; | ||
} | ||
|
||
coords.x = target.targetLongitude; | ||
coords.y = target.targetLatitude; | ||
|
||
if (way != null) | ||
{ | ||
if (!SCANUtil.ApproxEq(coords.x, way.Longitude) || !SCANUtil.ApproxEq(coords.y, way.Latitude)) | ||
{ | ||
way = new SCANwaypoint(coords.y, coords.x, siteName); | ||
SCANcontroller.controller.MechJebTarget = way; | ||
data.addToWaypoints(); | ||
} | ||
} | ||
else | ||
{ | ||
way = new SCANwaypoint(coords.y, coords.x, siteName); | ||
SCANcontroller.controller.MechJebTarget = way; | ||
data.addToWaypoints(); | ||
} | ||
} | ||
|
||
//Draw the mapview MechJeb target arrows | ||
private void drawTarget() | ||
{ | ||
if (!selectingInMap) | ||
return; | ||
|
||
target.pickingPositionTarget = false; | ||
|
||
if (!MapView.MapIsEnabled) | ||
return; | ||
if (!v.isActiveVessel || v.GetMasterMechJeb() != core) | ||
return; | ||
|
||
GLUtils.DrawMapViewGroundMarker(SCANcontroller.controller.MechJebTargetBody, coords.y, coords.x, palette.mechjebYellow); | ||
} | ||
} | ||
} |
Oops, something went wrong.