//-------------------------------------------------------------------
//
//  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 CSingleHouseMesh_1
{
  string MeshFile = "Models/B_Country_1.mesh";
  string SkinFile = "Models/B_Country_1.skin";
}

class CSingleHouseMesh_2
{
  string MeshFile = "Models/B_Country_2.mesh";
  string SkinFile = "Models/B_Country_2.skin";
}

class CSingleHouseMesh_3
{
  string MeshFile = "Models/B_Country_3.mesh";
  string SkinFile = "Models/B_Country_3.skin";
}

class CSingleHouseMesh_4
{
  string MeshFile = "Models/B_Country_4.mesh";
  string SkinFile = "Models/B_Country_4.skin";
}

class CSingleHouseMesh_5
{
  string MeshFile = "Models/B_Country_5.mesh";
  string SkinFile = "Models/B_Country_5.skin";
}

class CSingleHouseMesh_6
{
  string MeshFile = "Models/B_House_s.mesh";
  string SkinFile = "Models/B_House_s.skin";
}

class CSingleHouseStateControl extends CUnitLifeControl
{
  void CSingleHouseStateControl()
  {
    CUnitLifeControl(1500.0);
    m_DestroyPause = 20.0;
    m_ExplosionId  = "EXPLID_BuildingExplosion";
  }
}

// Building without ground control (for use in villages)
class CBaseSingleHouse extends CBuilding, CUnitWithStateControl
{
  array m_MeshClassNames = array(
      "CSingleHouseMesh_1",
      "CSingleHouseMesh_2",
      "CSingleHouseMesh_3",
      "CSingleHouseMesh_4",
      "CSingleHouseMesh_5",
      "CSingleHouseMesh_6"
    );

  void CBaseSingleHouse()
  {
    int MeshNumber = rand_int(m_MeshClassNames.size());
    InitializeModelAsStatic(m_MeshClassNames[MeshNumber]);
    CUnitWithStateControl("CSingleHouseStateControl");
  }
}

class CBaseGermanSingleHouse extends CBaseSingleHouse
{
  void CBaseGermanSingleHouse()
  {
    Core_AddClassificator("German");
  }
}

// Single game object
class CMountedSingleHouse extends CBaseSingleHouse
{
  void CMountedSingleHouse()
  {
    InitializeGroundControl();
  }
}

class CMountedGermanSingleHouse extends CMountedSingleHouse
{
  void CMountedGermanSingleHouse()
  {
    Core_AddClassificator("German");
  }
}

// Armed building
class CArmedSingleHouseGun extends CBaseWeaponDescriptor
{
  int    AmmoQuantity      = -1;
  float  BulletSpeed       = 600.0;
  float  FireDeviation     = 0.02;
  string LinkJointName     = "";

  string WeaponName        = "Gun";
  float  FireWeaponDelay   = 0.1;
  bool   IsAutotargeting   = false;
  int    AttachSlotNumber  = 1;
}

class CGermanArmedSingleHouseGun extends CArmedSingleHouseGun
{
  string BulletPatternId = "BULLETID_GermenArmedSHouseBullet";
  string SoundOnFire     = "SOUNDID_ArmedHouseGunFireSound";
}

class CArmedSingleHouseBehavior extends
  CBaseBehavior,
  CArmedSingleHouseFireParameters
{
  boolean CanMove = false;

  void CArmedSingleHouseBehavior()
  {
    CBaseBehavior();
  }
}

class CArmedSingleHouseFireParameters
{
  boolean  CanFire = true;

  int  FirePeriod        = 200; // ms
  int  FirePeriodRandAdd = 100; // ms

  int  ShootGunNum = 1;

  boolean  BurstFire = true;
  int  BurstTime         = 2000; // ms
  int  BurstTimeRandAdd  = 1000; // ms

  int  BurstDelay        = 1000; // ms
  int  BurstDelayRandAdd = 2000; // ms

// radar

  boolean  HasRadar = true;

  float  MaxRadarDistance = 1500; // m
  float  MinRadarDistance = 10;   // m

  int    UpdateRadarPeriod        = 2000; // ms
  int    UpdateRadarPeriodRandAdd = 1000; // ms

  boolean  FireFlying = true;
  boolean  FireGround = true;
};

class CBaseGermanArmedSingleHouse extends
  CBaseSingleHouse,
  CArmedUnit,
  CUnitWithBehavior
{
  void CBaseGermanArmedSingleHouse()
  {
    CreateStaticWeapon("Gun", "CGermanArmedSingleHouseGun");
    InitializeVehicleBehavior("CArmedSingleHouseBehavior");
    Core_AddClassificator("German");
  }
}

class CMountedGermanArmedSingleHouse extends CBaseGermanArmedSingleHouse
{
  void CMountedGermanArmedSingleHouse()
  {
    InitializeGroundControl();
  }
}

