//-------------------------------------------------------------------
//
//  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.
//
//-------------------------------------------------------------------

// Common objects
class CGunTowerMesh
{
  string MeshFile = "Models/B_GunTower.mesh";
  string SkinFile = "Models/B_GunTower.skin";
  string AnimFile = "Models/B_GunTower.anim";
}

class CGunTowerTargetingAnimator
{
  string HorAnimName    = "tower";
  string VerAnimName    = "gun";

  float  LeftEndAngle   = -180.0;
  float  RightEndAngle  =  180.0;
  float  TopEndAngle    = -10.0;
  float  BottomEndAngle =  20.0;

  float  MaxAngleSpeed  = 180.0;
}

class CGunTowerGun extends CBaseWeaponDescriptor
{
  int    AmmoQuantity      = -1;
  float  BulletSpeed       = 600.0;
  float  FireDeviation     = 0.02;
  string LinkJointName     = "_Gun_Fire_01";

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

class CGunTowerBehavior extends
    CBaseBehavior, CGunTowerFireParameters
{
  boolean CanMove = false;

  void CGunTowerBehavior()
  {
    CBaseBehavior();
  }
}

class CGunTowerFireParameters
{
  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;
};




// German gun tower

class CGermanGunTowerStateControl extends CUnitLifeControl
{
  void CGermanGunTowerStateControl()
  {
    CUnitLifeControl(1000.0);
    m_DestroyPause = 7.5;
    m_ExplosionId  = "EXPLID_GermanGunTowerExplosion";
  }
}

class CGermanGunTowerGun extends CGunTowerGun
{
  string BulletPatternId = "BULLETID_GermanGunTowerGunBullet";
  string EffectOnFire    = "EFFECTID_GunTowerGunFireEffect";
  string SoundOnFire     = "SOUNDID_GunTowerGunFireSound";
}

// Building without ground control (for use in villages)
class CBaseGermanGunTower extends
  CBuilding, CUnitWithStateControl, CUnitWithBehavior, CArmedUnit
{
  void CBaseGermanGunTower()
  {
    InitializeModelAsAnimated("CGunTowerMesh");
    CUnitWithStateControl("CGermanGunTowerStateControl");
    CreateAnimatedWeapon("Gun", "CGermanGunTowerGun", "CGunTowerTargetingAnimator");
    InitializeVehicleBehavior("CGunTowerBehavior");

    Core_AddClassificator("German");
    Core_AddClassificator("GunTower");   // for cockpit identification
    Core_AddClassificator("GroundUnit"); // for behavior fire logic
  }
}

// Single game object
class CMountedGermanGunTower extends CBaseGermanGunTower
{
  void CMountedGermanGunTower()
  {
    InitializeGroundControl();
  }
}




// Soviet gun tower

class CSovietGunTowerStateControl extends CUnitLifeControl
{
  void CSovietGunTowerStateControl()
  {
    CUnitLifeControl(1000.0);
    m_DestroyPause = 7.5;
    m_ExplosionId  = "EXPLID_SovietGunTowerExplosion";
  }
}

class CSovietGunTowerGun extends CGunTowerGun
{
  string BulletPatternId = "BULLETID_SovietGunTowerGunBullet";
  string EffectOnFire    = "EFFECTID_GunTowerGunFireEffect";
  string SoundOnFire     = "SOUNDID_GunTowerGunFireSound";
}

// Building without ground control (for use in villages)
class CBaseSovietGunTower extends
  CBuilding, CUnitWithStateControl, CUnitWithBehavior, CArmedUnit
{
  void CBaseSovietGunTower()
  {
    InitializeModelAsAnimated("CGunTowerMesh");
    CUnitWithStateControl("CSovietGunTowerStateControl");
    CreateAnimatedWeapon("Gun", "CSovietGunTowerGun", "CGunTowerTargetingAnimator");
    InitializeVehicleBehavior("CGunTowerBehavior");

    Core_AddClassificator("Russian");
    Core_AddClassificator("GunTower");        // for cockpit identification
    Core_AddClassificator("GroundUnit"); // for behavior fire logic
  }
}

// Single game object
class CMountedSovietGunTower extends CBaseSovietGunTower
{
  void CMountedSovietGunTower()
  {
    InitializeGroundControl();
  }
}



