feat: add BasePower abstraction
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using CounterStrikeSharp.API.Core;
|
||||
|
||||
namespace Cs2SuperPowers.Players.PlayerValidations;
|
||||
|
||||
public class IsAlive : IValidation<CCSPlayerController>
|
||||
{
|
||||
public bool Validate(CCSPlayerController? player)
|
||||
{
|
||||
return player?.PlayerPawn.Value?.LifeState == (byte)LifeState_t.LIFE_ALIVE;
|
||||
}
|
||||
}
|
||||
|
||||
public static class IsAliveExtensions
|
||||
{
|
||||
public static ValidationBuilder<CCSPlayerController> IsAlive(this ValidationBuilder<CCSPlayerController> builder)
|
||||
{
|
||||
builder.Add(new IsAlive());
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using CounterStrikeSharp.API.Core;
|
||||
|
||||
namespace Cs2SuperPowers.Players.PlayerValidations;
|
||||
|
||||
public class IsValid : IValidation<CCSPlayerController>
|
||||
{
|
||||
public bool Validate(CCSPlayerController? player)
|
||||
{
|
||||
return player?.IsValid == true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class IsValidExtensions
|
||||
{
|
||||
public static ValidationBuilder<CCSPlayerController> IsValid(this ValidationBuilder<CCSPlayerController> builder)
|
||||
{
|
||||
builder.Add(new IsValid());
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user