branchrust_reboot/main/trap_optimizecancel
10 Commits over 30 Days - 0.01cph!
Fix turret not setting auth dirty when losing target behind LOS for >3 seconds and when turret is first turned on
merge from main -> trap_optimize
Fix cooldown missing from shotgun trap after it fires
Merge from main -> trap_optimize
Add `auto_turret_budget_ms` and `gun_trap_budget_ms` to configure the budgeting (default 0.5ms per frame)
Move AutoTurret to PersistantObjectWorkQueue<> (instead of invokes that requeue each frame)
Add `GunTrapScanWorkQueue` to make shotgun traps budgetted to 0.5ms / frame
Register turrets & shotgun traps with their budgeted queues when they are spawned & unregister when destroyed
Change List<> in PersistantObjectWorkQueue to ListHashset<> (incase many entities in the "queue" cause a slowdown)
Iterate with the Array instead of ListHashSet[] because of comment claiming Array[] is 2x faster to iterate than List<> (in mono?)
Optimize shotgun traps by using the TC of the shotgun trap instead of the player it is trying to shoot at
Cache the TC for 3 seconds in shotgun trap (we still check auth normally)
Optimize turrets on the server by caching if there are any un-authed target in range & skip scanning targets if that is the case
Mark auth as dirty when players are removed from auth or come into trigger range while unauthed
Add Action onto TriggerBase for OnEntityEnterTrigger() and OnEntityLeaveTrigger()