public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
bool found = false;
foreach (Mobile m in this.GetObjectsInRange(1)) // Looking for someone close by
{
if (m is Beo)
{
found = true;
}
}
if (!found) this.Delete();
}
Would it be better to create a private class in Beo itself?
namespace Server.Items
{
public class TrashBag : Container
{
[Constructable]
public TrashBag() : base( 0xE76 )
{
...
}
...
private Timer m_Timer;
private class EmptyTimer : Timer
{
private TrashBag m_Bag;
public EmptyTimer( TrashBag bag ) : base( TimeSpan.FromMinutes( 5.0 ) )
{
m_Bag = bag;
Priority = TimerPriority.FiveSeconds;
}
protected override void OnTick()
{
m_Bag.Empty( 501479 ); // Emptying the trashcan!
}
}
}
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.