Introduce optional `HudDuration` and `DescriptionHudDuration` fields in skill config metadata and propagate them through all skill config constructors and `skillsInfo.json`.
40 lines
No EOL
1.8 KiB
C#
40 lines
No EOL
1.8 KiB
C#
using CounterStrikeSharp.API.Core;
|
|
using CounterStrikeSharp.API.Modules.Utils;
|
|
using src.utils;
|
|
|
|
namespace src.player.skills
|
|
{
|
|
public class Glue : ISkill
|
|
{
|
|
private const Skills skillName = Skills.Glue;
|
|
|
|
public static void LoadSkill()
|
|
{
|
|
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
|
|
}
|
|
|
|
public static void OnEntitySpawned(CEntityInstance entity)
|
|
{
|
|
var name = entity.DesignerName;
|
|
if (!name.EndsWith("_projectile"))
|
|
return;
|
|
|
|
var grenade = entity.As<CBaseCSGrenadeProjectile>();
|
|
if (grenade.OwnerEntity.Value == null || !grenade.OwnerEntity.Value.IsValid) return;
|
|
|
|
var pawn = grenade.OwnerEntity.Value.As<CCSPlayerPawn>();
|
|
if (pawn == null || !pawn.IsValid || pawn.Controller == null || pawn.Controller.Value == null || !pawn.Controller.Value.IsValid) return;
|
|
|
|
var player = pawn.Controller.Value.As<CCSPlayerController>();
|
|
if (player == null || !player.IsValid) return;
|
|
|
|
var playerInfo = PlayerManager.GetPlayerByIndex((PlayerManager.GetPlayerEvent(player)?.Index ?? player.Index));
|
|
if (playerInfo?.Skill != skillName) return;
|
|
grenade.Bounces = 555;
|
|
}
|
|
|
|
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#fff52e", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float? hudDuration = null, float? descriptionHudDuration = null, int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, hudDuration, descriptionHudDuration, maxPerServer, rarity)
|
|
{
|
|
}
|
|
}
|
|
} |