//-------------------------------------------------------------------
//
//  This code is copyright 2001 by G5 Software.
//  Any unauthorized usage, either in part or in whole of this code
//  is strictly prohibited. Violators WILL be prosecuted to the
//  maximum extent allowed by law.
//
//-------------------------------------------------------------------

class CCountryMillMesh_1
{
  string MeshFile = "Models/B_Country_Mill_1.mesh";
  string SkinFile = "Models/B_Country_Mill_1.skin";
  string AnimFile = "Models/B_Country_Mill_1.anim";
}

class CCountryMillMesh_2
{
  string MeshFile = "Models/B_Country_Mill_2.mesh";
  string SkinFile = "Models/B_Country_Mill_2.skin";
  string AnimFile = "Models/B_Country_Mill_2.anim";
}

class CCountryMillStateControl extends CUnitLifeControl
{
  void CCountryMillStateControl()
  {
    CUnitLifeControl(3500.0);
    m_DestroyPause = 20.0;
    m_ExplosionId  = "EXPLID_BuildingExplosion";
  }
}

class CCountryMillRotorAnimator
{
  string AnimationName = "rotor";
  float  SpeedFactor   = 0.1;

  void CCountryMillRotorAnimator()
  {
    SpeedFactor = rand(0.05, 0.15);
  }
}

// Building without ground control (for use in villages)
class CBaseCountryMill extends CBuilding, CUnitWithStateControl
{
  array m_MeshClassNames = array(
      "CCountryMillMesh_1",
      "CCountryMillMesh_2"
    );

  void CBaseCountryMill()
  {
    int MeshNumber = rand_int(m_MeshClassNames.size());
    InitializeModelAsAnimated(m_MeshClassNames[MeshNumber]);
    CUnitWithStateControl("CCountryMillStateControl");

    CreateComponent("Rotor", "CircledAnimator", "CCountryMillRotorAnimator");
    SetComponentSlaveObject("Rotor", "Mesh");
  }
}

// Single game object
class CMountedCountryMill extends CBaseCountryMill
{
  void CMountedCountryMill()
  {
    InitializeGroundControl();
  }
}



