Skip to content

Commit

Permalink
Merge pull request #31 from ChrisAdderley/dev
Browse files Browse the repository at this point in the history
Release 1.0.7
  • Loading branch information
ChrisAdderley authored May 26, 2020
2 parents b4ce9b0 + 36701a5 commit 06b2bae
Show file tree
Hide file tree
Showing 10 changed files with 517 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .mod_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies: # Configure dependencies
version: 4.1.3
location: s3
B9PartSwitch:
version: 2.13.0
version: 2.16.0
location: s3
deploy:
SpaceDock:
Expand Down
2 changes: 2 additions & 0 deletions GameData/NearFutureExploration/Localization/en-us.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Localization
#LOC_NFEX_ModuleAntennaFeed_Field_ReflectorName_Title = Using Reflector

#LOC_NFEX_ModuleAntennaFeed_Event_ShowPath_Title = Render Antenna Path

#LOC_NFEX_ModuleAntennaFeed_Event_ShowAllPath_Title = Render All Paths

#LOC_NFEX_ModuleDeployableReflector_ModuleName = Deployable Reflector
#LOC_NFEX_ModuleDeployableReflector_PartInfo = Increases the power of Antenna Feeds pointing at the dish \n\n <b>Added Power</b>: <<1>>
Expand Down
436 changes: 436 additions & 0 deletions GameData/NearFutureExploration/Localization/zh-cn.cfg

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
}

@PART[nfex-antenna*]:FOR[NearFutureExploration]:NEEDS[RemoteTech|RealAntennas]
@PART[nfex-antenna*]:FOR[NearFutureExploration]:NEEDS[RealAntennas]
{

!MODULE[ModuleAntennaFeed] {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@
primaryColor = #fccb0a
secondaryColor = #fccb0a
tankType = LH2
addedMass = -0.00625
addedMass = -0.0025
}
SUBTYPE
{
Expand All @@ -391,7 +391,7 @@
primaryColor = #fccb0a
secondaryColor = #fccb0a
tankType = LH2O
addedMass = -0.00625
addedMass = -0.0025
}
}
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
{
"MAJOR":1,
"MINOR":0,
"PATCH":6,
"PATCH":7,
"BUILD":0
},
"KSP_VERSION":
{
"MAJOR":1,
"MINOR":9,
"PATCH":0
"PATCH":1
},
"KSP_VERSION_MIN":{
"MAJOR":1,
Expand Down
83 changes: 64 additions & 19 deletions Source/ModuleAntennaFeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using UnityEngine;
using KSP.Localization;
using VisualDebugUtils;
using System.Reflection;

namespace NearFutureExploration
{
Expand All @@ -26,22 +27,22 @@ public class ModuleAntennaFeed:PartModule
[KSPField(isPersistant = false)]
public float RayDistance = 500f;

[KSPField(isPersistant = false, guiActive = true, guiName = "Reflector Buff")]
[KSPField(isPersistant = false, guiActive = true, guiName = "#LOC_NFEX_ModuleAntennaFeed_Field_ReflectorBuff_Title")]//Reflector Buff
public string StatusString;

[KSPField(isPersistant = false, guiActive = true, guiName = "Using Reflector")]
[KSPField(isPersistant = false, guiActive = true, guiName = "#LOC_NFEX_ModuleAntennaFeed_Field_ReflectorName_Title")]//Using Reflector
public string TargetString;

// Toggle Visibility
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "Render Antenna Path")]
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "#LOC_NFEX_ModuleAntennaFeed_Event_ShowPath_Title")]//Render Antenna Path
public void ToggleVisibility()
{
lineRenderable = !lineRenderable;
renderedLine.SetVisibility(lineRenderable);
}

