fix: Fixes serialization and dirty tracking conveniences (#1627)
### Summary - Fixes issues with non-_ISerializable_ objects having bad serialization (Skill/Stat. Mods) - Fixes issues with MarkDirty and namespaces: https://github.com/modernuo/SerializationGenerator/issues/29 - Fixes missing dirty tracking for some data structures. - Fixes cascading MarkDirty for non-serializable types that have owners that are also non-serializable types. ### New Codegenned API When a data structure (Array, List, Dictionary, HashSet, etc) is source generated for serialization, new methods are added which will handle dirty tracking. Use these instead of the built in methods for that data structure. _All Data Structures_ ```cs public void Clear<PropertyName>(); ``` _Lists and Sets_ ```cs public void AddTo<PropertyName>(V value); public void RemoveFrom<PropertyName>(V value); ``` _Lists_ ```cs public void InsertInto<PropertyName>(int index, V value); public void RemoveFrom<PropertyName>At(int index); ``` _Dictionaries_ ```cs public void AddTo<PropertyName>(T key, V value); public void RemoveFrom<PropertyName>(T key); public void ReplaceIn<PropertyName>(T key, V value); ``` Over time, they will be cleaned up and more variants added such as `bool RemoveFrom<PropertyName>(T key, out V value)`
This commit is contained in:
parent
3a0d4b171b
commit
b7882df136
25 changed files with 64 additions and 77 deletions
|
|
@ -94,7 +94,7 @@ public partial class PlagueBeastComponent : PlagueBeastInnard
|
|||
{
|
||||
if (_organ?.OnDropped(from, dropped, this) == true && dropped is PlagueBeastComponent component)
|
||||
{
|
||||
_organ.Add(_organ.Components, component);
|
||||
_organ.AddToComponents(component);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -109,7 +109,7 @@ public partial class PlagueBeastComponent : PlagueBeastInnard
|
|||
// * You rip the organ out of the plague beast's flesh *
|
||||
from.SendLocalizedMessage(IsGland ? 1071895 : 1071914, null);
|
||||
|
||||
_organ.Remove(_organ.Components, this);
|
||||
_organ.RemoveFromComponents(this);
|
||||
|
||||
Organ = null;
|
||||
from.PlaySound(0x1CA);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public partial class PlagueBeastOrgan : PlagueBeastInnard
|
|||
c.Location = new Point3D(X + x, Y + y, Z);
|
||||
c.Map = Map;
|
||||
|
||||
this.Add(Components, c);
|
||||
AddToComponents(c);
|
||||
}
|
||||
|
||||
public override bool Scissor(Mobile from, Scissors scissors)
|
||||
|
|
@ -55,6 +55,12 @@ public partial class PlagueBeastOrgan : PlagueBeastInnard
|
|||
if (!Opened && !_opening)
|
||||
{
|
||||
_opening = true;
|
||||
|
||||
Timer.StartTimer(TimeSpan.FromSeconds(3), Open);
|
||||
|
||||
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071897); // You carefully cut into the organ.
|
||||
return true;
|
||||
|
||||
void Open()
|
||||
{
|
||||
_opening = false;
|
||||
|
|
@ -63,11 +69,6 @@ public partial class PlagueBeastOrgan : PlagueBeastInnard
|
|||
FinishOpening(from);
|
||||
}
|
||||
}
|
||||
|
||||
Timer.StartTimer(TimeSpan.FromSeconds(3), Open);
|
||||
|
||||
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071897); // You carefully cut into the organ.
|
||||
return true;
|
||||
}
|
||||
|
||||
scissors.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1071898); // You have already cut this organ open.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue