(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
86
jRandomSkills - SRC Files/src/player/skills/MagneticDecoy.cs
Normal file
86
jRandomSkills - SRC Files/src/player/skills/MagneticDecoy.cs
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using src.utils;
|
||||
using System.Collections.Concurrent;
|
||||
using static src.jRandomSkills;
|
||||
|
||||
namespace src.player.skills
|
||||
{
|
||||
public class MagneticDecoy : ISkill
|
||||
{
|
||||
private const Skills skillName = Skills.MagneticDecoy;
|
||||
private static readonly ConcurrentDictionary<Vector, byte> decoys = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
|
||||
}
|
||||
|
||||
public static void NewRound()
|
||||
{
|
||||
decoys.Clear();
|
||||
}
|
||||
|
||||
public static void DecoyStarted(EventDecoyStarted @event)
|
||||
{
|
||||
var player = @event.Userid;
|
||||
if (player == null || !player.IsValid) return;
|
||||
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != skillName) return;
|
||||
|
||||
decoys.TryAdd(new Vector(@event.X, @event.Y, @event.Z), 0);
|
||||
}
|
||||
|
||||
public static void DecoyDetonate(EventDecoyDetonate @event)
|
||||
{
|
||||
var player = @event.Userid;
|
||||
if (player == null || !player.IsValid) return;
|
||||
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != skillName) return;
|
||||
|
||||
foreach (var decoy in decoys.Keys.Where(v => v.X == @event.X && v.Y == @event.Y && v.Z == @event.Z))
|
||||
decoys.TryRemove(decoy, out _);
|
||||
}
|
||||
|
||||
public static void OnTick()
|
||||
{
|
||||
foreach (Vector decoyPos in decoys.Keys)
|
||||
foreach (var player in Utilities.GetPlayers().Where(p => p.IsValid && p.PawnIsAlive && p.Team is CsTeam.CounterTerrorist or CsTeam.Terrorist))
|
||||
{
|
||||
var decoyRadius = SkillsInfo.GetValue<float>(skillName, "triggerRadius");
|
||||
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
if (pawn == null || !pawn.IsValid || pawn.AbsOrigin == null) continue;
|
||||
|
||||
double distance = SkillUtils.GetDistance(decoyPos, pawn.AbsOrigin);
|
||||
if (distance <= decoyRadius && distance > 10)
|
||||
{
|
||||
Vector direction = new(decoyPos.X - pawn.AbsOrigin.X, decoyPos.Y - pawn.AbsOrigin.Y, 0);
|
||||
float length = direction.Length();
|
||||
|
||||
Vector normalized = direction / length;
|
||||
float ratio = 1 - (float)(distance / decoyRadius);
|
||||
float strenght = SkillsInfo.GetValue<float>(skillName, "strenght") * ratio;
|
||||
|
||||
pawn.AbsVelocity.X += normalized.X * strenght;
|
||||
pawn.AbsVelocity.Y += normalized.Y * strenght;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade);
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#81f0c4", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float triggerRadius = 180, float strenght = 30) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
{
|
||||
public float TriggerRadius { get; set; } = triggerRadius;
|
||||
public float Strenght { get; set; } = strenght;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue