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

class CSovietAmmoBoxMesh
{
  string MeshFile = "Models/B_S_AmmoBox.mesh";
  string SkinFile = "Models/B_S_AmmoBox.skin";
}

class CAmmoBoxStateControl
  extends CUnitLifeControl, CExplosionGenerator
{
  void CAmmoBoxStateControl()
  {
    CUnitLifeControl(1000.0);
    m_DestroyPause = 0.0;
    m_ExplosionId  = "EXPLID_AmmoBoxExplosion";
  }

  void CreateDetonateEffects()
  {
    GenerateBullets(
        30,
        "BULLETID_ExplosionFireSplash",
        array(0.0, Math_HALFPI),
        20,
        array(0.0, 0.0),
        array(75.0, 250.0),
        GetUnitPosition()
      );

    GenerateBullets(
        5,
        "BULLETID_ExplosionFireBall",
        array(0.5 * Math_HALFPI, Math_HALFPI),
        20,
        array(0.0, 0.0),
        array(60.0, 80.0),
        GetUnitPosition()
      );
  }
}

// Building without ground control (for use in villages)
class CBaseSovietAmmoBox extends CBuilding, CUnitWithStateControl
{
  void CBaseSovietAmmoBox()
  {
    InitializeModelAsStatic("CSovietAmmoBoxMesh");
    CUnitWithStateControl("CAmmoBoxStateControl");
    Core_AddClassificator(CLASSIFICATOR_NOTVISIBLEONRADAR);
  }
}

class CBaseGermanAmmoBox extends CBuilding, CUnitWithStateControl
{
  void CBaseGermanAmmoBox()
  {
    InitializeModelAsStatic("CGermanAmmoBoxMesh");
    CUnitWithStateControl("CAmmoBoxStateControl");
    Core_AddClassificator(CLASSIFICATOR_NOTVISIBLEONRADAR);
  }
}

// Single game object
class CMountedSovietAmmoBox extends CBaseSovietAmmoBox
{
  void CMountedSovietAmmoBox()
  {
    InitializeGroundControl();
  }
}

class CMountedGermanAmmoBox extends CBaseGermanAmmoBox
{
  void CMountedGermanAmmoBox()
  {
    InitializeGroundControl();
  }
}


