Skip to content

Commit

Permalink
Fixes a NPE in onGUI check for game state. Didn't guard some variable…
Browse files Browse the repository at this point in the history
…s that was not initialized under intro guide. Bumps version to 0.4.1
  • Loading branch information
alekslt committed Feb 9, 2021
1 parent 7a550a3 commit dc4d1c1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
13 changes: 9 additions & 4 deletions MineralExhaustionNotifier/MinerNotificationUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,16 @@ private static void Init()

public static void OnGUI()
{
if (!isInit && GameMain.isRunning) { Init(); }

var uiGame = BGMController.instance.uiGame;
var shouldShowByGameState = !(uiGame.techTree.active || uiGame.dysonmap.active || uiGame.starmap.active || uiGame.escMenu.active || uiGame.hideAllUI0 || uiGame.hideAllUI1) &&
DSPGame.GameDesc != null && DSPGame.IsMenuDemo == false && DSPGame.Game.running && (UIGame.viewMode == EViewMode.Normal || UIGame.viewMode == EViewMode.Sail);
var shouldShowByGameState = DSPGame.GameDesc != null && uiGame != null && uiGame.gameData != null && uiGame.guideComplete && DSPGame.IsMenuDemo == false && DSPGame.Game.running && (UIGame.viewMode == EViewMode.Normal || UIGame.viewMode == EViewMode.Sail) &&
!(uiGame.techTree.active || uiGame.dysonmap.active || uiGame.starmap.active || uiGame.escMenu.active || uiGame.hideAllUI0 || uiGame.hideAllUI1) && uiGame.gameMenu.active;

if (!shouldShowByGameState)
{
return;
}

if (!isInit && GameMain.isRunning) { Init(); }

if (Show && shouldShowByGameState)
{
Expand Down
2 changes: 1 addition & 1 deletion MineralExhaustionNotifier/MineralExhaustionNotifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace DSPPlugins_ALT
{
[BepInPlugin("net.toppe.bepinex.dsp.veinexhaustion", "Mineral Vein Exhaustion Plug-In", "0.4.0.0")]
[BepInPlugin("net.toppe.bepinex.dsp.veinexhaustion", "Mineral Vein Exhaustion Plug-In", "0.4.1.0")]
public class MineralExhaustionNotifier : BaseUnityPlugin
{
public static bool showDialog = true;
Expand Down
4 changes: 2 additions & 2 deletions MineralExhaustionNotifier/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: AssemblyVersion("0.4.1.0")]
[assembly: AssemblyFileVersion("0.4.1.0")]
3 changes: 3 additions & 0 deletions MineralExhaustionNotifier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ If you have cleared out all faulty miners by default this will allow a popup not

### MineralExhaustionNotified v0.4

* v0.4.1 - Fixes a nullpointer exception when starting a new game.

* Fixed the issue where vein type was none for completely exhausted veins.
* Added textures for the resources/veins and for the menu button.
* Calculate estimated time until exhaustion for the veins.


## Verified working with game versions

* Dyson Sphere Project 0.6.16.5759
Expand Down
8 changes: 8 additions & 0 deletions MineralExhaustionNotifier/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

## MineralExhaustionNotified v0.4.1

* Fixes a nullpointer exception when starting a new game.

### Commit log from 'v0.4' to 'v0.4.1' (most recent changes are listed on top):
e18721e Fixes a NPE in onGUI check for game state. Didn't guard some variables that was not initialized under intro guide. Bumps version to 0.4.1


## MineralExhaustionNotified v0.4

* Fixed the issue where vein type was none for completely exhausted veins.
Expand Down
2 changes: 1 addition & 1 deletion MineralExhaustionNotifier/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MineralExhaustionNotifier",
"version_number": "0.4.0",
"version_number": "0.4.1",
"website_url": "https://github.com/alekslt/DSPPlugins_ALT/tree/master/MineralExhaustionNotifier",
"description": "Tracks miners with problem conditions and shows you a information window with location, problem, and more.",
"dependencies": [
Expand Down

0 comments on commit dc4d1c1

Please sign in to comment.