v1.2.3.b8
- #### Shared Systems
- **PlayerManager.FillSkillHolders** - Skill holders are resolved from the player index instead of scanning every controller each tick, replacing the per-skill full player loop used by ten skills.
- **PlayerManager.GetControllerByPawn** - Tick-cached pawn to controller map, replacing the linear observer-target scan.
- **PlayerManager.IsServerIdle** - Tick-cached idle check shared by the debug and perf writers.
- **SkillUtils.IsFriendlyFireBlocked** - Now takes the skill, so the new per-skill `FriendlyFire` key and the server convars are resolved in one place. The convar-only overload remains for victim-side skills.
- **SkillUtils.TerminateRound** - Accepts the player who ended the round and pays out the round-end money that the engine skips on plugin-terminated rounds.
- #### Performance
- **OnTick(hud)** - Average cost down 17% against the previous build.
- **CheckTransmit** - Average cost down 25%, peak down 39%.
- **OnTick(skills)** - Peak cost down 62%.
- **Host stalls** - Real freezes measured with players connected dropped from six to two across 785 rounds.
- **DecoyRing** - Beam creation is spread across four frames instead of spawning the whole ring in one tick.
- **Fourteen skills** - `OnTick` now returns immediately when the skill holds no state.
- **Berserker, BladeMaster, BunnyHop, DemonEye, Flash, PawelJumper, Pilot, Poison, QuickShot, RadarHack, Regeneration** - Switched to the shared skill-holder list; config reads hoisted out of per-player loops.
- #### Fixes
- **GravityDecoy** - Restored a hardcoded gravity of 1.0 when leaving the field, permanently breaking Astronaut. Each pawn's own scale is now captured and restored.
- **PsychicDefusing** - The bomb location stayed unset when the skill was assigned after the plant, the stored position pointed into the entity and dangled once the bomb was killed, and setup was silently skipped when the pawn was not ready.
- **PsychicDefusing, FragileBomb** - Winning teams were paid nothing when the plugin ended the round. Winners are now paid from the matching `cash_*` convars, with the defuser bonus on top.
- **ToxicSmoke, HealingSmoke** - Smoke kept damaging and healing after its owner lost the skill, and expiry left behind smokes whose owner had already lost it. HealingSmoke never tracked an owner at all.
- **EmpGrenade** - Crosshair and radar stayed jammed forever, because `OnTick` stops being dispatched once nobody holds the skill and the jam timer never expired.
- **ThrowingKnife** - Losing the skill while the knife was thrown destroyed it without giving one back.
- **OnlyHead, ReactiveArmor** - Both ignored fall and world damage, which has no player attacker.
- **Gambler** - Refreshing consumed the one-shot instead of rolling two new skills, and the refresh row lost its colour prefix to the text-direction wrapper.
- **Berserker, Flash** - The falling-speed clamp fired while noclipping.
- **ExplodingBarrel** - The prop spawned without a model and received it a frame later; the model is now passed through `CEntityKeyValues` at spawn.
- **FastReload** - Now has a cooldown, five seconds by default, with a HUD countdown. The cooldown only starts when a magazine is actually refilled.
- **Config** - Missing-key migration now descends into nested sections, so keys under `HtmlHudCustomisation` are detected.
- #### Damage Hook
- **OnEntityTakeDamagePre / OnEntityTakeDamagePost** - Replaced the deprecated `CBaseEntity_TakeDamageOldFunc` hook across 27 files.
- **Teammate damage** - The new hook runs before the engine zeroes friendly fire, so attacker-side modifiers need explicit guards. Added to OneShot, Cutter, Assassin, Soldier, Berserker, Nemesis and Punisher.
- **FriendlyFire** - New per-skill key on twelve skills, defaulting to `true`. Setting it to `false` stops teammates being affected, the way LongKnife and KillerFlash already allow. Covers both the damage amplifiers and the explosives that previously only reduced teammate damage.
- #### Menu
- **WSADMenuVisibleItems** - New setting replacing the hardcoded three visible menu rows, clamped between one and ten.
- **WSAD menu** - The final menu row keeps its `#RRGGBB` colour prefix instead of losing it to the text-direction wrapper.
- #### Config Migration
- **skillsInfo.json** - Missing keys are written back to the file on load instead of only being defaulted in memory. Existing values are preserved.
- **playersLanguage.json** - Now grouped by language instead of one row per player, which cuts a ten thousand player file by 20%. Old files are converted on load and invalid SteamIDs are dropped.
- #### Debug
- **Perf samples** - Report `p50`, `p95` and `p99` alongside the average and maximum.
- **Per-skill sampling** - Every skill is now sampled, instead of only logging the calls that exceeded two milliseconds. The measurement was already running; only the reporting threshold discarded it.
- **Load context** - Aggregate lines carry the player, alive, bot, active-skill and round counts, so sessions can be compared under different loads.
- **ENTITIES** - Tracked entities are broken down by type.
- **STALL** - Lines carry the tick, tracked entity count and load context, which separates map-load pauses from genuine freezes.
- **DMGHOOK** - Reports how often the attacker and ability resolve on the damage hook.
- **Idle server** - Nothing is written while the server sits empty, apart from lifecycle lines and player connects and disconnects.
- #### Cleanup
- **Compiler warnings** - All twelve resolved; the build is clean.
- **SkillUtils.SetPlayerCollisions** - Removed, its body started with an unconditional `return`.
- **Damage hook aliases** - Dropped the `param` and `param2` locals the migration left behind across 27 files.
This commit is contained in:
parent
b98842212f
commit
d016d42780
82 changed files with 1140 additions and 544 deletions
|
|
@ -84,26 +84,58 @@ namespace src.player
|
|||
}
|
||||
}
|
||||
|
||||
private static HookResult OnTakeDamage(DynamicHook h)
|
||||
private static HookResult OnEntityTakeDamagePre(CBaseEntity entity, CTakeDamageInfo info)
|
||||
{
|
||||
lock (setLock)
|
||||
{
|
||||
DispatchOnTakeDamage(h);
|
||||
CountDamageResolution(info);
|
||||
|
||||
object[] args = [entity, info];
|
||||
DispatchOnTakeDamage(entity, info, args);
|
||||
|
||||
if (Fortnite.skillInThisRound == true &&
|
||||
!Instance.SkillPlayer.Any(p => !p.IsDrawing && p.Skill == Skills.Fortnite))
|
||||
Instance.SkillAction("Fortnite", "OnTakeDamage", [h]);
|
||||
Instance.SkillAction("Fortnite", "OnTakeDamage", args);
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
}
|
||||
|
||||
private static HookResult OnTakeDamagePost(DynamicHook h)
|
||||
private static int dmgTotal, dmgAttackerOk, dmgAbilityOk, dmgSameTeam;
|
||||
private static DateTime dmgWindowStart = DateTime.Now;
|
||||
|
||||
private static void CountDamageResolution(CTakeDamageInfo info)
|
||||
{
|
||||
if (!PerfLog.Enabled || info == null) return;
|
||||
|
||||
dmgTotal++;
|
||||
|
||||
var attacker = info.Attacker?.Value;
|
||||
if (attacker != null && attacker.IsValid)
|
||||
{
|
||||
dmgAttackerOk++;
|
||||
|
||||
var attackerPawn = new CCSPlayerPawn(attacker.Handle);
|
||||
if (attackerPawn.IsValid && attackerPawn.DesignerName == "player") dmgSameTeam++;
|
||||
}
|
||||
|
||||
var ability = info.Ability?.Value;
|
||||
if (ability != null && ability.IsValid) dmgAbilityOk++;
|
||||
|
||||
if ((DateTime.Now - dmgWindowStart).TotalSeconds < 60) return;
|
||||
|
||||
if (dmgTotal > 0)
|
||||
PerfLog.Info($"DMGHOOK total={dmgTotal} attacker={dmgAttackerOk} ability={dmgAbilityOk} playerAttacker={dmgSameTeam}");
|
||||
|
||||
dmgTotal = dmgAttackerOk = dmgAbilityOk = dmgSameTeam = 0;
|
||||
dmgWindowStart = DateTime.Now;
|
||||
}
|
||||
|
||||
private static void OnEntityTakeDamagePost(CBaseEntity entity, CTakeDamageInfo info, CTakeDamageResult result)
|
||||
{
|
||||
lock (setLock)
|
||||
{
|
||||
DispatchOnTakeDamage(h, true);
|
||||
return HookResult.Continue;
|
||||
DispatchOnTakeDamage(entity, info, [entity, info, result], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue