ISpawner; ISpawnable, cleanup. All custom spawners should inherit from ISpawner. Also, Ridiculous, not rediculous,

This commit is contained in:
asayre 2010-12-26 05:18:57 +00:00
parent 2971234c1c
commit 18d1396670
17 changed files with 212 additions and 243 deletions

View file

@ -95,4 +95,22 @@ namespace Server
void OnManaChanged( Mobile m );
void OnStatsQuery( Mobile beholder, Mobile beheld );
}
public interface ISpawner
{
bool UnlinkOnTaming { get; }
Point3D HomeLocation { get; }
int HomeRange { get; }
void Remove(ISpawnable spawn);
}
public interface ISpawnable : IEntity
{
void OnBeforeSpawn(Point3D location, Map map);
void MoveToWorld(Point3D location, Map map);
void OnAfterSpawn();
ISpawner Spawner { get; set; }
}
}

View file

@ -559,7 +559,7 @@ namespace Server
Weight = 0x80
}
public class Item : IEntity, IHued, IComparable<Item>, ISerializable
public class Item : IEntity, IHued, IComparable<Item>, ISerializable, ISpawnable
{
public static readonly List<Item> EmptyItems = new List<Item>();
@ -3438,6 +3438,7 @@ namespace Server
return true;
}
//TODO: Move to CompactInfo.
private ISpawner m_Spawner;
public ISpawner Spawner{ get{ return m_Spawner; } set{ m_Spawner = value; } }

View file

@ -108,8 +108,11 @@ namespace Server
public static Thread Thread { get { return m_Thread; } }
public static MultiTextWriter MultiConsoleOut { get { return m_MultiConOut; } }
public static readonly bool Is64Bit = (IntPtr.Size == 8);
//TODO: Upon public release of .NET 4.0, use Environment.Is64BitOperatingSystem/Process
#if Framework_4_0
public static readonly bool Is64Bit = Environment.Is64BitProcess;
#else
public static readonly bool Is64Bit = (IntPtr.Size == 8); //Returns the size for the current /process/
#endif
private static bool m_MultiProcessor;
private static int m_ProcessorCount;
@ -482,7 +485,7 @@ namespace Server
ScriptCompiler.Invoke( "Initialize" );
MessagePump ms = m_MessagePump = new MessagePump();
MessagePump messagePump = new MessagePump();
timerThread.Start();
@ -508,7 +511,7 @@ namespace Server
Item.ProcessDeltaQueue();
Timer.Slice();
m_MessagePump.Slice();
messagePump.Slice();
NetState.FlushAll();
NetState.ProcessDisposedQueue();

View file

@ -500,7 +500,7 @@ namespace Server
/// <summary>
/// Base class representing players, npcs, and creatures.
/// </summary>
public class Mobile : IEntity, IHued, IComparable<Mobile>, ISerializable
public class Mobile : IEntity, IHued, IComparable<Mobile>, ISerializable, ISpawnable
{
#region CompareTo(...)
public int CompareTo( IEntity other )

View file

@ -99,17 +99,6 @@ namespace Server
ValoriaShips
}
public interface ISpawner
{
bool UnlinkOnTaming{ get; }
Point3D Home{ get; }
int Range{ get; }
void Remove( object spawn );
}
public class Region : IComparable
{
private static List<Region> m_Regions = new List<Region>();

View file

@ -412,7 +412,7 @@ namespace Server
{
string file = e.FileName;
// Rediculous. FileName is null if the warning/error is internally generated in csc.
// Ridiculous. FileName is null if the warning/error is internally generated in csc.
if ( string.IsNullOrEmpty( file ) ) {
Console.WriteLine( "ScriptCompiler: {0}: {1}", e.ErrorNumber, e.ErrorText );
continue;