fix(codegen): Fixes various code gen issues. Adds better embedded serialization support (#688)
* Adds save flag support (see `ElvenGlasses` for an example) * Updates AOSAttributes so they are code genned * Fixes embedded object support by adding an `IRawSerializable` * Fixes various inconsistencies in serializing with codegen
This commit is contained in:
parent
69af652a18
commit
2c8097f707
54 changed files with 787 additions and 507 deletions
|
|
@ -20,10 +20,10 @@ namespace Server.Items
|
|||
bool CouldFit(IPoint3D p, Map map);
|
||||
}
|
||||
|
||||
[Serializable(2, false)]
|
||||
[Serializable(3, false)]
|
||||
public abstract partial class BaseAddon : Item, IChoppable, IAddon
|
||||
{
|
||||
private CraftResource m_Resource;
|
||||
private CraftResource _resource;
|
||||
|
||||
public BaseAddon() : base(1)
|
||||
{
|
||||
|
|
@ -67,13 +67,13 @@ namespace Server.Items
|
|||
[SerializableField(1)]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get => m_Resource;
|
||||
get => _resource;
|
||||
set
|
||||
{
|
||||
if (m_Resource != value)
|
||||
if (_resource != value)
|
||||
{
|
||||
m_Resource = value;
|
||||
Hue = CraftResources.GetHue(m_Resource);
|
||||
_resource = value;
|
||||
Hue = CraftResources.GetHue(_resource);
|
||||
|
||||
InvalidateProperties();
|
||||
this.MarkDirty();
|
||||
|
|
@ -281,9 +281,9 @@ namespace Server.Items
|
|||
{
|
||||
_components = reader.ReadEntityList<AddonComponent>();
|
||||
|
||||
if (version < 1 && Weight == 0)
|
||||
if (version == 2)
|
||||
{
|
||||
Weight = -1;
|
||||
_resource = (CraftResource)reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue