From 448891ba7fc8830a29f8b7cd4461ade8ca182e85 Mon Sep 17 00:00:00 2001 From: zer0Kerbal <39887717+zer0Kerbal@users.noreply.github.com> Date: Sun, 5 Apr 2020 17:18:40 -0500 Subject: [PATCH] 2.0.4.0 --- ChangeLog.cfg | 13 ++- GameData/SimpleLogistics/2032.htm | 91 --------------- GameData/SimpleLogistics/2040.htm | 68 +++++++++++ GameData/SimpleLogistics/ChangeLog.cfg | 13 ++- Releases/2040.htm | 68 +++++++++++ Releases/2040.md | 79 +++++++++++++ Source/LogisticsModule.cs | 41 ++++--- Source/Properties/AssemblyFileVersion.cs | 4 +- Source/SimpleLogistics.cs | 143 +++++++++++------------ 9 files changed, 328 insertions(+), 192 deletions(-) delete mode 100644 GameData/SimpleLogistics/2032.htm create mode 100644 GameData/SimpleLogistics/2040.htm create mode 100644 Releases/2040.htm create mode 100644 Releases/2040.md diff --git a/ChangeLog.cfg b/ChangeLog.cfg index 404faff..2860180 100644 --- a/ChangeLog.cfg +++ b/ChangeLog.cfg @@ -10,11 +10,13 @@ KERBALCHANGELOG versionName = New Situations and New Versions change = DO A CLEAN INSTALL: DELETE EXISTING THEN RE-INSTALL change = compile for KSP 1.9.1 + change = Special Thank you to @LinuxGuruGamer for all his assistance and patience. CHANGE { change = CODE subChange = remove old GUI code - subChange = + subChange = updated PAW to use grouping, included .dll version in label + subChange = IsActive = True *should* now be working from within part.module } CHANGE { @@ -23,6 +25,15 @@ KERBALCHANGELOG subChange = added option in game.settings to switch between Unity and KSP subChange = thank you to @LinuxGuruGamer } + CHANGE + { + change = Features, Feature, and MORE Features + subChange = Working: + subChange = Vessel limitations + subChange = Vessel limitiations + subChange = Not Working: + subChange = range limitations + } } VERSION { diff --git a/GameData/SimpleLogistics/2032.htm b/GameData/SimpleLogistics/2032.htm deleted file mode 100644 index 4e44385..0000000 --- a/GameData/SimpleLogistics/2032.htm +++ /dev/null @@ -1,91 +0,0 @@ - -

Mod Version -KSP version KSP-AVC License GPLv3
-Code Validate AVC .version files

-
-

Version 2.0.3.2 - Deployable Serenity

- -

Mini-NUK-PD Radioisotope Thermoelectric Generator (DeployedRTG)

- -

OX-Stat-PD Photovoltaic Panel (DeployedSolarPanel)

- -

Add SimpleLogistics! to KAS PrtPylonPwer (so anything attached can draw power)

- - - -

Deployment and Backend

- -
-

See Full Changelog for full details of changes
-See Known Issues for known issues

-
-
-

red box below is a link to forum post on how to get support
-How to get support

-

-
-

Kerbal Space Program 1.7.3
-Unity 2017.1.3p1.
-.NET Framework 3.5

- *Be Kind: Lithobrake, not jakebrake! Keep your Module Manager up to date* - - - - - diff --git a/GameData/SimpleLogistics/2040.htm b/GameData/SimpleLogistics/2040.htm new file mode 100644 index 0000000..c8ea472 --- /dev/null +++ b/GameData/SimpleLogistics/2040.htm @@ -0,0 +1,68 @@ + +

Mod Version +KSP version:static KSP-AVC License GPLv3
+Code Validate AVC .version files

+
+

Version 2.0.4.0 - New Situations and New Versions

+ +

CODE

+ +

UI

+ +

Features, Feature, and MORE Features

+

Working:

+ +

Not Working:

+ +
+
+

See Full Changelog for full details of changes
+See Known Issues for known issues

+
+
+

red box below is a link to forum post on how to get support
+How to get support

+

+
+

Kerbal Space Program 1.9.1
+Unity 2019.2.2f1
+.NET Framework 4.8

+ *Be Kind: Lithobrake, not jakebrake! Keep your Module Manager up to date* +

+
+ + + + + +
+ + created with the free version of + Markdown Monster +
diff --git a/GameData/SimpleLogistics/ChangeLog.cfg b/GameData/SimpleLogistics/ChangeLog.cfg index 404faff..2860180 100644 --- a/GameData/SimpleLogistics/ChangeLog.cfg +++ b/GameData/SimpleLogistics/ChangeLog.cfg @@ -10,11 +10,13 @@ KERBALCHANGELOG versionName = New Situations and New Versions change = DO A CLEAN INSTALL: DELETE EXISTING THEN RE-INSTALL change = compile for KSP 1.9.1 + change = Special Thank you to @LinuxGuruGamer for all his assistance and patience. CHANGE { change = CODE subChange = remove old GUI code - subChange = + subChange = updated PAW to use grouping, included .dll version in label + subChange = IsActive = True *should* now be working from within part.module } CHANGE { @@ -23,6 +25,15 @@ KERBALCHANGELOG subChange = added option in game.settings to switch between Unity and KSP subChange = thank you to @LinuxGuruGamer } + CHANGE + { + change = Features, Feature, and MORE Features + subChange = Working: + subChange = Vessel limitations + subChange = Vessel limitiations + subChange = Not Working: + subChange = range limitations + } } VERSION { diff --git a/Releases/2040.htm b/Releases/2040.htm new file mode 100644 index 0000000..c8ea472 --- /dev/null +++ b/Releases/2040.htm @@ -0,0 +1,68 @@ + +

Mod Version +KSP version:static KSP-AVC License GPLv3
+Code Validate AVC .version files

+
+

Version 2.0.4.0 - New Situations and New Versions

+
    +
  • <color = red>DO A CLEAN INSTALL: DELETE EXISTING THEN RE-INSTALL
  • +
  • compile for KSP 1.9.1
  • +
  • Special Thank you to @LinuxGuruGamer for all his assistance and patience.
  • +
+

CODE

+
    +
  • remove old GUI code
  • +
  • updated PAW to use grouping, included .dll version in label
  • +
  • IsActive = True should now be working from within part.module
  • +
+

UI

+
    +
  • removed old pastel skin
  • +
  • added option in game.settings to switch between Unity and KSP
  • +
  • thank you to @LinuxGuruGamer
  • +
+

Features, Feature, and MORE Features

+

Working:

+
    +
  • Vessel limitations
  • +
  • Vessel limitiations
  • +
+

Not Working:

+
    +
  • range limitations
  • +
+
+
+

See Full Changelog for full details of changes
+See Known Issues for known issues

+
+
+

red box below is a link to forum post on how to get support
+How to get support

+

+
+

Kerbal Space Program 1.9.1
+Unity 2019.2.2f1
+.NET Framework 4.8

+ *Be Kind: Lithobrake, not jakebrake! Keep your Module Manager up to date* +

+
+ + + + + +
+ + created with the free version of + Markdown Monster +
diff --git a/Releases/2040.md b/Releases/2040.md new file mode 100644 index 0000000..5656c5a --- /dev/null +++ b/Releases/2040.md @@ -0,0 +1,79 @@ + +[![Mod Version][shield:mod:static]][MOD:forum] +[![KSP version:static][shield:ksp]][KSP:website] ![KSP-AVC][shield:kspavc] [![License GPLv3][shield:license]][LINK:license] [![][LOGO:gplv3]][LINK:license] +![Code][shield:code] ![Validate AVC .version files][shield:avcvalid] +*** +# Version 2.0.4.0 - New Situations and New Versions +- DO A CLEAN INSTALL: DELETE EXISTING THEN RE-INSTALL +- compile for KSP 1.9.1 +- Special Thank you to @LinuxGuruGamer for all his assistance and patience. +### CODE +- remove old GUI code +- updated PAW to use grouping, included .dll version in label +- IsActive = True *should* now be working from within part.module +### UI +- removed old pastel skin +- added option in game.settings to switch between Unity and KSP +- thank you to @LinuxGuruGamer +### Features, Feature, and MORE Features +#### Working: +- Vessel limitations +- Vessel limitiations +#### Not Working: +- range limitations +*** +> See [Full Changelog][MOD:changelog] for full details of changes +> See [Known Issues][MOD:issues] for known issues +*** +*red box below is a link to forum post on how to get support* +[![How to get support][image:get-support]][thread:getsupport] + +![][HERO:0] +*** +

Kerbal Space Program 1.9.1
+Unity 2019.2.2f1
+.NET Framework 4.8

+ *Be Kind: Lithobrake, not jakebrake! Keep your Module Manager up to date* + +![][HERO:1] ![][HERO:2] ![][HERO:3] +*** + + +[MOD:license]: https://github.com/zer0Kerbal/SimpleLogistics/blob/master/LICENSE +[MOD:issues]: https://github.com/zer0Kerbal/SimpleLogistics/issues +[MOD:known]: https://github.com/zer0Kerbal/SimpleLogistics/wiki/Known-Issues +[MOD:forum]: https://forum.kerbalspaceprogram.com/index.php?/topic/191045-* +[MOD:changelog]: https://raw.githubusercontent.com/zer0Kerbal/SimpleLogistics/master/Changelog.cfg +[KSP:website]: http://kerbalspaceprogram.com/ + +[shield:mod:static]: https://img.shields.io/badge/SimpleLogistics%20version-2.0.4.0-orange.svg?style=plastic +[shield:ksp:static]: https://img.shields.io/badge/KSP-1.9.1-blue.svg?style=plastic +[shield:mod:latest]: https://img.shields.io/github/v/release/zer0Kerbal/SimpleLogistics?include_prereleases?style=plastic +[shield:mod]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/zer0Kerbal/SimpleLogistics/master/json/mod.json +[shield:ksp]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/zer0Kerbal/SimpleLogistics/master/json/ksp.json +[shield:license]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/zer0Kerbal/SimpleLogistics/master/json/license.json +[shield:code]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/zer0Kerbal/SimpleLogistics/master/json/code.json +[shield:kspavc]: https://img.shields.io/badge/KSP-AVC--supported-brightgreen.svg?style=plastic +[shield:avcvalid]: https://github.com/zer0Kerbal/SimpleLogistics/workflows/Validate%20AVC%20.version%20files/badge.svg + +[image:get-support]: https://i.postimg.cc/vHP6zmrw/image.png + +[LINK:license]: https://www.gnu.org/licenses/gpl-3.0-standalone.html "GPLv3" +[thread:getsupport]: https://forum.kerbalspaceprogram.com/index.php?/topic/83212-* + + +[LOGO:gplv3]: https://i.postimg.cc/90kCDs7K/gplv3-48x17.png + + +[HERO:0]: https://i.postimg.cc/GmZ77BYt/Settings2-0-4-0.png "New Features" +[HERO:1]: https://i.postimg.cc/nrRTvMpH/Skin-A2-0-4-0.png "New Skin" +[HERO:2]: https://i.postimg.cc/XNQ2M1FT/Skin-U2-0-4-0.png "New Skin" +[HERO:3]: https://i.postimg.cc/vBLmKmG5/Screen-Msg-New.png "New Situations" + + \ No newline at end of file diff --git a/Source/LogisticsModule.cs b/Source/LogisticsModule.cs index dcdd8b9..68b120d 100644 --- a/Source/LogisticsModule.cs +++ b/Source/LogisticsModule.cs @@ -9,27 +9,31 @@ namespace SimpleLogistics [Serializable] public class LogisticsModule: PartModule { - [KSPField(isPersistant = true, guiName = "#SimpleLogistics_Module_Plugged", guiActive = true)] //Plugged In? - private bool _isActive = false; + [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "#SimpleLogistics_Module_Plugged", groupName = "SimpleLogistics", //Plugged In? + groupDisplayName = "SimpleLogistics! v " + Version.Text, groupStartCollapsed = true)] + public bool _isActive = false; [SerializeField] public bool IsActive { get { return _isActive; } } - [KSPEvent(guiActive = true, guiName = "#SimpleLogistics_Module_PluggedNet")] //Plug into Network - private void Toggle() { - _isActive = !_isActive; - } + public void Set(bool status) + { _isActive = status; } - public void Set(bool status) { - _isActive = status; - } - + [KSPEvent(guiActive = true, guiActiveEditor = true, guiName = "#SimpleLogistics_Module_PluggedNet", groupName = "SimpleLogistics")] //Plug into Network + internal void Toggle() + { _isActive = !_isActive; } + + public override string ToString() + { return _isActive ? "false" : "true"; } + +#region Var Const Enums /// Module information shown in editors private string info = string.Empty; +#endregion public override string GetInfo() { - //? this is what is show in the editor + //? this is what is shown in the editor //? As annoying as it is, pre-parsing the config MUST be done here, because this is called during part loading. //? The config is only fully parsed after everything is fully loaded (which is why it's in OnStart()) if (info == string.Empty) @@ -40,16 +44,16 @@ public override string GetInfo() } return info; } - - public override void OnStart(PartModule.StartState state) +#region On Event + public override void OnStart(PartModule.StartState state) { - Logs.dbg("On Start"); + Logs.dbg("On Start " + state.ToString()); } // LGG public new void Load(ConfigNode node) { - bool b; + bool b = false; if (node.HasValue("isActive") && bool.TryParse(node.GetValue("isActive"), out b)) { Set(b); @@ -63,11 +67,6 @@ public override void OnStart(PartModule.StartState state) node.AddValue("isActive", _isActive); base.Save(node); // LGG } - - public override string ToString() - { - return IsActive ? "true" : "false"; - - } +#endregion } } diff --git a/Source/Properties/AssemblyFileVersion.cs b/Source/Properties/AssemblyFileVersion.cs index 424d4d6..a385fc5 100644 --- a/Source/Properties/AssemblyFileVersion.cs +++ b/Source/Properties/AssemblyFileVersion.cs @@ -1,4 +1,4 @@ -//3 +//8 // // This code was generated by a tool. Any changes made manually will be lost // the next time this code is regenerated. @@ -6,4 +6,4 @@ using System.Reflection; -[assembly: AssemblyFileVersion("2.0.4.3")] \ No newline at end of file +[assembly: AssemblyFileVersion("2.0.4.8")] \ No newline at end of file diff --git a/Source/SimpleLogistics.cs b/Source/SimpleLogistics.cs index b877799..9ff76e0 100644 --- a/Source/SimpleLogistics.cs +++ b/Source/SimpleLogistics.cs @@ -30,16 +30,19 @@ public class SimpleLogistics: MonoBehaviour private Rect windowRect; private int windowId; private bool gamePaused; - private bool globalHidden; - private bool active; - private bool refresh; + private bool GUIglobalHidden; + private bool GUIactive; + private bool refreshGUI; + + private static Color titleColor = new Color(45f, 145f, 17f, 1f); + private static Color titleBackColor = new Color(45f, 145f, 17f, 0.45f); private ToolbarControl toolbarControl; // Same as Debug Toolbar lock mask private const ulong lockMask = 900719925474097919; -#region Primary Functions +#region On Events private void Awake() { if (instance != null) @@ -65,16 +68,16 @@ private void Start() windowId = GUIUtility.GetControlID(FocusType.Passive); - globalHidden = false; + GUIglobalHidden = false; gamePaused = false; - active = false; - refresh = true; + GUIactive = false; + refreshGUI = true; requested = false; CreateLauncher(); - GameEvents.onLevelWasLoaded.Add (onLevelWasLoaded); GameEvents.onVesselChange.Add (onVesselChange); + GameEvents.onLevelWasLoaded.Add (onLevelWasLoaded); GameEvents.onHideUI.Add(onHideUI); GameEvents.onShowUI.Add(onShowUI); GameEvents.onGamePause.Add (onGamePause); @@ -99,8 +102,10 @@ private void OnDestroy() if (instance == this) instance = null; } +#endregion - private void onVesselChange(Vessel vessel) +#region Game Events + private void onVesselChange(Vessel vessel) { requestPool.Clear (); vesselSpareSpace.Clear (); @@ -124,7 +129,7 @@ public void onLevelWasLoaded(GameScenes scene) onVesselChange(FlightGlobals.ActiveVessel); } - #endregion +#endregion #region UI Functions @@ -154,25 +159,24 @@ public void DestroyLauncher() public void OnGUI() { - if (gamePaused || globalHidden || !active) return; + if (gamePaused || GUIglobalHidden || !GUIactive) return; - // if (FlightGlobals.ActiveVessel.situation != Vessel.Situations.LANDED) { - - string test = InSituation.NetworkEligible(FlightGlobals.ActiveVessel); - if (!String.IsNullOrEmpty(test)) + string IsEligible = InSituation.NetworkEligible(FlightGlobals.ActiveVessel); + if (!String.IsNullOrEmpty(IsEligible)) { toolbarControl.SetFalse(); - Logs.msg(test); + Logs.msg(IsEligible); } - if (refresh) + if (refreshGUI) { windowRect.height = 0; - refresh = false; + refreshGUI = false; } if (HighLogic.CurrentGame.Parameters.CustomParams().useAlternateSkin) GUI.skin = HighLogic.Skin; - + GUI.backgroundColor = titleBackColor; + GUI.contentColor = titleColor; windowRect = ClickThruBlocker.GUILayoutWindow( windowId, windowRect, @@ -192,63 +196,51 @@ public void OnGUI() private void DrawGUI(int windowId) { GUILayout.BeginVertical (); + GUI.contentColor = Color.blue; + GUILayout.Label(Localizer.Format("#SimpleLogistics_VesselName", FlightGlobals.ActiveVessel.GetDisplayName())); + GUILayout.Label(Localizer.Format("#SimpleLogistics_Status", FlightGlobals.ActiveVessel.SituationString)); + + bool ableToRequest = false; + LogisticsModule lm = FlightGlobals.ActiveVessel.FindPartModuleImplementing (); + if (lm != null) + { GUILayout.BeginHorizontal(); - GUILayout.Label(Localizer.Format("#SimpleLogistics_VesselName", FlightGlobals.ActiveVessel.GetDisplayName())); - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.Label(Localizer.Format("#SimpleLogistics_Status", FlightGlobals.ActiveVessel.SituationString)); - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - bool ableToRequest = false; - LogisticsModule lm = FlightGlobals.ActiveVessel.FindPartModuleImplementing (); - if (lm != null) + GUILayout.Label( + lm.IsActive ? Localizer.Format("#SimpleLogistics_Label2") : Localizer.Format("#SimpleLogistics_Label3") //, //"Pluged In""Unplugged" + //lm.IsActive ? GUI.contentColor = Color.green : GUI.contentColor = Color.red + ); + GUILayout.FlexibleSpace(); + GUI.contentColor = Color.yellow; + if (GUILayout.Button(Localizer.Format("#SimpleLogistics_Label4"))) // "Toggle Plug" { - GUILayout.Label( - lm.IsActive ? Localizer.Format("#SimpleLogistics_Label3") : Localizer.Format("#SimpleLogistics_Label2") //, //"Pluged In""Unplugged" - // lm.IsActive ? GUILayout. GUILayoutOpt Palette.green : Palette.red - ); - - GUILayout.FlexibleSpace(); - if (GUILayout.Button("" + Localizer.Format("#SimpleLogistics_Label4") + "")) // "Toggle Plug" - { - lm.Set (!lm.IsActive); - refresh = true; - } - - GUILayout.FlexibleSpace(); - ableToRequest = !lm.IsActive; + lm.Toggle();// Set (!lm.IsActive); + refreshGUI = true; } + GUILayout.FlexibleSpace(); + GUI.contentColor = Color.white; GUILayout.EndHorizontal(); + // if plugged in - not able to request + ableToRequest = !lm.IsActive; + } - if (ableToRequest) - GetVesselSpareSpace(); + //if (ableToRequest) + GetVesselSpareSpace(); + + GUI.contentColor = Color.yellow; + GUILayout.Label(Localizer.Format("#SimpleLogistics_Label5")); //"Resource Pool:" - GUILayout.BeginHorizontal(); - //Layout.LabelCentered(Localizer.Format("#SimpleLogistics_Label5"), Palette.yellow); //"Resource Pool:" - GUILayout.Label(Localizer.Format("#SimpleLogistics_Label5")); //"Resource Pool:" - GUILayout.EndHorizontal(); - GUILayout.EndVertical(); - GUILayout.BeginVertical(); foreach (var resource in resourcePool) { GUILayout.BeginHorizontal(); - GUILayout.Label(resource.Key, GUILayout.Width(170)); if (ableToRequest && requestPool.ContainsKey(resource.Key)) - { - GUILayout.Label(requestPool[resource.Key].ToString("0.00") + " / " + - resource.Value.ToString ("0.00")); - //GUILayout.FlexibleSpace(); - } - else - { - //TODO: *knocking on wood that this woorks. - /* if (GUILayout.Button(resourcePool[resource.Key].ToString("0.00"))) - // depositResource(PartResourceLibrary.Instance.GetDefinition(resource.Key.ToString()) ); - depositResource(PartResourceLibrary.Instance.GetDefinition(resource.Key.ToString()) );*//* -*/ - GUILayout.Label(resource.Value.ToString("0.00")); - } + GUILayout.Label(requestPool[resource.Key].ToString("0.00") + " / " + resource.Value.ToString ("0.00")); + else GUILayout.Label(resource.Value.ToString("0.00")); + //TODO: *knocking on wood that this woorks. + /* if (GUILayout.Button(resourcePool[resource.Key].ToString("0.00"))) + // depositResource(PartResourceLibrary.Instance.GetDefinition(resource.Key.ToString()) ); + depositResource(PartResourceLibrary.Instance.GetDefinition(resource.Key.ToString()) );*//* + */ GUILayout.EndHorizontal(); if (ableToRequest && requestPool.ContainsKey(resource.Key)) { @@ -256,7 +248,7 @@ private void DrawGUI(int windowId) if (GUILayout.Button("0", GUILayout.Width(20))) requestPool[resource.Key] = 0; - requestPool[resource.Key] = GUILayout.HorizontalSlider( + requestPool[resource.Key] = GUILayout.HorizontalSlider ( (float)requestPool[resource.Key], 0, (float)Math.Min (vesselSpareSpace [resource.Key], resource.Value), @@ -296,13 +288,13 @@ public void onGameUnpause() private void onHideUI() { - globalHidden = true; + GUIglobalHidden = true; UnlockControls (); } private void onShowUI() { - globalHidden = false; + GUIglobalHidden = false; } public void onAppTrue() @@ -314,13 +306,13 @@ public void onAppTrue() return; } - active = true; + GUIactive = true; } public void onAppFalse() { - active = false; - refresh = true; + GUIactive = false; + refreshGUI = true; UnlockControls (); } @@ -333,10 +325,10 @@ internal virtual void onToggle() return; } - active = !active; - if (!active) + GUIactive = !GUIactive; + if (!GUIactive) { - refresh = true; + refreshGUI = true; UnlockControls (); } } @@ -365,8 +357,7 @@ private void FixedUpdate() } LogisticsModule lm = vessel.FindPartModuleImplementing (); - if (lm != null) - if (!lm.IsActive) + if (lm != null && !lm.IsActive) { Logs.dbg("{0} not pluged in\n", vessel.GetDisplayName()); continue;