Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXILED::EVENTS] Fixing bug report n.396 #59

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
NotZer0Two marked this conversation as resolved.
Show resolved Hide resolved
/// </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;
}
}
}
Loading