
function AISMN_GoToHome::OnEnter(%this,%obj)
{
   %home = GetHome(%obj);
   if(0 != %home)
   {
      SetPathToSpot(%obj,GetBuildingDoorX(%home),GetBuildingDoorY(%home));
      GetThisObject(%obj).playThread( 0, "run");
   }
}

function AISMN_GoToHome::OnExit(%this,%obj)
{
   GetThisObject(%obj).playThread( 0, "root");
}

function AISMN_GoToHome::Update(%this,%obj)
{
   if(GetHome(%obj) == 0)
   {
      ReturnValue(%obj,1);
      return;
   }
   
   if(!IsFollowingPath(%obj))
   {
      ReturnValue(%obj,0);
      return;
   }
   
   ReturnValue(%obj,-1);
}
