Skip to content

Commit

Permalink
Merge pull request #10 from RemoteTechnologiesGroup/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
Pharylon committed Nov 15, 2015
2 parents 2482460 + 95accf0 commit ba945bd
Show file tree
Hide file tree
Showing 17 changed files with 219 additions and 31 deletions.
22 changes: 22 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
Version 1.6.9
========================================
Released November 10, 2015

General
--------------------
- KSP 1.0.5 update
- Small kOS update for invoking events


Version 1.6.8
========================================
Released September 12, 2015

General
--------------------
- Added a new value to RTSettings to keep the throttle on connection loose (ThrottleZeroOnNoConnection=True or False)
- Clean up vessel target handling (thx to geoffromer)
- Added Asteroid Day antennas (thx to phroggster)
- Added NovaPunch antennas (thx to blnk2007)


Version 1.6.7
========================================
Released June 25, 2015
Expand Down
Binary file added GameData/ModuleManager.2.6.13.dll
Binary file not shown.
Binary file removed GameData/ModuleManager.2.6.3.dll
Binary file not shown.
8 changes: 4 additions & 4 deletions GameData/RemoteTech/RemoteTech.version
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
"VERSION":{
"MAJOR":1,
"MINOR":6,
"PATCH":7,
"PATCH":9,
"BUILD":0
},
"KSP_VERSION":{
"MAJOR":1,
"MINOR":0,
"PATCH":2
"PATCH":5
},
"KSP_VERSION_MIN":{
"MAJOR":1,
"MINOR":0,
"PATCH":0
"PATCH":5
},
"KSP_VERSION_MAX":{
"MAJOR":1,
"MINOR":0,
"PATCH":4
"PATCH":5
}
}
29 changes: 29 additions & 0 deletions GameData/RemoteTech/RemoteTech_NovaPunch_Antennas.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//Support for Novapunch Antennas
//Started by blnk2007

//Thor Lander RCS Antenna
@PART[NP_ThorLanderRCS]:AFTER[NovaPunch2]:NEEDS[RemoteTech]
{
!MODULE[ModuleDataTransmitter] {}
@MODULE[ModuleAnimateGeneric]
{
%allowManualControl = false
}

%MODULE[ModuleRTAntenna] {
%Mode0OmniRange = 0
%Mode1OmniRange = 2500000
%MaxQ = 3000
%EnergyCost = 0.13

%DeployFxModules = 0

%TRANSMITTER {
%PacketInterval = 0.3
%PacketSize = 2
%PacketResourceCost = 15.0
}
}

%MODULE[ModuleSPUPassive] {}
}
29 changes: 29 additions & 0 deletions GameData/RemoteTech/RemoteTech_Squad_Antennas.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,32 @@

%MODULE[ModuleSPUPassive] {}
}

@PART[HighGainAntenna]:FOR[RemoteTech]
{
!MODULE[ModuleDataTransmitter] {}

@MODULE[ModuleAnimateGeneric]
{
%allowManualControl = false
}

%MODULE[ModuleRTAntenna] {
%Mode0DishRange = 0
%Mode1DishRange = 25000000000
%EnergyCost = 1.04
%MaxQ = 6000
%DishAngle = 0.12

%DeployFxModules = 0
%ProgressFxModules = 1

%TRANSMITTER {
%PacketInterval = 0.15
%PacketSize = 3
%PacketResourceCost = 20.0
}
}

%MODULE[ModuleSPUPassive] {}
}
17 changes: 17 additions & 0 deletions GameData/RemoteTech/RemoteTech_Squad_Probes.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,20 @@
}
}
}

@PART[HECS2_ProbeCore]:FOR[RemoteTech]
{
%MODULE[ModuleSPU] {
}

%MODULE[ModuleRTAntennaPassive] {
%TechRequired = unmannedTech
%OmniRange = 3000

%TRANSMITTER {
%PacketInterval = 0.3
%PacketSize = 2
%PacketResourceCost = 15.0
}
}
}
2 changes: 1 addition & 1 deletion build.remotetech.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ then

if [[ ! -f dlls.zip ]]; then
echo "Need to get dependency .dll's"
wget -O dlls.zip "https://www.dropbox.com/s/5j3bu46i3doub62/dll_1.04.zip?dl=1"
wget -O dlls.zip "https://www.dropbox.com/s/ubryvrhp2mzkyvl/dll_1.05.zip?dl=1"
fi

if [ -z "$ZIPPASSWORD" ]; then
Expand Down
16 changes: 16 additions & 0 deletions src/RemoteTech/API/API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using WrappedEvent = RemoteTech.FlightComputer.UIPartActionMenuPatcher.WrappedEvent;


namespace RemoteTech.API
{
Expand Down Expand Up @@ -161,5 +163,19 @@ public static bool QueueCommandToFlightComputer(ConfigNode externalData)

return false;
}

