forked from Exiled-Official/EXILED
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92af4ce
commit 8242e50
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
EXILED/Exiled.Events/Patches/Fixes/NWFixDetonationTimer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |