fix spawn wave checks

This commit is contained in:
Axwabo 2024-12-22 09:45:00 +01:00
parent bce7d936b3
commit 755cfb0d88

View File

@ -1,4 +1,5 @@
using Axwabo.Helpers;
using System.Collections.Generic;
using Axwabo.Helpers;
using PlayerRoles;
using PlayerRoles.PlayableScps;
using PlayerStatsSystem;
@ -6,6 +7,8 @@ using PluginAPI.Core;
using PluginAPI.Core.Attributes;
using PluginAPI.Enums;
using PluginAPI.Events;
using Respawning;
using Respawning.Waves;
namespace DeathLog;
@ -16,6 +19,7 @@ public sealed class DeathLogPlugin
public void OnEnabled()
{
EventManager.RegisterEvents(this);
WaveManager.OnWaveSpawned += OnTeamRespawn;
Log.Info("DeathLog loaded!");
}
@ -23,6 +27,7 @@ public sealed class DeathLogPlugin
public void OnDisabled()
{
EventManager.UnregisterEvents(this);
WaveManager.OnWaveSpawned -= OnTeamRespawn;
Log.Info("DeathLog disabled!");
}
@ -39,8 +44,8 @@ public sealed class DeathLogPlugin
LogHandler.KosIgnoredVictimNetIdList.Clear();
}
[PluginEvent(ServerEventType.TeamRespawn)]
private void OnTeamRespawn(TeamRespawnEvent e) => _spawnWaveOccurred = Config.IgnoreLeavingAfterSpawnWave;
private void OnTeamRespawn(SpawnableWaveBase spawnableWaveBase, List<ReferenceHub> referenceHubs)
=> _spawnWaveOccurred = Config.IgnoreLeavingAfterSpawnWave;
private static bool IsUnknownCause(DamageHandlerBase handler) =>
handler is UniversalDamageHandler udh && (udh.TranslationId == 0 ? string.IsNullOrEmpty(udh._logsText) : udh._logsText == DeathTranslations.Unknown.LogLabel);