Skip to content

Commit

Permalink
Fixes Anti-Grief Logic Bug
Browse files Browse the repository at this point in the history
- Fixes logical error with last commit
- Adds better call-out to offending method for errors
  • Loading branch information
data-bomb committed Dec 29, 2024
1 parent 6e17744 commit 2a96e57
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Si_AntiGrief/Si_AntiGrief.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ You should have received a copy of the GNU General Public License
using System.Linq;
using UnityEngine;

[assembly: MelonInfo(typeof(AntiGrief), "Anti-Grief", "1.4.2", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonInfo(typeof(AntiGrief), "Anti-Grief", "1.4.3", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonGame("Bohemia Interactive", "Silica")]
[assembly: MelonOptionalDependencies("Admin Mod")]

Expand Down Expand Up @@ -187,9 +187,9 @@ public static void Postfix(GameMode __instance, Unit __result, Player __0, Unity

// GetIndex() will return -1 if this is not a valid player on the list
int playerIndex = __0.GetIndex();
if (IsPlayerIndexValid(playerIndex))
if (!IsPlayerIndexValid(playerIndex))
{
MelonLogger.Error("player index found outside of bounds: " + playerIndex);
MelonLogger.Error("Player Index found outside of bounds (SpawnUnitForPlayer): " + playerIndex);
return;
}

Expand Down Expand Up @@ -246,9 +246,9 @@ public void OnRequestEnterUnit(object? sender, OnRequestEnterUnitArgs args)

// GetIndex() will return -1 if this is not a valid player on the list
int playerIndex = player.GetIndex();
if (IsPlayerIndexValid(playerIndex))
if (!IsPlayerIndexValid(playerIndex))
{
MelonLogger.Error("Player index found outside of bounds: " + playerIndex);
MelonLogger.Error("Player Index found outside of bounds (OnRequestEnterUnit): " + playerIndex);
return;
}

Expand Down Expand Up @@ -287,9 +287,9 @@ public static bool ShouldDeletePriorUnit(Player player)
{
// GetIndex() will return -1 if this is not a valid player on the list
int playerIndex = player.GetIndex();
if (IsPlayerIndexValid(playerIndex))
if (!IsPlayerIndexValid(playerIndex))
{
MelonLogger.Error("Player Index found outside of bounds: " + playerIndex);
MelonLogger.Error("Player Index found outside of bounds (ShouldDeletePriorUnit): " + playerIndex);
return false;
}

Expand Down

0 comments on commit 2a96e57

Please sign in to comment.