docs: document why ControlOrder fires its handler on every assignment

Reviewed whether OnCurrentOrderChanged should be change-guarded: it must not
be. A reissued order is a command — "all attack" retargets through
ControlTarget with the same order value, "all follow" breaks off combat,
"all stay" re-anchors Home — and each depends on the handler running (and,
since #2594, on the AI being prodded awake). No code path writes the same
value on a hot path; all AI-internal writes are genuine transitions, so
same-value fires only occur at player-command rate. Handlers that need
change-detection already receive the previous order (ResolveStop uses it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kamron Batman 2026-08-25 09:06:27 -07:00
parent 5d00149dd8
commit 2d07b019af
No known key found for this signature in database
GPG key ID: 7D81DF26D9A5D94A

View file

@ -858,6 +858,10 @@ namespace Server.Mobiles
[CommandProperty(AccessLevel.GameMaster)]
public Point3D ControlDest { get; set; }
// Deliberately fires on every assignment, not just changes: a reissued order is a
// command ("all attack" retargets via ControlTarget, "all follow" breaks off combat,
// "all stay" re-anchors Home) and must run its handler and wake the AI. Handlers
// needing change-detection compare against the previous order they receive.
[CommandProperty(AccessLevel.GameMaster)]
public OrderType ControlOrder
{