Skip to content

Commit

Permalink
added try catch to all patches
Browse files Browse the repository at this point in the history
  • Loading branch information
XtraCube committed Jan 9, 2021
1 parent bac579e commit 624c467
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions SmolMod/SmolMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ public static class PlayerControlFixedUpdatePatch
{
public static void Postfix(PlayerControl __instance)
{
if (__instance.CurrentPet.transform.localScale.x < petSize)
try
{
foreach (PlayerControl player in PlayerControl.AllPlayerControls)
if (__instance.CurrentPet.transform.localScale.x < petSize)
{
player.CurrentPet.transform.localScale = new Vector3(petSize, petSize, player.CurrentPet.transform.localScale.z);
foreach (PlayerControl player in PlayerControl.AllPlayerControls)
{
player.CurrentPet.transform.localScale = new Vector3(petSize, petSize, player.CurrentPet.transform.localScale.z);
}
}
}
catch { }
}
}

Expand Down Expand Up @@ -125,7 +129,11 @@ public static class ShipStatusAwakePatch
{
public static void Prefix(ShipStatus __instance)
{
SetMapSize(__instance);
try
{
SetMapSize(__instance);
}
catch { }
}
}

Expand All @@ -134,40 +142,56 @@ public static class ShipStatusBeginPatch
{
public static void Prefix(ShipStatus __instance)
{
SetMapSize(__instance);
}
try
{
SetMapSize(__instance);
}
catch { }
}
}

[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.FixedUpdate))]
public static class MapSizePatch
{
public static void Postfix(ShipStatus __instance)
{
if (__instance.MapScale < mapScale)
try
{
SetMapSize(__instance);
if (__instance.MapScale < mapScale)
{
SetMapSize(__instance);
}
}
catch { }
}
}

[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Update))]
public static class MeetingHudPlayerSizePatch
{
public static void Postfix(MeetingHud __instance)
{
foreach (var playerVoteArea in __instance.playerStates)
{ try
{
playerVoteArea.PlayerIcon.transform.localScale = new Vector3(iconSize, iconSize, playerVoteArea.PlayerIcon.transform.localScale.z);

foreach (var playerVoteArea in __instance.playerStates)
{
playerVoteArea.PlayerIcon.transform.localScale = new Vector3(iconSize, iconSize, playerVoteArea.PlayerIcon.transform.localScale.z);
}
}
catch { }
}
}
}

[HarmonyPatch(typeof(MapBehaviour), nameof(MapBehaviour.FixedUpdate))]
public static class MapBehaviourUpdatePatch
{
public static void Postfix(MapBehaviour __instance)
{
__instance.HerePoint.transform.localScale = new Vector3(iconSize, iconSize, __instance.HerePoint.transform.localScale.z);
try
{
__instance.HerePoint.transform.localScale = new Vector3(iconSize, iconSize, __instance.HerePoint.transform.localScale.z);
}
catch { }
}
}

Expand Down

0 comments on commit 624c467

Please sign in to comment.