Skip to content

Commit

Permalink
Fix NRE in Bomb.TickSkillLogic for client
Browse files Browse the repository at this point in the history
  • Loading branch information
starfi5h committed Jul 19, 2024
1 parent e38d69b commit 8e0a517
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion NebulaPatcher/Patches/Dynamic/SkillSystem_Common_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,20 @@ namespace NebulaPatcher.Patches.Dynamic;
internal class SkillSystem_Common_Patch
{
[HarmonyPrefix]
[HarmonyPatch(typeof(GeneralShieldBurst), nameof(GeneralShieldBurst.TickSkillLogic))]
[HarmonyPatch(typeof(Bomb_Explosive), nameof(Bomb_Explosive.TickSkillLogic))]
[HarmonyPatch(typeof(Bomb_Liquid), nameof(Bomb_Liquid.TickSkillLogic))]
[HarmonyPatch(typeof(Bomb_EMCapsule), nameof(Bomb_EMCapsule.TickSkillLogic))]
public static void Bomb_TickSkillLogic(ref int ___nearPlanetAstroId, ref int ___life)
{
if (___nearPlanetAstroId > 0 && GameMain.spaceSector.skillSystem.astroFactories[___nearPlanetAstroId] == null)
{
// The nearest planetFactory hasn't loaded yet, skip and remove
___life = 0;
}
}

[HarmonyPrefix]
[HarmonyPatch(typeof(GeneralShieldBurst), nameof(GeneralShieldBurst.TickSkillLogic))]
public static bool GeneralShieldBurst_Prefix(ref GeneralShieldBurst __instance, SkillSystem skillSystem)
{
if (!Multiplayer.IsActive || __instance.caster.type != ETargetType.Player) return true;
Expand Down

0 comments on commit 8e0a517

Please sign in to comment.