Skip to content

Commit b22ea81

Browse files
Merge pull request #500 from hubastard/fix-exploration
2 parents 2324c64 + acf72f1 commit b22ea81

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
## Changelog
22

3-
0.8.0:
3+
0.7.10:
44

55
- @starfish: Added WarningSystem syncing
66
- @PhantomGamers: Fixed case of NRE when arriving on another planet
7+
- @PhantomGamers: Fixed issue where Universe Exploration tech would break while in a multiplayer game
78

89
0.7.9:
910

NebulaPatcher/Patches/Dynamic/UIPlanetDetail_Patch.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ namespace NebulaPatcher.Patches.Dynamic
99
[HarmonyPatch(typeof(UIPlanetDetail))]
1010
internal class UIPlanetDetail_Patch
1111
{
12-
private static int BackupUniverseObserveLevel = -1;
13-
1412
[HarmonyPostfix]
1513
[HarmonyPatch(nameof(UIPlanetDetail.OnNameInputEndEdit))]
1614
public static void OnNameInputEndEdit_Postfix(UIPlanetDetail __instance)
@@ -58,10 +56,9 @@ public static bool _OnUpdate_Prefix(UIPlanetDetail __instance)
5856
[HarmonyPatch(nameof(UIPlanetDetail.RefreshDynamicProperties))]
5957
public static bool OnPlanetDataSet_Prefix(UIPlanetDetail __instance)
6058
{
61-
if(UIRoot.instance.galaxySelect.starmap.clickText != "")
59+
if(Multiplayer.IsActive && Multiplayer.Session.IsInLobby)
6260
{
63-
BackupUniverseObserveLevel = GameMain.history.universeObserveLevel;
64-
GameMain.history.universeObserveLevel = 3;
61+
GameMain.history.universeObserveLevel = 4;
6562
}
6663
return true;
6764
}
@@ -71,10 +68,9 @@ public static bool OnPlanetDataSet_Prefix(UIPlanetDetail __instance)
7168
[HarmonyPatch(nameof(UIPlanetDetail.RefreshDynamicProperties))]
7269
public static void OnPlanetDataSet_Postfix(UIPlanetDetail __instance)
7370
{
74-
if(BackupUniverseObserveLevel != -1)
71+
if(Multiplayer.IsActive && Multiplayer.Session.IsInLobby)
7572
{
76-
GameMain.history.universeObserveLevel = BackupUniverseObserveLevel;
77-
BackupUniverseObserveLevel = -1;
73+
GameMain.history.universeObserveLevel = SimulatedWorld.GetUniverseObserveLevel();
7874
}
7975
}
8076
}

NebulaWorld/MultiplayerSession.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ public void OnGameLoadCompleted()
140140
Log.Info("Game load completed");
141141
IsGameLoaded = true;
142142

143+
if (Multiplayer.Session.LocalPlayer.IsHost)
144+
{
145+
GameMain.history.universeObserveLevel = SimulatedWorld.GetUniverseObserveLevel();
146+
}
147+
143148
if (Multiplayer.Session.LocalPlayer.IsInitialDataReceived)
144149
{
145150
Multiplayer.Session.World.SetupInitialPlayerState();

NebulaWorld/SimulatedWorld.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,5 +651,21 @@ public void SetPauseIndicator(bool canPause)
651651
}
652652

653653
}
654+
655+
public static int GetUniverseObserveLevel()
656+
{
657+
int level = 0;
658+
// the tech ids of the 4 tiers of Universe Exploration from https://dsp-wiki.com/Upgrades
659+
for (int i = 4104; i >= 4101; i--)
660+
{
661+
if (GameMain.history.TechUnlocked(i))
662+
{
663+
// set level to last digit of tech id
664+
level = (i % 10);
665+
break;
666+
}
667+
}
668+
return level;
669+
}
654670
}
655671
}

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "0.7.9",
3+
"version": "0.7.10",
44
"assemblyVersion": {
55
"precision": "build"
66
},

0 commit comments

Comments
 (0)