From c07002a517501ed8f57d150b167a9bbeb3218ffa Mon Sep 17 00:00:00 2001 From: MSWS Date: Fri, 2 Aug 2024 14:19:35 -0700 Subject: [PATCH] More stuffs --- mod/Jailbreak.Rebel/JihadC4/JihadC4Behavior.cs | 14 +++++++++++++- .../SpecialDays/SpeedrunDay.cs | 2 -- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mod/Jailbreak.Rebel/JihadC4/JihadC4Behavior.cs b/mod/Jailbreak.Rebel/JihadC4/JihadC4Behavior.cs index edf7a479..3eeb8cb2 100644 --- a/mod/Jailbreak.Rebel/JihadC4/JihadC4Behavior.cs +++ b/mod/Jailbreak.Rebel/JihadC4/JihadC4Behavior.cs @@ -5,9 +5,11 @@ using CounterStrikeSharp.API.Modules.Utils; using Jailbreak.Formatting.Extensions; using Jailbreak.Formatting.Views; +using Jailbreak.Public; using Jailbreak.Public.Behaviors; using Jailbreak.Public.Extensions; using Jailbreak.Public.Mod.Rebel; +using MStatsShared; namespace Jailbreak.Rebel.JihadC4; @@ -36,6 +38,10 @@ public void TryGiveC4ToPlayer(CCSPlayerController player) { public void StartDetonationAttempt(CCSPlayerController player, float delay, CC4 bombEntity) { if (plugin == null) return; + var pos = player.Pawn.Value?.AbsOrigin; + if (pos != null) + API.Stats?.PushStat(new ServerStat("JB_BOMB_ATTEMPT", + $"{pos.X:F2} {pos.Y:F2} {pos.Z:F2}")); tryEmitSound(player, "jb.jihad", 1, 1f, 0f); @@ -139,6 +145,7 @@ private void detonate(CCSPlayerController player, CC4 bomb) { new QAngle(), new Vector()); particleSystemEntity.DispatchSpawn(); + var killed = 0; /* Calculate damage here, only applies to alive CTs. */ foreach (var ct in Utilities.GetPlayers() .Where(p => p is { @@ -153,13 +160,18 @@ private void detonate(CCSPlayerController player, CC4 bomb) { var damage = 340f; damage *= (350f - distanceFromBomb) / 350f; float healthRef = ct.PlayerPawn.Value.Health; - if (healthRef <= damage) { ct.CommitSuicide(true, true); } else { + if (healthRef <= damage) { + ct.CommitSuicide(true, true); + killed++; + } else { ct.PlayerPawn.Value.Health -= (int)damage; Utilities.SetStateChanged(ct.PlayerPawn.Value, "CBaseEntity", "m_iHealth"); } } + API.Stats?.PushStat(new ServerStat("JB_BOMB_EXPLODED", killed.ToString())); + // If they didn't have the C4 make sure to remove it. player.CommitSuicide(true, true); bombs.Remove(bomb); diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs index 48634a92..1a7e2013 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs @@ -313,7 +313,6 @@ private void endRound() { .Select(s => s.Value) .LastOrDefault(-(Server.CurrentTime - FIRST_SPEEDRUNNER_TIME)); - if (aliveCount <= 2) { // Announce winners, end the round, etc. // Maybe tp the loser to the winner and let the winner kill them @@ -361,7 +360,6 @@ private void endRound() { return; } - var fastTime = MathF.Abs(fastTimestamp) - roundStartTime!; var roundTimeWas = Math.Ceiling(Server.CurrentTime - roundStartTime!.Value); var nextRoundTime = (int)Math.Ceiling(fastTime.Value + 10 - round * 2);