Skip to content

Commit

Permalink
Merge pull request #448 from MOARdV/master
Browse files Browse the repository at this point in the history
Another 0.24.1 pull
  • Loading branch information
MOARdV committed Dec 1, 2015
2 parents a31c5bb + 753ec07 commit 04953f6
Show file tree
Hide file tree
Showing 12 changed files with 547 additions and 100 deletions.
8 changes: 4 additions & 4 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Can you make RPM work outside the command pod / on pop-up screens?

No. RasterPropMonitor was designed to provide an interactive IVA experience. It can not be used to run "monitors" placed outside the craft, and it can not be used to draw on windows/overlays either. There are no plans to change that. The license for RPM is very open, so if someone wants to use RPM as a basis to make something similar for outside-of-IVA use, they're more than welcome to try.
No. RasterPropMonitor was designed to provide an interactive IVA experience. It was not designed to run "monitors" placed outside the craft, and it can not be used to draw on windows/overlays either. There are no plans to change that. The license for RPM is very open, so if someone wants to use RPM as a basis to make something similar for outside-of-IVA use, they're more than welcome to try.

### Where is the IVA for X?

Expand All @@ -14,7 +14,7 @@ I do not actively support CKAN versioning information. KerbalStuff has an optio

I make efforts to keep the RasterPropMonitor.version file accurate (which affects AVC, and maybe CKAN), but due to the way my release cycles work, there is always a chance that version info on GitHub will be changed before a release takes place.