// this method provides a workaround for issue #437, it may be possible to remove it in the future
public static void InvokeOriginalEvent(BaseEvent e)
{
if (e is WrappedEvent)
{
WrappedEvent wrappedEvent = e as WrappedEvent;
wrappedEvent.InvokeOriginalEvent();
}
else
{
e.Invoke();
}
}
}
}
8 changes: 0 additions & 8 deletions src/RemoteTech/FlightComputer/Commands/TargetCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ public override String Description
public override bool Pop(FlightComputer f)
{
f.DelayedTarget = Target;
f.lastTarget = this;

if (Target != null && Target != FlightGlobals.fetch.VesselTarget)
{
// Switch the vessels target
FlightGlobals.fetch.SetVesselTarget(Target);
}

return true;
}

Expand Down
39 changes: 37 additions & 2 deletions src/RemoteTech/FlightComputer/FlightComputer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public State Status
}
}

/// <summary>
/// Returns true to keep the throttle on the current position without a connection, otherwise false
/// </summary>
public bool KeepThrottleNoConnect { get { return !RTSettings.Instance.ThrottleZeroOnNoConnection; } }

public double TotalDelay { get; set; }
public ITargetable DelayedTarget { get; set; }
public TargetCommand lastTarget = null;
Expand Down Expand Up @@ -100,6 +105,7 @@ public FlightComputer(ISignalProcessor s)
pid = new PIDControllerV2(0, 0, 0, 1, -1);
initPIDParameters();
lastAct = Vector3d.zero;
lastTarget = TargetCommand.WithTarget(null);

var attitude = AttitudeCommand.Off();
mActiveCommands[attitude.Priority] = attitude;
Expand Down Expand Up @@ -207,9 +213,28 @@ public void OnFixedUpdate()
updatePIDParameters();

// Send updates for Target
if (FlightGlobals.fetch.VesselTarget != DelayedTarget && (mCommandQueue.FindLastIndex(c => (lastTarget = c as TargetCommand) != null)) == -1)
if (Vessel == FlightGlobals.ActiveVessel && FlightGlobals.fetch.VesselTarget != lastTarget.Target)
{
Enqueue(TargetCommand.WithTarget(FlightGlobals.fetch.VesselTarget));
UpdateLastTarget();
}
}

private void UpdateLastTarget()
{
int lastTargetIndex = mCommandQueue.FindLastIndex(c => (c is TargetCommand));
if (lastTargetIndex >= 0)
{
lastTarget = mCommandQueue[lastTargetIndex] as TargetCommand;
}
else if (mActiveCommands.ContainsKey(lastTarget.Priority) &&
mActiveCommands[lastTarget.Priority] is TargetCommand)
{
lastTarget = mActiveCommands[lastTarget.Priority] as TargetCommand;
}
else
{
lastTarget = TargetCommand.WithTarget(null);
}
}

Expand All @@ -218,11 +243,19 @@ private void Enqueue(FlightCtrlState fs)
DelayedFlightCtrlState dfs = new DelayedFlightCtrlState(fs);
dfs.TimeStamp += Delay;
mFlightCtrlQueue.Enqueue(dfs);

}

private void PopFlightCtrl(FlightCtrlState fcs, ISatellite sat)
{
FlightCtrlState delayed = new FlightCtrlState();

// Keep the throttle on no connection
if(this.KeepThrottleNoConnect == true)
{
delayed.mainThrottle = fcs.mainThrottle;
}

while (mFlightCtrlQueue.Count > 0 && mFlightCtrlQueue.Peek().TimeStamp <= RTUtil.GameTime)
{
delayed = mFlightCtrlQueue.Dequeue().State;
Expand Down Expand Up @@ -277,6 +310,7 @@ private void PopCommand()
), true);
}
mCommandQueue.Remove(dc);
UpdateLastTarget();
}
}
}
Expand All @@ -302,7 +336,7 @@ private void OnFlyByWirePost(FlightCtrlState fcs)
{
if (!SignalProcessor.IsMaster) return;

if (!InputAllowed)
if (!InputAllowed && this.KeepThrottleNoConnect == false)
{
fcs.Neutralize();
}
Expand Down Expand Up @@ -473,6 +507,7 @@ public void load(ConfigNode n)
}
}
}
UpdateLastTarget();
}

/// <summary>
Expand Down
18 changes: 17 additions & 1 deletion src/RemoteTech/FlightComputer/UIPartActionMenuPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ public static void Wrap(Vessel parent, Action<BaseEvent, bool> pass)
}
}

public class WrappedEvent : BaseEvent
{
private BaseEvent originalEvent;

public WrappedEvent(BaseEvent originalEvent, BaseEventList baseParentList, string name, BaseEventDelegate baseActionDelegate)
: base(baseParentList, name, baseActionDelegate)
{
this.originalEvent = originalEvent;
}

public void InvokeOriginalEvent()
{
originalEvent.Invoke();
}
}