// Toggle Visibility All
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "Render All Paths")]
[KSPEvent(guiActive = false, guiActiveEditor = true, guiName = "#LOC_NFEX_ModuleAntennaFeed_Event_ShowAllPath_Title")]//Render All Paths
public void ToggleVisibilityAll()
{
bool targetState = false;
Expand Down Expand Up @@ -77,6 +78,7 @@ public void SetVisibility(bool visibility)
ModuleDeployableReflector reflector;
ModuleDataTransmitterFeedeable baseAntenna;
ModuleDeployableAntenna deployModule;
PartModule RTAntennaPartModule;

bool lineRenderable = true;
DebugLine renderedLine;
Expand Down Expand Up @@ -146,7 +148,7 @@ public override void OnWasCopied(PartModule copyPartModule, bool asSymCounterpar
void FixedUpdate()
{
ticker++;
if (baseAntenna != null && ticker >= 5)
if ((baseAntenna != null || RTAntennaPartModule != null) && ticker >= 5)
{
ticker = 0;
if (!deployable || (deployable && deployModule.deployState == ModuleDeployablePart.DeployState.EXTENDED))
Expand Down Expand Up @@ -244,34 +246,77 @@ void FindAntenna()
{
baseAntenna = part.GetComponent<ModuleDataTransmitterFeedeable>();
deployModule = part.GetComponent<ModuleDeployableAntenna>();
if (baseAntenna == null)
if (baseAntenna != null)
{
Debug.LogError("[NearFutureExploration] [ModuleAntennaFeed]: Could not find an antenna module for use as feeder");

} else
baseAntennaRange = baseAntenna.antennaPower;
}
else
{
if (deployModule != null)
RTAntennaPartModule = part.Modules.Contains("ModuleRTAntenna") ? part.Modules["ModuleRTAntenna"] : null;
if (RTAntennaPartModule != null)
{
Debug.Log("[NearFutureExploration] [ModuleAntennaFeed]: Feed is deployable");
deployable = true;
try
{
FieldInfo fi = RTAntennaPartModule.GetType().GetField("Mode1DishRange");
baseAntennaRange = (float)(fi.GetValue(RTAntennaPartModule));
}
catch (Exception e)
{
Debug.LogError("[NearFutureExploration] [ModuleAntennaFeed]: Mismatched RemoteTech antenna module");
}
}
else
{
Debug.LogError("[NearFutureExploration] [ModuleAntennaFeed]: Could not find an antenna module for use as feeder");
}
}


baseAntennaRange = baseAntenna.antennaPower;
if (deployModule != null)
{
Debug.Log("[NearFutureExploration] [ModuleAntennaFeed]: Feed is deployable");
deployable = true;
}
}
public void ApplyReflectorBonus()
{
baseAntenna.antennaPower = baseAntennaRange + reflector.GetReflectorBonus() * FeedScale;
baseAntenna.savedAntennaPower = baseAntennaRange + reflector.GetReflectorBonus() * FeedScale;
if (baseAntenna != null)
{
baseAntenna.antennaPower = baseAntennaRange + reflector.GetReflectorBonus() * FeedScale;
baseAntenna.savedAntennaPower = baseAntennaRange + reflector.GetReflectorBonus() * FeedScale;
}
else
{
try
{
FieldInfo fi = RTAntennaPartModule.GetType().GetField("Mode1DishRange");
fi.SetValue(RTAntennaPartModule, (float)(baseAntennaRange + reflector.GetReflectorBonus() * FeedScale));
}
catch (Exception e)
{
Debug.LogError("[NearFutureExploration] [ModuleAntennaFeed]: Mismatched RemoteTech antenna module");
}
}
StatusString = Localizer.Format("#LOC_NFEX_ModuleAntennaFeed_Field_ReflectorBuff_StatusString", Utils.ToSI(reflector.GetReflectorBonus() * FeedScale, "F0"));
TargetString = Localizer.Format("<<1>>", reflector.part.partInfo.title);
//baseAntenna.powerText = String.Format(baseAntenna.antennaPower);
}
public void NullReflectorBonus()
{
baseAntenna.antennaPower = baseAntennaRange;

if (baseAntenna != null)
{
baseAntenna.antennaPower = baseAntennaRange;
}
else
{
try
{
FieldInfo fi = RTAntennaPartModule.GetType().GetField("Mode1DishRange");
fi.SetValue(RTAntennaPartModule, (float)baseAntennaRange);
}
catch (Exception e)
{
Debug.LogError("[NearFutureExploration] [ModuleAntennaFeed]: Mismatched RemoteTech antenna module");
}
}
StatusString = "";
TargetString = "";
//baseAntenna.powerText = String.Format(baseAntenna.antennaPower);
Expand Down
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v1.0.7
------
- Updated bundled B9PartSwitch to 2.16.0
- RemoteTech compatiblity! (thanks TaxiService!)
- Chinese localization (tinygrox)
- Fixed an issue with the tiny tiny tank that had negative mass when loaded with LH2

v1.0.6
------
- Fixed backwards RT patch removing feed features when RT NOT installed vs installed
Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
==============================
Near Future Exploration v1.0.6
Near Future Exploration v1.0.7
==============================

A set of parts to help enhance and improve the KSP probe experience, particularly in the later game with larger probes
Expand All @@ -16,7 +16,7 @@ DEPENDENCIES
============

Required:
- B9PartSwitch (2.13.0)
- B9PartSwitch (2.16.0)
- ModuleManager (4.1.3)

Optional
Expand Down

0 comments on commit 06b2bae

Please sign in to comment.