Server.Items.BaseHouseDoor.IsInside C# (CSharp) Method

IsInside() public method

public IsInside ( Server.Mobile from ) : bool
from Server.Mobile
return bool
		public override bool IsInside( Mobile from )
		{
			int x,y,w,h;

			const int r = 2;
			const int bs = r*2+1;
			const int ss = r+1;

			switch ( m_Facing )
			{
				case DoorFacing.WestCW:
				case DoorFacing.EastCCW: x = -r; y = -r; w = bs; h = ss; break;

				case DoorFacing.EastCW: 
				case DoorFacing.WestCCW: x = -r; y = 0; w = bs; h = ss; break;

				case DoorFacing.SouthCW:
				case DoorFacing.NorthCCW: x = -r; y = -r; w = ss; h = bs; break;

				case DoorFacing.NorthCW:
				case DoorFacing.SouthCCW: x = 0; y = -r; w = ss; h = bs; break;

				//No way to test the 'insideness' of SE Sliding doors on OSI, so leaving them default to false until furthur information gained

				default: return false;
			}

			int rx = from.X - X;
			int ry = from.Y - Y;
			int az = Math.Abs( from.Z - Z );

			return ( rx >= x && rx < (x+w) && ry >= y && ry < (y+h) && az <= 4 );
		}
	}