Skip to content

Commit

Permalink
Update the toolbar wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed Apr 29, 2016
1 parent 2400c69 commit 72d5096
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
4 changes: 2 additions & 2 deletions MechJeb2/MechJebModuleThrustController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,11 @@ public override void Drive(FlightCtrlState s)
}
}

// Only set throttle if a module need it. Othewise let the user or other mods set it
// Only set throttle if a module need it. Otherwise let the user or other mods set it
// There is always at least 1 user : the module itself (why ?)
if (users.Count() > 1)
s.mainThrottle = targetThrottle;

float throttleLimit = 1;

limiter = LimitMode.None;
Expand Down
37 changes: 17 additions & 20 deletions MechJeb2/ToolbarWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013-2014, Maik Schreiber
Copyright (c) 2013-2016, Maik Schreiber
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Expand All @@ -23,11 +23,11 @@
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine;


// TODO: Change to your plugin's namespace here.
Expand All @@ -37,16 +37,16 @@ namespace MuMech


/**********************************************************\
* --- DO NOT EDIT BELOW THIS COMMENT --- *
* *
* This file contains classes and interfaces to use the *
* Toolbar Plugin without creating a hard dependency on it. *
* *
* There is nothing in this file that needs to be edited *
* by hand. *
* *
* --- DO NOT EDIT BELOW THIS COMMENT --- *
\**********************************************************/
* --- DO NOT EDIT BELOW THIS COMMENT --- *
* *
* This file contains classes and interfaces to use the *
* Toolbar Plugin without creating a hard dependency on it. *
* *
* There is nothing in this file that needs to be edited *
* by hand. *
* *
* --- DO NOT EDIT BELOW THIS COMMENT --- *
\**********************************************************/



Expand Down Expand Up @@ -430,14 +430,12 @@ bool Visible
/// <example>
/// <code>
/// IButton button = ...
/// button.Visibility = new GameScenesVisibility(GameScenes.EDITOR, GameScenes.SPH);
/// button.Visibility = new GameScenesVisibility(GameScenes.EDITOR, GameScenes.FLIGHT);
/// </code>
/// </example>
/// <seealso cref="IButton.Visibility"/>
public class GameScenesVisibility : IVisibility
{
private GameScenes[] gameScenes;

public bool Visible
{
get
Expand All @@ -454,7 +452,6 @@ public GameScenesVisibility(params GameScenes[] gameScenes)
Type gameScenesVisibilityType = ToolbarTypes.getType("Toolbar.GameScenesVisibility");
realGameScenesVisibility = Activator.CreateInstance(gameScenesVisibilityType, new object[] { gameScenes });
visibleProperty = ToolbarTypes.getProperty(gameScenesVisibilityType, "Visible");
this.gameScenes = gameScenes;
}
}

Expand Down Expand Up @@ -715,9 +712,9 @@ public IDrawable Drawable
if (value != null)
{
functionDrawable = Activator.CreateInstance(types.functionDrawableType, new object[] {
new Action(() => value.Update()),
new Func<Vector2, Vector2>((pos) => value.Draw(pos))
});
new Action(() => value.Update()),
new Func<Vector2, Vector2>((pos) => value.Draw(pos))
});
}
types.button.drawableProperty.SetValue(realButton, functionDrawable, null);
drawable_ = value;
Expand Down

0 comments on commit 72d5096

Please sign in to comment.