fix: Codgens more addons (#685)
* Fixes after deserialization not executing for older versions of an object * Codegens more addons
This commit is contained in:
parent
25fa9b397b
commit
4c265562bb
255 changed files with 1514 additions and 3742 deletions
|
|
@ -1,20 +1,18 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Commands;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SolenAntHoleComponent : AddonComponent
|
||||
[Serializable(0)]
|
||||
public partial class SolenAntHoleComponent : AddonComponent
|
||||
{
|
||||
public SolenAntHoleComponent(int itemID) : base(itemID)
|
||||
{
|
||||
}
|
||||
|
||||
public SolenAntHoleComponent(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.InRange(this, 2))
|
||||
|
|
@ -37,30 +35,18 @@ namespace Server.Items
|
|||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class SolenAntHole : BaseAddon
|
||||
[Serializable(0)]
|
||||
public partial class SolenAntHole : BaseAddon
|
||||
{
|
||||
private List<Mobile> m_Spawned;
|
||||
[SerializableField(0, getter: "private", setter: "private")]
|
||||
private List<Mobile> _spawned;
|
||||
|
||||
[Constructible]
|
||||
public SolenAntHole()
|
||||
{
|
||||
m_Spawned = new List<Mobile>();
|
||||
_spawned = new List<Mobile>();
|
||||
|
||||
AddComponent(new AddonComponent(0x914), "dirt", 0, 0, 0, 0);
|
||||
AddComponent(new SolenAntHoleComponent(0x122A), "a hole", 0x1, 0, 0, 0);
|
||||
|
|
@ -74,10 +60,6 @@ namespace Server.Items
|
|||
AddComponent(new AddonComponent(0xED3), "dirt", 0, 0, 1, 0);
|
||||
}
|
||||
|
||||
public SolenAntHole(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool ShareHue => false;
|
||||
public override bool HandlesOnMovement => true;
|
||||
|
||||
|
|
@ -142,7 +124,7 @@ namespace Server.Items
|
|||
|
||||
public void SpawnAnt(BaseCreature ant)
|
||||
{
|
||||
m_Spawned.Add(ant);
|
||||
this.Add(_spawned, ant);
|
||||
|
||||
var map = Map;
|
||||
var p = Location;
|
||||
|
|
@ -162,33 +144,15 @@ namespace Server.Items
|
|||
|
||||
public bool SpawnKilled()
|
||||
{
|
||||
for (var i = m_Spawned.Count - 1; i >= 0; i--)
|
||||
for (var i = _spawned.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (!m_Spawned[i].Alive || m_Spawned[i].Deleted)
|
||||
if (!_spawned[i].Alive || _spawned[i].Deleted)
|
||||
{
|
||||
m_Spawned.RemoveAt(i);
|
||||
this.RemoveAt(_spawned, i);
|
||||
}
|
||||
}
|
||||
|
||||
return m_Spawned.Count < 2;
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(m_Spawned);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadEncodedInt();
|
||||
|
||||
m_Spawned = reader.ReadEntityList<Mobile>();
|
||||
return _spawned.Count < 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue