Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

Commit

Permalink
[EXILED::EVENTS] Fixing bug report n.396 (#2775)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotZer0Two authored Aug 20, 2024
1 parent ec6cbd4 commit 2a46783
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions 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.
/// <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 2a46783

Please sign in to comment.