(CURRENTYLY BROKEN) Add new skills, signatures and fixes
Introduce multiple new skill implementations and related updates: add AimLock, HealingChicken, HomingNades, HotBomb, Illusionist, MagneticDecoy, ThrowingKnife, Weightless and WildThrow; register skills and HUD/cooldown handling. Update ISkill enum to include new skills. Add SnapViewAngles signature to gamedata. Improve existing skills to handle bayonet (BladeMaster, Cutter, Disarmament, LongKnife) and fix iteration/null-check issues in FrozenDecoy. Make HealingSmoke tick interval configurable and extend its config. Update English and Polish language files with new skill strings and tweaks. Also sync server-side gamedata and language files.
This commit is contained in:
parent
4e4458ad38
commit
97887118bf
31 changed files with 1625 additions and 73 deletions
87
jRandomSkills - SRC Files/src/player/skills/Magneto.cs
Normal file
87
jRandomSkills - SRC Files/src/player/skills/Magneto.cs
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using src.utils;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace src.player.skills
|
||||
{
|
||||
public class Magneto : ISkill
|
||||
{
|
||||
private const Skills skillName = Skills.Magneto;
|
||||
private readonly static ConcurrentDictionary<uint, byte> nades = [];
|
||||
private readonly static ConcurrentDictionary<uint, byte> players = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
|
||||
}
|
||||
|
||||
public static void NewRound()
|
||||
{
|
||||
nades.Clear();
|
||||
players.Clear();
|
||||
}
|
||||
|
||||
public static void OnTick()
|
||||
{
|
||||
if (Server.TickCount % 5 != 0) return;
|
||||
float radius = SkillsInfo.GetValue<float>(skillName, "radius");
|
||||
|
||||
foreach (var nadeIndex in nades.Keys)
|
||||
{
|
||||
var nade = Utilities.GetEntityFromIndex<CBaseCSGrenadeProjectile>((int)nadeIndex);
|
||||
if (nade == null || !nade.IsValid)
|
||||
{
|
||||
nades.TryRemove(nadeIndex, out _);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var playerIndex in players.Keys)
|
||||
{
|
||||
var player = Utilities.GetPlayerFromIndex((int)playerIndex);
|
||||
if (player == null || !player.IsValid || !player.PawnIsAlive || player.PlayerPawn.Value == null || !player.PlayerPawn.Value.IsValid)
|
||||
{
|
||||
players.TryRemove(playerIndex, out _);
|
||||
continue;
|
||||
}
|
||||
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
double distanceMoved = SkillUtils.GetDistance(nade.AbsOrigin ?? Vector.Zero, pawn.AbsOrigin ?? Vector.Zero);
|
||||
|
||||
if (distanceMoved < radius && nade.TeamNum != player.TeamNum)
|
||||
{
|
||||
nade.Teleport(null, null, -nade.AbsVelocity);
|
||||
nades.TryRemove(nadeIndex, out _);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnEntitySpawned(CEntityInstance @event)
|
||||
{
|
||||
var name = @event.DesignerName;
|
||||
if (!name.EndsWith("_projectile")) return;
|
||||
|
||||
var grenade = @event.As<CBaseCSGrenadeProjectile>();
|
||||
if (grenade == null || !grenade.IsValid) return;
|
||||
|
||||
nades.TryAdd(grenade.Index, 0);
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
players.TryAdd(player.Index, 0);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
players.TryRemove(player.Index, out _);
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#f081ec", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float radius = 100) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
{
|
||||
public float Radius { get; set; } = radius;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue