Skip to content

Commit

Permalink
Added a check to see if the vessel speed is >10 m/s, if so, no emissi…
Browse files Browse the repository at this point in the history
…ons. This includes being in Orbit

Added an alwaysOn flag which can be toggled in the editor.  If enabled, vapor will always be on at speeds <= 10 m/s
  • Loading branch information
linuxgurugamer committed Aug 24, 2017
1 parent d509c08 commit b72b9b9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
4 changes: 2 additions & 2 deletions GameData/VaporVent/VaporVent.version
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"VERSION": {
"MAJOR": 1,
"MINOR": 1,
"PATCH": 5,
"BUILD": 1
"PATCH": 6,
"BUILD": 0
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down
1 change: 1 addition & 0 deletions GameData/VaporVent/parts/part.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ PART
MODULE
{
name = makeSteam
alwaysOn = false
}
}
2 changes: 1 addition & 1 deletion Source/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

using System.Reflection;

[assembly: AssemblyVersion("1.1.5.1")]
[assembly: AssemblyVersion("1.1.6.0")]
6 changes: 5 additions & 1 deletion Source/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@

1.1.5
Added buttons and toggle so that the vent can be used on planets, and be activated both
by an action group and manually
by an action group and manually

1.1.6
Added a check to see if the vessel speed is >10 m/s, if so, no emissions. This includes being in Orbit
Added an alwaysOn flag which can be toggled in the editor. If enabled, vapor will always be on at speeds <= 10 m/s
4 changes: 2 additions & 2 deletions Source/VaporVent.version
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"VERSION": {
"MAJOR": 1,
"MINOR": 1,
"PATCH": 5,
"BUILD": 1
"PATCH": 6,
"BUILD": 0
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down
25 changes: 19 additions & 6 deletions Source/makeSteam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ namespace vaporvent
{
public class makeSteam : PartModule
{
List<KSPParticleEmitter> emitter;
[KSPField(guiActiveEditor = true, isPersistant = true)]
[UI_Toggle(enabledText = "Yes", disabledText = "No")]
public bool alwaysOn = false;



List<KSPParticleEmitter> emitter;

bool vaporVisible = false;

Expand All @@ -33,8 +39,15 @@ public void HideSteamEvent()

private void UpdateEvents(bool visible)
{
Events["ShowSteamEvent"].active = !visible;
Events["HideSteamEvent"].active = visible;
if (!alwaysOn)
{
Events["ShowSteamEvent"].active = !visible;
Events["HideSteamEvent"].active = visible;
} else
{
Events["ShowSteamEvent"].active = false;
Events["HideSteamEvent"].active = false;
}
}

[KSPAction("Toggle Vapor Vent")]
Expand All @@ -57,10 +70,10 @@ void PLSteam()
{
foreach(KSPParticleEmitter unit in emitter)
{
if (vaporVisible ) //|| Vessel.Situations.PRELAUNCH == vessel.situation || Vessel.Situations.LANDED == vessel.situation)
if ((vaporVisible || alwaysOn) && vessel.speed < 10 ) //|| Vessel.Situations.PRELAUNCH == vessel.situation || Vessel.Situations.LANDED == vessel.situation)
{
unit.emit = true;
print ("vaporvent: true");
//print ("vaporvent: true");
}
else
{
Expand Down Expand Up @@ -96,7 +109,7 @@ public override void OnStart(StartState state)
foreach (KSPParticleEmitter unit in emitter)
EffectBehaviour.AddParticleEmitter(unit);
GameEvents.onLaunch.Add(onLaunch);

base.OnStart(state);
if (Vessel.Situations.PRELAUNCH == vessel.situation || Vessel.Situations.LANDED == vessel.situation)
{
Expand Down

0 comments on commit b72b9b9

Please sign in to comment.