forked from NebulaModTeam/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for remote factory loading, games lacks a nullptr check.
- Loading branch information
1 parent
19e3c4e
commit e9d2f3c
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
NebulaPatcher/Patches/Dynamic/UIPowerGizmo_OnUpdate_Patch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using HarmonyLib; | ||
|
||
/* | ||
* This Patch is part of the remote factory loading process. | ||
* As the client requests the factory the localPlanet is already set by the ArrivePlanet() method. | ||
* As UIPowerGizmo::_OnUpdate() lacks a null check on the factory of the localPlanet we need to do that here | ||
* because the factory data may not be received/loaded by this time. | ||
*/ | ||
namespace NebulaPatcher.Patches.Dynamic | ||
{ | ||
class UIPowerGizmo_OnUpdate_Patch | ||
{ | ||
[HarmonyPatch(typeof(UIPowerGizmo), "_OnUpdate")] | ||
class OnUpdatePatch | ||
{ | ||
public static bool Prefix() | ||
{ | ||
if(GameMain.localPlanet?.factory == null) | ||
{ | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
} | ||
} |