Skip to content

Commit

Permalink
Skip Timer Changes
Browse files Browse the repository at this point in the history
- Avoids resetting the strategy timer if commanders are not selected (BlockRoundStartUntilCommandersApplied setting ignored for the time being)
  • Loading branch information
data-bomb committed Jan 30, 2024
1 parent 2e6eac4 commit f864de2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Si_CommManagement/Si_CmdrMgr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You should have received a copy of the GNU General Public License
using SilicaAdminMod;
using System.Linq;

[assembly: MelonInfo(typeof(CommanderManager), "Commander Management", "1.4.3", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonInfo(typeof(CommanderManager), "Commander Management", "1.4.4", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonGame("Bohemia Interactive", "Silica")]
[assembly: MelonOptionalDependencies("Admin Mod")]

Expand Down Expand Up @@ -754,6 +754,7 @@ public static void Command_CommanderBan(Player callerPlayer, String args)
}
}

#if false
[HarmonyPatch(typeof(GameMode), nameof(GameMode.CreateRPCPacket))]
private static class CommanderManager_Patch_GameMode_GameByteStreamWriter
{
Expand All @@ -766,7 +767,7 @@ static void Postfix(GameMode __instance, GameByteStreamWriter __result, byte __0
// is this the countdown timer for the round to start?
if (__0 == (byte)MP_Strategy.ERPCs.TIMER_UPDATE && !strategyInstance.GameOver)
{
#if NET6_0
#if NET6_0
if (!AllTeamsHaveCommanderApplicants() && strategyInstance.Timer < 5f && strategyInstance.Timer > 4f)
{
// reset timer value and keep counting down
Expand All @@ -775,7 +776,7 @@ static void Postfix(GameMode __instance, GameByteStreamWriter __result, byte __0
HelperMethods.ReplyToCommand("Round cannot start because all teams don't have a commander. Chat !commander to apply.");
}

#else
#else
Type strategyType = typeof(MP_Strategy);
FieldInfo timerField = strategyType.GetField("Timer", BindingFlags.NonPublic | BindingFlags.Instance);

Expand All @@ -787,11 +788,12 @@ static void Postfix(GameMode __instance, GameByteStreamWriter __result, byte __0
// TODO: Fix repeating message
HelperMethods.ReplyToCommand("Round cannot start because all teams don't have a commander. Chat !commander to apply.");
}
#endif
#endif
}
}
}
}
#endif

[HarmonyPatch(typeof(GameMode), nameof(GameMode.OnPlayerLeftBase))]
private static class CommanderManager_Patch_GameMode_OnPlayerLeftBase
Expand Down

0 comments on commit f864de2

Please sign in to comment.