Updates & Fixes

# Updates & Fixes
- New Commands: Added `css_bot_place` which teleports a bot to the player's position with optional godmode and translation support.
- Miner (New Skill): Added a new skill that allows for detonating HE grenades near enemies.
- Bomb Abort Support: Introduced `BombAbortplant` support across `ISkill` and event registration; added handlers for aborting plants in Planter, ChillOut, and other skills.
- System (Rework & Optimization):
    - Reworked player event dispatching to call `SkillAction` once per distinct active skill, reducing redundant invocations.
    - Switched timing logic to use `Server.CurrentTime` (replacing `EngineTime`).
    - Added extensive null and validity guards for player and pawn objects.
- Skill-specific Changes:
    - AimLock: Fixed vector/validation issues and updated config defaults (cooldown, duration, and offset).
    - AreaReaper: Now uses `BombPlantedHere` state and includes `OnTick` alerts.
    - ChillOut & Planter: Improved tracking for planting players with center-print and HUD updates.
    - HomingNades: Simplified callbacks and fixed detonation timing.
    - Muhammed: Tweaked explosion delay handling and reduced friendly fire damage.
- Core & Utils:
    - TraceRay: Implemented `CS2TraceRay` for skills to prevent activation through doors or on dropped weapons.
    - Dependencies: Bumped `CounterStrikeSharp.API` to 1.0.364 and `MaxMind.Db` to 5.0.0.
    - Bug Fixes: Resolved multiple HUD/print update issues and fixed various translation keys.
This commit is contained in:
Juzlus 2026-04-05 03:08:43 +02:00
parent 8634665983
commit a8890bde6a
22 changed files with 669 additions and 149 deletions

View file

@ -2,6 +2,7 @@ using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using src.utils;
using System.Collections.Concurrent;
using static src.jRandomSkills;
namespace src.player.skills
@ -9,16 +10,38 @@ namespace src.player.skills
public class ChillOut : ISkill
{
private const Skills skillName = Skills.ChillOut;
private static readonly ConcurrentDictionary<ulong, float> plantingPlayers = [];
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
}
public static void NewRound()
{
plantingPlayers.Clear();
}
public static void DisableSkill(CCSPlayerController player)
{
if (player == null || !player.IsValid) return;
plantingPlayers.TryRemove(player.SteamID, out _);
SkillUtils.ResetPrintHTML(player);
}
public static void BombAbortplant(EventBombAbortplant @event)
{
var user = @event.Userid;
if (user == null || !user.IsValid || !user.PawnIsAlive) return;
plantingPlayers.TryRemove(user.SteamID, out _);
SkillUtils.ResetPrintHTML(user);
}
public static void BombBeginplant(EventBombBeginplant @event)
{
var player = @event.Userid;
if (!Instance.IsPlayerValid(player)) return;
plantingPlayers.TryAdd(player!.SteamID, Server.CurrentTime);
var anyChillOut = Instance.SkillPlayer.FirstOrDefault(p => p.Skill == skillName);
if (anyChillOut != null)
@ -33,6 +56,42 @@ namespace src.player.skills
}
}
public static void BombPlanted(EventBombPlanted @event)
{
var player = @event.Userid;
if (!Instance.IsPlayerValid(player)) return;
plantingPlayers.TryRemove(player!.SteamID, out _);
SkillUtils.ResetPrintHTML(player);
}
public static void OnTick()
{
float currentTime = Server.CurrentTime;
float extraTime = SkillsInfo.GetValue<float>(skillName, "bombArmedTime");
foreach (var player in Utilities.GetPlayers().Where(p => p.Team == CsTeam.Terrorist))
{
if (!Instance.IsPlayerValid(player)) continue;
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo == null) continue;
var pawn = player.PlayerPawn.Value;
if (pawn == null || !pawn.IsValid) continue;
if (pawn.WeaponServices == null) continue;
var activeWeapon = pawn.WeaponServices.ActiveWeapon.Value;
if (activeWeapon == null || !activeWeapon.IsValid || activeWeapon.DesignerName != "weapon_c4") continue;
if (plantingPlayers.TryGetValue(player.SteamID, out float plantTime))
{
float remaining = plantTime + extraTime - currentTime;
playerInfo.PrintHTML = $"{player.GetTranslation("planter_planting", $"<font color='#00FF00'>{Math.Max(0, remaining):0.0}s</font>")}";
player.PrintToCenter("");
}
}
}
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#343deb", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float bombArmedTime = 10f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
{
public float BombArmedTime { get; set; } = bombArmedTime;