Skip to content

Commit

Permalink
[EXILED::EVENTS] Fixing bug report n.396 (#59)
Browse files Browse the repository at this point in the history
* Fix

* Added the Bug report
  • Loading branch information
NotZer0Two authored Aug 30, 2024
1 parent 96ecc24 commit 83ff82e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions EXILED/Exiled.Events/Patches/Fixes/NWFixDetonationTimer.cs
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;
}
}
}

0 comments on commit 83ff82e

Please sign in to comment.