private class Wrapper
{
private Action<BaseEvent, bool> mPassthrough;
Expand All @@ -82,7 +98,7 @@ public static BaseEvent CreateWrapper(BaseEvent original, Action<BaseEvent, bool
ConfigNode cn = new ConfigNode();
original.OnSave(cn);
Wrapper wrapper = new Wrapper(original, passthrough, ignore_delay);
BaseEvent new_event = new BaseEvent(original.listParent, original.name, wrapper.Invoke);
BaseEvent new_event = new WrappedEvent(original, original.listParent, original.name, wrapper.Invoke);
new_event.OnLoad(cn);

return new_event;
Expand Down
12 changes: 1 addition & 11 deletions src/RemoteTech/Modules/ModuleRTDataTransmitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ bool IScienceDataTransmitter.CanTransmit()
return true;
}

void IScienceDataTransmitter.TransmitData(List<ScienceData> dataQueue, Callback callback)
{
scienceDataQueue.AddRange(dataQueue);
if (!isBusy)
{
StartCoroutine(Transmit(callback));
}
}

float IScienceDataTransmitter.DataRate { get { return PacketSize / PacketInterval; } }
double IScienceDataTransmitter.DataResourceCost { get { return PacketResourceCost / PacketSize; } }
bool IScienceDataTransmitter.IsBusy() { return isBusy; }
Expand Down Expand Up @@ -96,7 +87,7 @@ private IEnumerator Transmit(Callback callback = null)
RTLog.Notify("Changing RnDCommsStream timeout from {0} to {1}", PacketInterval, x64PacketInterval);

commStream = new RnDCommsStream(subject, scienceData.dataAmount, x64PacketInterval,
scienceData.transmitValue, ResearchAndDevelopment.Instance);
scienceData.transmitValue, false, ResearchAndDevelopment.Instance);
}
//StartCoroutine(SetFXModules_Coroutine(modules_progress, 0.0f));
float power = 0;
Expand Down Expand Up @@ -128,7 +119,6 @@ private IEnumerator Transmit(Callback callback = null)
msg.message = String.Format("<b><color=orange>[{0}]: Warning! Not Enough {1}!</color></b>", part.partInfo.title, RequiredResource);
ScreenMessages.PostScreenMessage(msg, true);
GUIStatus = String.Format("{0}/{1} {2}", power, PacketResourceCost, RequiredResource);

}
yield return new WaitForSeconds(PacketInterval);
}
Expand Down
12 changes: 11 additions & 1 deletion src/RemoteTech/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ public sealed class MissionControlSatellite : ISatellite, IPersistenceLoad
[Persistent] private Color MarkColor = new Color(0.996078f, 0, 0, 1);
[Persistent(collectionIndex = "ANTENNA")] private MissionControlAntenna[] Antennas = { new MissionControlAntenna() };

bool ISatellite.Powered { get { return true; } }
private bool AntennaActivated = true;

bool ISatellite.Powered { get { return this.AntennaActivated; } }
bool ISatellite.Visible { get { return true; } }
String ISatellite.Name { get { return Name; } set { Name = value; } }
Guid ISatellite.Guid { get { return mGuid; } }
Expand Down Expand Up @@ -262,5 +264,13 @@ public override String ToString()
return Name;
}

/// <summary>
/// Used currently for debug purposes only. This method can be used to shut down the mission control
/// </summary>
/// <param name="powerswitch">true=Missioncontrol on, false=MissionControl off</param>
public void togglePower(bool powerswitch)
{
this.AntennaActivated = powerswitch;
}
}
}
2 changes: 1 addition & 1 deletion src/RemoteTech/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
// DLLs any time it changes. Breaking on a minor revision is probably acceptable - it's
// unlikely that there wouldn't be other breaking changes on a minor version change.
[assembly: AssemblyVersion("1.6")]
[assembly: AssemblyFileVersion("1.6.7")]
[assembly: AssemblyFileVersion("1.6.9")]

// Use KSPAssembly to allow other DLLs to make this DLL a dependency in a
// non-hacky way in KSP. Format is (AssemblyProduct, major, minor), and it
Expand Down
1 change: 1 addition & 0 deletions src/RemoteTech/RTSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class Settings
[Persistent] public RangeModel.RangeModel RangeModelType = RangeModel.RangeModel.Standard;
[Persistent] public double MultipleAntennaMultiplier = 0.0;
[Persistent] public bool ThrottleTimeWarp = true;
[Persistent] public bool ThrottleZeroOnNoConnection = true;
[Persistent] public bool HideGroundStationsBehindBody = false;
[Persistent] public Color DishConnectionColor = XKCDColors.Amber;
[Persistent] public Color OmniConnectionColor = XKCDColors.BrownGrey;
Expand Down
Loading

0 comments on commit ba945bd

Please sign in to comment.