-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #607 from starfi5h/pr-bugfix0.8.13
Bugfix for nebula 0.8.13
- Loading branch information
Showing
8 changed files
with
124 additions
and
14 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
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,50 @@ | ||
using HarmonyLib; | ||
using NebulaWorld; | ||
using UnityEngine; | ||
|
||
namespace NebulaPatcher.Patches.Dynamic | ||
{ | ||
[HarmonyPatch(typeof(FactoryAudio))] | ||
class FactoryAudio_Patch | ||
{ | ||
[HarmonyPrefix] | ||
[HarmonyPatch(nameof(FactoryAudio.OnEntityBuild))] | ||
public static bool OnEntityBuild_Prefix(FactoryAudio __instance, int objId) | ||
{ | ||
if (Multiplayer.IsActive && Multiplayer.Session.Factories.IsIncomingRequest.Value && objId > 0) | ||
{ | ||
Vector3 pos = __instance.planet.factory.entityPool[objId].pos; | ||
if ((pos - GameMain.mainPlayer.position).sqrMagnitude > (__instance.planet.radius * __instance.planet.radius / 4)) | ||
{ | ||
// Don't make sounds if distance is over half of the planet radius | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
[HarmonyPrefix] | ||
[HarmonyPatch(nameof(FactoryAudio.OnEntityDismantle))] | ||
public static bool OnEntityDismantle_Prefix(FactoryAudio __instance, int objId) | ||
{ | ||
if (Multiplayer.IsActive && Multiplayer.Session.Factories.IsIncomingRequest.Value) | ||
{ | ||
Vector3 pos; | ||
if (objId > 0) | ||
{ | ||
pos = __instance.planet.factory.entityPool[objId].pos; | ||
} | ||
else | ||
{ | ||
pos = __instance.planet.factory.prebuildPool[-objId].pos; | ||
} | ||
if ((pos - GameMain.mainPlayer.position).sqrMagnitude > (__instance.planet.radius * __instance.planet.radius / 4)) | ||
{ | ||
// Don't make sounds if distance is over half of the planet radius | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using HarmonyLib; | ||
using NebulaWorld; | ||
|
||
namespace NebulaPatcher.Patches.Dynamic | ||
{ | ||
[HarmonyPatch(typeof(UIPerformancePanel))] | ||
internal class UIPerformancePanel_Patch | ||
{ | ||
[HarmonyPrefix] | ||
[HarmonyPatch(nameof(UIPerformancePanel.OnDataActiveButtonClick))] | ||
public static bool OnDataActiveButtonClick_Prefix(UIPerformancePanel __instance) | ||
{ | ||
if (Multiplayer.IsActive && Multiplayer.Session.LocalPlayer.IsHost) | ||
{ | ||
// Replace SaveAsLastExit() because it only triggers on UI exit in multiplayer mode | ||
GameSave.SaveCurrentGame(GameSave.LastExit); | ||
__instance.RefreshDataStatTexts(); | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
} |
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
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