Skip to content

Commit

Permalink
Merge pull request #88 from post-kerbin-mining-corporation/dev
Browse files Browse the repository at this point in the history
Action group addition
  • Loading branch information
ChrisAdderley authored Oct 3, 2021
2 parents b3e7b69 + ac5a577 commit 416a3c8
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
5 changes: 5 additions & 0 deletions GameData/SystemHeat/Localization/en-us.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ Localization
#LOC_SystemHeat_ModuleSystemHeatExchanger_Event_EnableExchanger = Enable Exchanger
#LOC_SystemHeat_ModuleSystemHeatExchanger_Event_DisableExchanger = Disable Exchanger

#LOC_SystemHeat_ModuleSystemHeatExchanger_Action_EnableExchanger = Enable Exchanger
#LOC_SystemHeat_ModuleSystemHeatExchanger_Action_DisableExchanger = Disable Exchanger
#LOC_SystemHeat_ModuleSystemHeatExchanger_Action_ToggleExchanger = Toggle Exchanger
#LOC_SystemHeat_ModuleSystemHeatExchanger_Action_ToggleDirection = Toggle Direction


/// ModuleSystemHeatBaseConverterAdapter
/// =================================
Expand Down
Binary file modified GameData/SystemHeat/Plugin/SystemHeat.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion GameData/SystemHeat/Versioning/SystemHeat.version
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"MAJOR":0,
"MINOR":5,
"PATCH":5,
"PATCH":6,
"BUILD":0
},
"KSP_VERSION":
Expand Down
38 changes: 36 additions & 2 deletions SystemHeat/SystemHeat/Modules/ModuleSystemHeatExchanger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,36 @@ public void DisableExchanger()
Enabled = false;
}

/// <summary>
/// Actions
/// </summary>

[KSPAction(guiName = "#LOC_SystemHeat_ModuleSystemHeatExchanger_Action_EnableExchanger")]
public void EnableAction(KSPActionParam param)
{
EnableExchanger();
}

[KSPAction(guiName = "#LOC_SystemHeat_ModuleSystemHeatExchanger_Action_DisableExchanger")]
public void DisableAction(KSPActionParam param)
{
DisableExchanger();
}

[KSPAction(guiName = "#LOC_SystemHeat_ModuleSystemHeatExchanger_Action_ToggleExchanger")]
public void ToggleAction(KSPActionParam param)
{
if (!Enabled) EnableExchanger();
else DisableExchanger();
}

[KSPAction(guiName = "#LOC_SystemHeat_ModuleSystemHeatExchanger_Action_ToggleDirection")]
public void ToggleDirectionAction(KSPActionParam param)
{
DoToggleDirection();
}


protected Renderer onLight;
protected Renderer dirLight;

Expand Down Expand Up @@ -183,12 +213,17 @@ public void FixedUpdate()
}

private void ToggleDirection(BaseField field, object oldFieldValueObj)
{
DoToggleDirection();
}

private void DoToggleDirection()
{
Utils.Log($"[ModuleSystemHeatExchanger] Toggled direction of flow", LogType.Modules);
ModuleSystemHeat saved = sourceModule;
sourceModule = destModule;
destModule = saved;

sourceModule.ignoreTemperature = true;
destModule.ignoreTemperature = false;

Expand All @@ -204,7 +239,6 @@ private void ToggleDirection(BaseField field, object oldFieldValueObj)
dirLight.material.SetColor("_TintColor", XKCDColors.Orange);
}
}

/// <summary>
/// Generates heat in the editor scene
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.5.6
------
- Added action groups to ModuleSystemHeatExchanger for Enable, Disable, Toggle and Toggle Direction

v0.5.5
------
- Fixed a stupid problem
Expand Down

0 comments on commit 416a3c8

Please sign in to comment.