Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NotZer0Two committed Aug 12, 2024
1 parent 92af4ce commit 8242e50
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions EXILED/Exiled.Events/Patches/Fixes/NWFixDetonationTimer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// -----------------------------------------------------------------------
// <copyright file="NWFixDetonationTimer.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.Patches.Fixes
{
using System;
using System.Linq;

using GameCore;
using HarmonyLib;

/// <summary>
/// Fixes the issue where the game was not selecting the scenario with the nearest <see cref="AlphaWarheadController.DetonationScenario.TimeToDetonate"/> value.
/// </summary>
[HarmonyPatch(typeof(AlphaWarheadController), nameof(AlphaWarheadController.Start))]
internal class NWFixDetonationTimer
{
private static void Postfix()
{
AlphaWarheadSyncInfo networkInfo = default;
networkInfo.ScenarioId = Array.IndexOf(AlphaWarheadController.Singleton._startScenarios, AlphaWarheadController.Singleton._startScenarios.OrderBy(d => Math.Abs(d.TimeToDetonate - ConfigFile.ServerConfig.GetInt("warhead_tminus_start_duration", 90))).First());

AlphaWarheadController.Singleton.NetworkInfo = networkInfo;
return;
}
}
}

0 comments on commit 8242e50

Please sign in to comment.