TL;DR: The current version is always identified on the [forum](http://forum.kerbalspaceprogram.com/threads/117471), [KerbalStuff](https://kerbalstuff.com/mod/734/RasterPropMonitor), and [GitHub](https://github.com/Mihara/RasterPropMonitor/releases) . Any other sources of versioning are secondary, and not authorative.
TL;DR: The current version is always identified on the [forum](http://forum.kerbalspaceprogram.com/index.php?/topic/105821-105-rasterpropmonitor-still-putting-the-a-in-iva-v0240-10-november-2015/), [KerbalStuff](https://kerbalstuff.com/mod/734/RasterPropMonitor), and [GitHub](https://github.com/Mihara/RasterPropMonitor/releases) . Any other sources of versioning are secondary, and not authorative.

### Half the buttons don't work!

Expand All @@ -28,7 +28,7 @@ It's sort of an approximation of how actual MFDs work, though they typically use
* Make sure that there is only one RasterPropMonitor.dll and that it is located at GameData/JSI/RasterPropMonitor/Plugins/RasterPropMonitor.dll -- several earlier third-party capsules distributed old versions incorrectly. They *will* fail to work in 0.23.
* Make sure that you're using the appropriate versions of every other plugin, in particular SCANsat and MechJeb -- failures of loading the interface DLLs for those can cause RasterPropMonitor to stop working, and there's little I can do about this. Blame Squad and be sure to eradicate MechJebRPM.dll if you do not use MechJeb / delete SCANsatRPM.dll if you do not use SCANsat.

If these steps do not solve your problem, please follow the steps in (this post on the forum)[http://forum.kerbalspaceprogram.com/threads/92229] and post the required information on the (RPM forum)[http://forum.kerbalspaceprogram.com/threads/117471] or open an issue on (GitHub)[https://github.com/Mihara/RasterPropMonitor/issues].
If these steps do not solve your problem, please follow the steps in (this post on the forum)[http://forum.kerbalspaceprogram.com/index.php?/topic/105821-105-rasterpropmonitor-still-putting-the-a-in-iva-v0240-10-november-2015/] and post the required information on the (RPM forum)[http://forum.kerbalspaceprogram.com/threads/117471] or open an issue on (GitHub)[https://github.com/Mihara/RasterPropMonitor/issues].

### I get lots of exclamation signs and gibberish all over my screens!

Expand All @@ -42,7 +42,7 @@ I want your KSP_Data/output_log.txt and as precise a description of what you wer

### How do I get the map to show? It says "No satellite connection"

RasterPropMonitor relies on [SCANsat](http://forum.kerbalspaceprogram.com/threads/55832) for mapping data. These are the precise satellites it means to have a connection to -- install it and launch some, they're quite a lot of fun. It's one of those things that makes probes more than just a practice launch.
RasterPropMonitor relies on [SCANsat](http://forum.kerbalspaceprogram.com/index.php?/topic/72679-105-scansat-v144-real-scanning-real-science-at-warp-speed-november-14/) for mapping data. These are the precise satellites it means to have a connection to -- install it and launch some, they're quite a lot of fun. It's one of those things that makes probes more than just a practice launch.

### RasterPropMonitor breaks Kethane map!

Expand Down
2 changes: 1 addition & 1 deletion GameData/JSI/RasterPropMonitor/RasterPropMonitor.version
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"VERSION": {
"MAJOR": 0,
"MINOR": 24,
"PATCH": 0
"PATCH": 1
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Plugin for Kerbal Space Program enabling creation of advanced display monitors and other useful and informative props for internal capsule view.

See [the forum support thread](http://forum.kerbalspaceprogram.com/threads/117471) for support.
See [the forum support thread](http://forum.kerbalspaceprogram.com/index.php?/topic/105821-105-rasterpropmonitor-still-putting-the-a-in-iva-v0240-10-november-2015/) for support.

See [the dull^H^H^H^ full documentation](https://github.com/Mihara/RasterPropMonitor/wiki) in the wiki on GitHub.

21 changes: 16 additions & 5 deletions RasterPropMonitor/Auxiliary modules/JSIActionGroupSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ internal enum CustomActions
private int lightCheckCountdown;
private RasterPropMonitorComputer rpmComp;
private bool startupComplete;
private Renderer colorShiftRenderer;
private Material colorShiftMaterial;
private string stateVariable = string.Empty;
private Action<bool> actionHandler;
private bool isPluginAction;
Expand Down Expand Up @@ -536,10 +536,11 @@ public void Start()
else if (!string.IsNullOrEmpty(coloredObject))
{
// Set up the color shift.
colorShiftRenderer = internalProp.FindModelComponent<Renderer>(coloredObject);
Renderer colorShiftRenderer = internalProp.FindModelComponent<Renderer>(coloredObject);
disabledColorValue = ConfigNode.ParseColor32(disabledColor);
enabledColorValue = ConfigNode.ParseColor32(enabledColor);
colorShiftRenderer.material.SetColor(colorName, (currentState ^ reverse ? enabledColorValue : disabledColorValue));
colorShiftMaterial = colorShiftRenderer.material;
colorShiftMaterial.SetColor(colorName, (currentState ^ reverse ? enabledColorValue : disabledColorValue));
}
else
{
Expand Down Expand Up @@ -567,6 +568,16 @@ public void OnDestroy()
{
//JUtil.LogMessage(this, "OnDestroy()");
rpmComp = null;
if (colorShiftMaterial != null)
{
UnityEngine.Object.Destroy(colorShiftMaterial);
colorShiftMaterial = null;
}
actionHandler = null;
transferGetter = null;
transferSetter = null;
audioOutput = null;
loopingOutput = null;
}

private void SetInternalLights(bool value)
Expand Down Expand Up @@ -860,9 +871,9 @@ public override void OnUpdate()
anim.Play(animationName);
}
}
else if (colorShiftRenderer != null)
else if (colorShiftMaterial != null)
{
colorShiftRenderer.material.SetColor(colorName, (newState ^ reverse ? enabledColorValue : disabledColorValue));
colorShiftMaterial.SetColor(colorName, (newState ^ reverse ? enabledColorValue : disabledColorValue));
}
currentState = newState;
}
Expand Down
166 changes: 166 additions & 0 deletions RasterPropMonitor/Auxiliary modules/JSIEngineMonitor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
/*****************************************************************************
* RasterPropMonitor
* =================
* Plugin for Kerbal Space Program
*
* by Mihara (Eugene Medvedev), MOARdV, and other contributors
*
* RasterPropMonitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, revision
* date 29 June 2007, or (at your option) any later version.
*
* RasterPropMonitor is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with RasterPropMonitor. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
using System;
using System.Collections.Generic;

namespace JSI
{
/// <summary>
/// Provides a module for RasterPropMonitor to use for providing granular
/// control of an engine as well as detailed information.
/// </summary>
class JSIEngineMonitor : PartModule
{
// Internal data storage.
[KSPField(isPersistant = true)]
public int enginedID = 0;

// Fields to handle right-click GUI.
[KSPField(guiActive = true, guiActiveEditor = true, guiName = "Engine ID: ")]
public string engineDisplayName;

[KSPEvent(guiActive = true, guiActiveEditor = true, guiName = "ID +")]
public void IdPlus()
{
enginedID++;
UpdateName();
}

[KSPEvent(guiActive = true, guiActiveEditor = true, guiName = "ID -")]
public void IdMinus()
{
enginedID--;
if (enginedID <= 0)
enginedID = 0;
UpdateName();
}

private void UpdateName()
{
engineDisplayName = (enginedID > 0) ? enginedID.ToString() : "Untracked";
}

private int mmeIndex = -1;
private int engineMode1Index = -1;
private int engineMode2Index = -1;

public void Start()
{
if (!HighLogic.LoadedSceneIsFlight)
{
return;
}

for(int i=0; i<part.Modules.Count; ++i)
{
if(part.Modules[i] is MultiModeEngine)
{
if (mmeIndex == -1)
{
mmeIndex = i;
JUtil.LogMessage(this, "Start(): mmeIndex = {0}", i);
}
else
{
JUtil.LogErrorMessage(this, "Found more than one MultiModeEngine on {0} - I don't know what to do with it.", part.name);
}
}
else if(part.Modules[i] is ModuleEngines)
{
if(engineMode1Index == -1)
{
engineMode1Index = i;
JUtil.LogMessage(this, "Start(): engineMode1Index = {0}", i);
}
else if(engineMode2Index == -1)
{
engineMode2Index = i;
JUtil.LogMessage(this, "Start(): engineMode2Index = {0}", i);
}
else
{
JUtil.LogErrorMessage(this, "Found more than 2 ModuleEngines on {0} - I don't know what to do with them.", part.name);
}
}
}

if(engineMode1Index == -1)
{
Destroy(this);
// No engines!
}
UpdateName();
}

public void FixedUpdate()
{
if (HighLogic.LoadedSceneIsEditor)
{
return;
}

if (!JUtil.IsActiveVessel(vessel))
{
return;
}
}

public bool GetRunningPrimary()
{
if(mmeIndex == -1)
{
return true;
}
else
{
MultiModeEngine mme = part.Modules[mmeIndex] as MultiModeEngine;
return mme.runningPrimary;
}
}

public void SetRunningPrimary(bool state)
{
try
{
if (mmeIndex > -1)
{
MultiModeEngine mme = part.Modules[mmeIndex] as MultiModeEngine;

// There doesn't appear to be a simpler way to switch modes.
// One this I could do is store the even index instead of looping
// over it every time we change modes.
if (mme.runningPrimary != state)
{
var ev = mme.Events["ModeEvent"];
if (ev != null)
{
ev.Invoke();
}
}
}
}
catch
{
// no-op
}
}
}
}
100 changes: 100 additions & 0 deletions RasterPropMonitor/Auxiliary modules/JSINavBall.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*****************************************************************************
* RasterPropMonitor
* =================
* Plugin for Kerbal Space Program
*
* by Mihara (Eugene Medvedev), MOARdV, and other contributors
*
* RasterPropMonitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, revision
* date 29 June 2007, or (at your option) any later version.
*
* RasterPropMonitor is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with RasterPropMonitor. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
using System;
using UnityEngine;

namespace JSI
{
class JSINavBall : InternalNavBall
{
/// <summary>
/// Name of the enabling variable. Required.
/// </summary>
[KSPField]
public string variableName = string.Empty;

/// <summary>
/// vec2 containing the 'enabled' range. May be numeric or varibles. Required.
/// </summary>
[KSPField]
public string range = string.Empty;

/// <summary>
/// Maximum angle that the navball can change per second, in degrees. Defaults to 180.
/// </summary>
[KSPField]
public float maxAngleChange = 180.0f;

private VariableOrNumberRange enablingVariable;

private Quaternion lastOrientation;

public override void OnAwake()
{
base.OnAwake();

lastOrientation = navBall.rotation;

if (string.IsNullOrEmpty(variableName) || string.IsNullOrEmpty(range))
{
JUtil.LogErrorMessage(this, "variableName or range was null!");
return;
}
string[] tokens = range.Split(',');
if (tokens.Length != 2)
{
JUtil.LogErrorMessage(this, "range '{0}' did not have exactly two values!", range);
return;
}

enablingVariable = new VariableOrNumberRange(variableName, tokens[0], tokens[1]);
}

public override void OnUpdate()
{
if (enablingVariable == null)
{
return;
}

RPMVesselComputer comp = RPMVesselComputer.Instance(vessel);
if (enablingVariable.IsInRange(comp))
{
base.OnUpdate();
Quaternion post = navBall.rotation;
float deltaAngle = Quaternion.Angle(lastOrientation, post);
float maxAngle = maxAngleChange * Time.deltaTime;

// If the rotation angle exceeds what we can do, slow it down
if (deltaAngle > maxAngle)
{
Quaternion newRotation = Quaternion.Slerp(lastOrientation, post, maxAngle / deltaAngle);
lastOrientation = newRotation;
navBall.rotation = newRotation;
}
else
{
lastOrientation = post;
}
}
}
}
}
Loading

0 comments on commit 04953f6

Please sign in to comment.