Updates & Fixes
# Updates & Fixes
- New Commands: Added `!health` and `!plantedbomb` for testing and server management.
- Config: Client commands are now fully registerable via configuration files.
- Jester (Rework):
- Refactored from a global mode to a per-player system.
- Improved timer logic to prevent crashes during round resets.
- Added special handling for bomb planting and defusing.
- SkillUtils: `AddHealth` now supports an optional `maxHealth` parameter.
- KillerFlash, LongKnife & LongZeus: Added `friendlyFire` options to skill configs.
This commit is contained in:
parent
97887118bf
commit
8634665983
12 changed files with 219 additions and 62 deletions
|
|
@ -187,12 +187,16 @@ namespace src.utils
|
|||
if (pawn == null || !pawn.IsValid || pawn.LifeState != (byte)LifeState_t.LIFE_ALIVE)
|
||||
return;
|
||||
|
||||
if (pawn.Controller.Value != null && pawn.Controller.Value.IsValid)
|
||||
var player = pawn.Controller.Value;
|
||||
if (player != null && player.IsValid && player.SteamID != 0)
|
||||
{
|
||||
var playerInfo = jRandomSkills.Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == pawn.Controller.Value.SteamID);
|
||||
ulong steamId = player.SteamID;
|
||||
|
||||
var playerInfo = jRandomSkills.Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == steamId);
|
||||
if (playerInfo == null) return;
|
||||
if (playerInfo.Skill == Skills.Jester && Jester.GetJesterMode())
|
||||
return;
|
||||
|
||||
var jester = Jester.GetJesterInfo(steamId);
|
||||
if (jester?.Active == true) return;
|
||||
}
|
||||
|
||||
int newHealth = (int)(pawn.Health - damage);
|
||||
|
|
@ -245,16 +249,18 @@ namespace src.utils
|
|||
return trigger;
|
||||
}
|
||||
|
||||
public static void AddHealth(CCSPlayerPawn? pawn, int extraHealth, int maxHealth = 100)
|
||||
public static void AddHealth(CCSPlayerPawn? pawn, int extraHealth, int? maxHealth = null)
|
||||
{
|
||||
if (pawn == null || !pawn.IsValid || pawn.LifeState != (byte)LifeState_t.LIFE_ALIVE)
|
||||
return;
|
||||
|
||||
maxHealth ??= pawn.MaxHealth;
|
||||
|
||||
int newHealth = (int)(pawn.Health + extraHealth);
|
||||
pawn.Health = Math.Min(newHealth, maxHealth);
|
||||
pawn.Health = Math.Min(newHealth, (int)maxHealth);
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||
|
||||
pawn.MaxHealth = maxHealth;
|
||||
pawn.MaxHealth = (int)maxHealth;
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iMaxHealth");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue