v.1.1.7
This commit is contained in:
parent
a36fdbf92d
commit
04a4fdce0d
143 changed files with 3565 additions and 2344 deletions
|
|
@ -3,20 +3,18 @@ using CounterStrikeSharp.API.Core;
|
|||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Rubber: ISkill
|
||||
{
|
||||
private const Skills skillName = Skills.Rubber;
|
||||
private static readonly float rubberTime = Config.GetValue<float>(skillName, "slownessTime");
|
||||
private static readonly float rubberModifier = Config.GetValue<float>(skillName, "slownessModifier");
|
||||
|
||||
private static readonly Dictionary<CCSPlayerPawn, float> playersToSlow = [];
|
||||
private static readonly ConcurrentDictionary<CCSPlayerPawn, float> playersToSlow = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
|
||||
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
|
||||
}
|
||||
|
||||
public static void NewRound()
|
||||
|
|
@ -35,11 +33,9 @@ namespace jRandomSkills
|
|||
var victimPawn = victim!.PlayerPawn.Value;
|
||||
if (victimPawn == null || !victimPawn.IsValid) return;
|
||||
|
||||
var rubberTime = SkillsInfo.GetValue<float>(skillName, "slownessTime");
|
||||
if (attackerInfo?.Skill == skillName)
|
||||
if (playersToSlow.ContainsKey(victimPawn))
|
||||
playersToSlow[victimPawn] = Server.TickCount + (64 * rubberTime);
|
||||
else playersToSlow.TryAdd(victimPawn, Server.TickCount + (64 * rubberTime));
|
||||
|
||||
playersToSlow.AddOrUpdate(victimPawn, Server.TickCount + (64 * rubberTime), (k, v) => Server.TickCount + (64 * rubberTime));
|
||||
}
|
||||
|
||||
public static void OnTick()
|
||||
|
|
@ -51,17 +47,17 @@ namespace jRandomSkills
|
|||
if (time >= Server.TickCount)
|
||||
ChangeVelocity(pawn);
|
||||
else
|
||||
playersToSlow.Remove(item.Key);
|
||||
playersToSlow.TryRemove(item.Key, out _);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ChangeVelocity(CCSPlayerPawn pawn)
|
||||
{
|
||||
if (pawn == null || !pawn.IsValid) return;
|
||||
pawn.VelocityModifier = rubberModifier;
|
||||
pawn.VelocityModifier = SkillsInfo.GetValue<float>(skillName, "slownessModifier");
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8B4513", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float slownessTime = 2f, float slownessModifier = .2f) : Config.DefaultSkillInfo(skill, active, color, onlyTeam, needsTeammates)
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8B4513", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, float slownessTime = 2f, float slownessModifier = .2f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates)
|
||||
{
|
||||
public float SlownessTime { get; set; } = slownessTime;
|
||||
public float SlownessModifier { get; set; } = slownessModifier;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue