From 2a96e57af8d588bec4a4e2a2f55101aea987484f Mon Sep 17 00:00:00 2001 From: data-bomb Date: Sun, 29 Dec 2024 08:47:08 -0800 Subject: [PATCH] Fixes Anti-Grief Logic Bug - Fixes logical error with last commit - Adds better call-out to offending method for errors --- Si_AntiGrief/Si_AntiGrief.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Si_AntiGrief/Si_AntiGrief.cs b/Si_AntiGrief/Si_AntiGrief.cs index d8bff1c..4b90c77 100644 --- a/Si_AntiGrief/Si_AntiGrief.cs +++ b/Si_AntiGrief/Si_AntiGrief.cs @@ -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")] @@ -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; } @@ -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; } @@ -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; }