ModernUO/Projects/Server/Items
Kamron Batman 971d7b6a77
fix: stop items from insta-decaying when decay eligibility is restored without a move (#2583)
## Summary

A GM flipping `Movable` back on for a long-frozen item made it vanish within one scheduler tick. The setter registered the item with a deadline computed from its stale `LastMoved`, so `ProcessActiveQueue` deleted it almost immediately. The pre-#2311 save-time sweep had the same semantics, just hidden behind the save cadence. The same failure existed for `Visible` and `Spawner` transitions.

`LastMoved` is deliberately left meaning actual movement — it feeds vendor inventory expiry and house moving-crate checks — so the fix does not rewrite it for state changes.

## Changes

- **`DecayResetTime`** (CompactInfo-backed): the decay countdown runs from the later of `LastMoved` and this stamp. `RestartDecay()` stamps it only when the item can decay and the stamp extends the current deadline, so hot paths with a fresh `LastMoved` allocate nothing.
- **`Movable`/`Visible`/`Spawner` setters** call `RestartDecay()` instead of registering a stale deadline.
- **Region-refusal retry** in `DecayScheduler` uses `RestartDecay()` instead of rewriting `LastMoved`.
- **Persistence**: the stamp survives save/load as a `WriteDeltaTime` delta under `SaveFlag.DecayReset` (to become `WriteAnchoredTime` once the save-time anchor is ported) (Item serialization v10), so a restart mid-window no longer deletes the item.
- **`LastMoved` setter** drops a superseded stamp so the `CompactInfo` can collapse instead of being held (~40 bytes) forever.
- **Raw `Map` setter** now counts as a move for parentless items: it stamps `LastMoved` and updates decay registration, closing the gap where an item moved out of `Map.Internal` via the setter never decayed.
- **`LiftItemDupe`**: the remainder of a partially lifted *ground* stack was placed via raw `Location`/`Map` assignments and never enrolled for decay (lingering-trash leak since #2311) — now enrolled via the Map setter. Parented remainders get their map from `AddItem` (parent first, then map), so container splits never transit the scheduler.
2026-08-22 12:56:00 -07:00
..
BaseMulti.cs feat(pathfinding): multi-aware mask synthesizer + warm interior cache for house/boat cells (#2479) 2026-06-09 08:02:05 -07:00
Container.cs fix: Items dropped on the ground never decay (#2536) 2026-07-16 18:51:04 -07:00
Containers.cs feat: Adds Feature Flag System (#2328) 2026-02-07 12:02:57 -08:00
DecayScheduler.cs fix: stop items from insta-decaying when decay eligibility is restored without a move (#2583) 2026-08-22 12:56:00 -07:00
Item.cs fix: stop items from insta-decaying when decay eligibility is restored without a move (#2583) 2026-08-22 12:56:00 -07:00
Item.Enumerable.cs perf: Eliminates allocations in Container searching. (#2409) 2026-04-25 13:40:21 -07:00
Item.Messages.cs perf: Zero-alloc interpolation for SendMessage/Overhead APIs (#2434) 2026-05-03 18:04:02 -07:00
ItemBounds.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
Layer.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
LightType.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
OutgoingVirtualHairPackets.cs refactor: decompose mobile/corpse hair, delete VirtualHairInfo, fix removal serial (#2462) (#2463) 2026-06-06 14:33:28 -07:00
SecureTradeContainer.cs fix: Moves containers/bods/traps/etc to serialization generator (#2310) 2026-01-07 21:55:55 -08:00
VirtualCheck.cs fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00