ModernUO/Projects/UOContent/Engines
Kamron Batman e52d54b7da
perf: keep damage entries in an inline intrusive list (#2605)
## Summary

`Mobile.DamageEntries` was a `List<DamageEntry>` allocated for every mobile, including the ~99% that never take damage. It is now an inline `ValueLinkList<DamageEntry>` (24 bytes in the `Mobile` object, no separate allocation) ordered least recent → most recent.

- `DamageEntry` implements `IValueLinkListNode<DamageEntry>`.
- `RegisterDamage` moves the entry to the tail in O(1) instead of `Remove` + `Add` on a list.
- Expired entries are always a head prefix, so pruning walks from the head and stops at the first live entry. The `DamageEntries` getter prunes on access.
- `DamageEntries` is exposed as `ref readonly`; enumerate with `foreach` or `.ByDescending()`. Mutation goes through `RegisterDamage` / `ClearDamageEntries`.
- `BaseCreature.GetLootingRights` and `BaseCreature.ComputeBonusDamage` take `in ValueLinkList<DamageEntry>`; all callers compile unchanged. Files that `foreach` over `DamageEntries` need `using Server.Collections;` for the enumerator extension.
- RunUO migration docs (`dev-docs/runuo-migration-docs/09`, `11`) and the `migrate-items-mobiles` skill document the change.

Saves one object and 16 bytes per mobile (~8 MB and 500k gen2 objects on a 500k world). Second of three PRs from the lazy per-mobile collections design (first: #2604). Branched from `main`; the two diffs touch disjoint hunks of `Mobile.cs`.

## Breaking change

- `Mobile.DamageEntries` is no longer a `List<DamageEntry>`. Indexing, `.Clear()`, `.Add()`, `.Remove()` no longer compile; use `foreach`, `.ByDescending()`, `.Count`, `ClearDamageEntries()`, and `RegisterDamage`. Calling a `ValueLinkList` mutator on the `ref readonly` property compiles but operates on a copy while still unlinking the real nodes; do not.
- `BaseCreature.GetLootingRights` and `BaseCreature.ComputeBonusDamage` signatures changed to `(in ValueLinkList<DamageEntry>, …)`.

Save format is untouched: damage entries are not serialized.

## Behavior

Recency order, `allowSelf`, tie-breaking in `FindMostTotal`/`FindLeastTotal` (most recent wins), `Responsible` accounting, and loot-rights ordering are unchanged and covered by the new `DamageEntryTests` and `LootingRightsTests`.

## Testing

- `dotnet build -c Release` clean.
- New `DamageEntryTests` and `LootingRightsTests` plus full `Server.Tests` and `UOContent.Tests`.
2026-09-01 23:25:14 -07:00
..
Advanced Search perf(login): run password hashing on a parked worker thread (#2566) 2026-08-09 00:13:34 -07:00
BuffIcons feat: Standardizes South/East selection gumps (#1839) 2025-02-14 00:15:14 -08:00
Bulk Orders feat: adopt serialization generator v4 (field-side linkage, anchored timers) (#2586) 2026-08-22 17:54:02 -07:00
CannedEvil perf: keep damage entries in an inline intrusive list (#2605) 2026-09-01 23:25:14 -07:00
Character Creation fix: Fixes bug with non blessed starter spellbooks (#2368) 2026-03-13 00:20:23 -07:00
Chat fix: Removes unnecessary dictionary removal guards (#2565) 2026-08-08 11:50:01 -07:00
ConPVP refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Craft fix: Consolidate PlayerConstructed onto Item, stamped by the craft system (#2574) 2026-08-13 18:34:59 -07:00
Doom chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Ethics feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
Events fix: Streamlines event scheduler API. Adds months to weekly recurrence (#2178) 2025-05-07 22:42:44 -07:00
Factions feat: derive the Running bit from the step pace and fix step-pacing bursts (#2599) 2026-08-30 16:48:52 -07:00
FeatureFlags fix: Streamlines insurance. Insurance only executes when enabled. (#2550) 2026-07-26 09:47:49 -07:00
Harvest fix: delete the bonus item, not the primary yield, when the bonus cannot be placed (#2602) 2026-08-31 08:46:20 -07:00
Help feat: Add zero-alloc interpolation handler to ValueStringBuilder, replace all StringBuilder usage (#2387) 2026-03-22 14:23:44 -07:00
Insurance fix: Streamlines insurance. Insurance only executes when enabled. (#2550) 2026-07-26 09:47:49 -07:00
Khaldun feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
ML Quests feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
Party fix: Eliminates double lookup with Contains->Remove (#2539) 2026-07-19 09:26:27 -07:00
Pathing feat: derive the Running bit from the step pace and fix step-pacing bursts (#2599) 2026-08-30 16:48:52 -07:00
Plants refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Player Murder System refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Quests refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Spawners refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Stealables feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
Treasures of Tokuno refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
UltimaStore fix: Fixes thread guard and cleans up incoming packet reader (#1641) 2023-12-19 17:04:09 -08:00
Veteran Rewards refactor: fold hand-written serializable property setters into field hooks (#2587) 2026-08-22 18:20:39 -07:00
Virtues feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00