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.
[EXILED::EVENTS]
Fixing bug report n.396 (#59)
* Fix * Added the Bug report
- Loading branch information
1 parent
96ecc24
commit 83ff82e
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
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,32 @@ | ||
// ----------------------------------------------------------------------- | ||
// <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. | ||
/// <a href="https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/396">Bug Report</a> | ||
/// </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; | ||
} | ||
} | ||
} |