v.1.1.7
This commit is contained in:
parent
a36fdbf92d
commit
04a4fdce0d
143 changed files with 3565 additions and 2344 deletions
|
|
@ -4,20 +4,18 @@ using CounterStrikeSharp.API.Modules.Entities.Constants;
|
|||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Baseball : ISkill
|
||||
{
|
||||
private const Skills skillName = Skills.Baseball;
|
||||
private static readonly float speedMultipier = Config.GetValue<float>(skillName, "speedMultipier");
|
||||
private static readonly float maxSpeed = Config.GetValue<float>(skillName, "maxSpeed");
|
||||
private static readonly int damageDeal = Config.GetValue<int>(skillName, "damageDeal");
|
||||
private static readonly HashSet<CDecoyProjectile> decoys = [];
|
||||
private static readonly ConcurrentDictionary<CDecoyProjectile, byte> decoys = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
|
||||
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
|
||||
}
|
||||
|
||||
public static void PlayerHurt(EventPlayerHurt @event)
|
||||
|
|
@ -32,7 +30,7 @@ namespace jRandomSkills
|
|||
var attackerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == attacker?.SteamID);
|
||||
if (attackerInfo?.Skill != skillName) return;
|
||||
|
||||
SkillUtils.TakeHealth(victim!.PlayerPawn.Value, damageDeal);
|
||||
SkillUtils.TakeHealth(victim!.PlayerPawn.Value, SkillsInfo.GetValue<int>(skillName, "damageDeal"));
|
||||
}
|
||||
|
||||
public static void OnEntitySpawned(CEntityInstance entity)
|
||||
|
|
@ -52,7 +50,7 @@ namespace jRandomSkills
|
|||
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != skillName) return;
|
||||
decoys.Add(decoy);
|
||||
decoys.TryAdd(decoy, 0);
|
||||
}
|
||||
|
||||
public static void DecoyStarted(EventDecoyStarted @event)
|
||||
|
|
@ -62,25 +60,25 @@ namespace jRandomSkills
|
|||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != skillName) return;
|
||||
|
||||
var decoy = decoys.FirstOrDefault(d => d.Index == @event.Entityid);
|
||||
var decoy = decoys.FirstOrDefault(d => d.Key.Index == @event.Entityid).Key;
|
||||
if (decoy != null && decoy.IsValid)
|
||||
decoy.AcceptInput("Kill");
|
||||
}
|
||||
|
||||
public static void OnTick()
|
||||
{
|
||||
foreach (var decoy in decoys)
|
||||
foreach (var decoy in decoys.Keys)
|
||||
{
|
||||
if (!decoy.IsValid)
|
||||
{
|
||||
decoys.Remove(decoy);
|
||||
decoys.TryRemove(decoy, out _);
|
||||
continue;
|
||||
}
|
||||
decoy.Bounces = 0;
|
||||
if (Server.TickCount % 8 != 0) continue;
|
||||
var vel = decoy.AbsVelocity;
|
||||
float speed = vel.Length();
|
||||
float targetSpeed = Math.Min(speed * speedMultipier, maxSpeed);
|
||||
float targetSpeed = Math.Min(speed * SkillsInfo.GetValue<float>(skillName, "speedMultipier"), SkillsInfo.GetValue<float>(skillName, "maxSpeed"));
|
||||
|
||||
if (speed > .01f)
|
||||
{
|
||||
|
|
@ -99,7 +97,7 @@ namespace jRandomSkills
|
|||
SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade);
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#2effc7", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float speedMultipier = 2f, float maxSpeed = 900f, int damageDeal = 9999) : Config.DefaultSkillInfo(skill, active, color, onlyTeam, needsTeammates)
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#2effc7", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, float speedMultipier = 2f, float maxSpeed = 900f, int damageDeal = 9999) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates)
|
||||
{
|
||||
public float SpeedMultipier { get; set; } = speedMultipier;
|
||||
public float MaxSpeed { get; set; } = maxSpeed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue