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

class CSandBagsStateControl extends CUnitLifeControl
{
  void CSandBagsStateControl()
  {
    CUnitLifeControl(1500.0);
    m_DestroyPause = 7.5;
    m_ExplosionId  = "EXPLID_SandBagsExplosion";
  }
}

// gun
class CArmedSandBagsGun extends CBaseWeaponDescriptor
{
  int    AmmoQuantity      = -1;
  float  BulletSpeed       = 200.0;
  float  FireDeviation     = 0.02;
  string LinkJointName     = "";

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

class CGermanArmedSandBagsGun extends CArmedSandBagsGun
{
  string EffectOnFire      = "EFFECTID_ArmedSandBagsGunFireEffect";
  string SoundOnFire       = "SOUNDID_ArmedSandBagsGunFireSound";
  string BulletPatternId   = "BULLETID_GermanArmedSandBagsBullet";
}


// panzerfaust
class CFaustSandBagsGun extends CBaseWeaponDescriptor
{
  int    AmmoQuantity      = -1;
  float  BulletSpeed       = 400.0;
  float  FireDeviation     = 0.0;
  string LinkJointName     = "";

  string WeaponName        = "Faust";
  float  FireWeaponDelay   = 1.0;
  bool   IsAutotargeting   = false;
  int    AttachSlotNumber  = 1;
}

class CGermanFaustSandBagsGun extends CFaustSandBagsGun
{
  string EffectOnFire      = "EFFECTID_PanzerFaustFireEffect";
  string SoundOnFire       = "SOUNDID_PanzerFaustFireSound";
  string BulletPatternId   = "BULLETID_GermanPanzerFaustBullet";
}

// behavior
class CArmedSandBagsBehavior extends
  CBaseBehavior, CArmedSandBagsFireParameters
{
  bool CanMove = false;

  void CArmedSandBagsBehavior()
  {
    CBaseBehavior();
  }
}

class CArmedSandBagsFireParameters
{
  boolean  CanFire = true;

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

  int  ShootGunNum       = 1;

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

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

// radar

  bool HasRadar           = true;

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

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

  bool  FireFlying = true;
  bool  FireGround = true;
};

class CFaustSandBagsBehavior extends
  CBaseBehavior, CFaustSandBagsFireParameters
{
  bool CanMove = false;

  void CFaustSandBagsBehavior()
  {
    CBaseBehavior();
  }
}

class CFaustSandBagsFireParameters
{
  boolean  CanFire = true;

  int  FirePeriod        = 5000; // ms
  int  FirePeriodRandAdd = 1000; // ms

  int  ShootGunNum       = 1;

  bool BurstFire         = false;
  int  BurstTime         = 2000; // ms
  int  BurstTimeRandAdd  = 1000; // ms

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

// radar

  bool HasRadar          = true;

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

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

  bool  FireFlying = true;
  bool  FireGround = true;
};

class CFaustAntiairSandBagsBehavior extends
  CBaseBehavior, CFaustAntiairSandBagsFireParameters
{
  bool CanMove = false;

  void CFaustAntiairSandBagsBehavior()
  {
    CBaseBehavior();
  }
}

class CFaustAntiairSandBagsFireParameters
{
  boolean  CanFire = true;

  int  FirePeriod        = 3000; // ms
  int  FirePeriodRandAdd = 1000; // ms

  int  ShootGunNum       = 1;

  bool BurstFire         = false;
  int  BurstTime         = 2000; // ms
  int  BurstTimeRandAdd  = 1000; // ms

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

// radar

  bool HasRadar          = true;

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

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

  bool  FireFlying = true;
  bool  FireGround = false;
};


// Building without ground control (for use in villages)
class CBaseGermanArmedSandBags extends
  CBuilding, CUnitWithStateControl, CArmedUnit, CUnitWithBehavior
{
  void CBaseGermanArmedSandBags()
  {
    InitializeModelAsStatic("CSandBagsMesh");
    CUnitWithStateControl("CSandBagsStateControl");

    CreateStaticWeapon("Gun", "CGermanArmedSandBagsGun");
    InitializeVehicleBehavior("CArmedSandBagsBehavior");

    Core_AddClassificator(CLASSIFICATOR_NOTVISIBLEONRADAR);
    Core_AddClassificator("German");
  }
}

class CBaseGermanFaustSandBags extends
  CBuilding, CUnitWithStateControl, CArmedUnit, CUnitWithBehavior
{
  void CBaseGermanFaustSandBags()
  {
    InitializeModelAsStatic("CSandBagsMesh");
    CUnitWithStateControl("CSandBagsStateControl");

    CreateStaticWeapon("Gun", "CGermanFaustSandBagsGun");
    InitializeVehicleBehavior("CFaustSandBagsBehavior");

    Core_AddClassificator(CLASSIFICATOR_NOTVISIBLEONRADAR);
    Core_AddClassificator("German");
  }
}

class CBaseGermanFaustAntiairSandBags extends
  CBuilding, CUnitWithStateControl, CArmedUnit, CUnitWithBehavior
{
  void CBaseGermanFaustAntiairSandBags()
  {
    InitializeModelAsStatic("CSandBagsMesh");
    CUnitWithStateControl("CSandBagsStateControl");

    CreateStaticWeapon("Gun", "CGermanFaustSandBagsGun");
    InitializeVehicleBehavior("CFaustAntiairSandBagsBehavior");

    Core_AddClassificator(CLASSIFICATOR_NOTVISIBLEONRADAR);
    Core_AddClassificator("German");
  }
}

// Building with ground control
class CMountedGermanArmedSandBags extends CBaseGermanArmedSandBags
{
  void CMountedGermanArmedSandBags()
  {
    InitializeGroundControl();
  }
}

class CMountedGermanFaustSandBags extends CBaseGermanFaustSandBags
{
  void CMountedGermanFaustSandBags()
  {
    InitializeGroundControl();
  }
}

class CMountedGermanFaustAntiairSandBags extends CBaseGermanFaustAntiairSandBags
{
  void CMountedGermanFaustAntiairSandBags()
  {
    InitializeGroundControl();
    Core_AddClassificator("GroundUnit");
  }
}

