refactor: fold hand-written serializable property setters into field hooks
Converts 113 [SerializableProperty] members whose setters only coerce the value, reject it, or run post-change side effects into plain [SerializableField] declarations using allowFieldChange and fieldChanged. Wire- and schema-neutral: the migration schema regeneration produces zero changes. Kept as hand-written properties: custom getters (fallback defaults, lazy or self-healing reads), virtual/override members, pre-assignment state capture (durability unscale/scale sandwiches), and setters with exotic semantics (work on equal assignment, early returns that skip persistence). Behavioral notes: generated setters skip all work when the incoming value equals the field, and always MarkDirty on change - a handful of converted setters previously never marked dirty (their changes only persisted if something else dirtied the entity) or re-ran side effects on equal assignment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
73f9688083
commit
4849c80750
73 changed files with 893 additions and 1340 deletions
|
|
@ -41,22 +41,14 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
[SerializableProperty(1)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get => _resource;
|
||||
set
|
||||
{
|
||||
if (_resource != value)
|
||||
{
|
||||
_resource = value;
|
||||
Hue = CraftResources.GetHue(_resource);
|
||||
[SerializableField(1, fieldChanged: nameof(OnResourceChanged))]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
[InvalidateProperties]
|
||||
private CraftResource _resource;
|
||||
|
||||
InvalidateProperties();
|
||||
this.MarkDirty();
|
||||
}
|
||||
}
|
||||
private void OnResourceChanged(CraftResource oldValue, CraftResource newValue)
|
||||
{
|
||||
Hue = CraftResources.GetHue(_resource);
|
||||
}
|
||||
|
||||
public virtual bool RetainDeedHue => false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue