function AISMN_UseWorkAI::OnEnter(%this,%obj)
{
}

function AISMN_UseWorkAI::OnExit(%this,%obj)
{
   %workplace = GetWorkplace(%obj);
   if(0 != %workplace)
   {
      %component = slgQueryInterface(%workplace, $CID_BUILDING);
      //If there's no component, report an error. 
      if (!%component)
      {
         SetStateVariable(%obj,0,1.0);
         return;
      }
      
      %aicmp = %component.getWorkerAI();
      %object = GetThisObject(%obj);
      %object.setAI(%aicmp);
   }
   return;
}

function AISMN_UseWorkAI::Update(%this,%obj)
{   
   ReturnValue(%obj,0);
}
