//-------------------------------------------------------------------
//
//  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 CGermanAntiairMesh
{
  string MeshFile = "Models/G_Antiair.mesh";
  string SkinFile = "Models/G_Antiair.skin";
  string AnimFile = "Models/G_Antiair.anim";
}

class CGermanAntiairStateControl extends CMobileGroundUnitStateControl
{
  void CGermanAntiairStateControl()
  {
    CMobileGroundUnitStateControl(500.0);
    m_DestroyPause = 7.5;
    m_ExplosionId  = "EXPLID_GermanAntiairExplosion";
  }
}

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

  float  LeftEndAngle   = -180.0;
  float  RightEndAngle  =  180.0;
  float  TopEndAngle    = -5.0;
  float  BottomEndAngle =  50.0;

  float  MaxAngleSpeed  = 180.0;
}

class CGermanAntiairGun extends CBaseWeaponDescriptor
{
  int    AmmoQuantity      = -1;
  float  BulletSpeed       = 600.0;
  float  FireDeviation     = 0.015;
  string BulletPatternId   = "BULLETID_GermanAntiairGunBullet";
  string LinkJointName     = "";
  string EffectOnFire      = "EFFECTID_AntiairGunFireEffect";
  string SoundOnFire       = "SOUNDID_AntiairGunFireSound";

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

class CGermanAntiairGun_1 extends CGermanAntiairGun
{
  string LinkJointName = "_Gun_Fire_01";
}

class CGermanAntiairGun_2 extends CGermanAntiairGun
{
  string LinkJointName = "_Gun_Fire_02";
}

class CGermanAntiairGun_3 extends CGermanAntiairGun
{
  string LinkJointName = "_Gun_Fire_03";
}

class CGermanAntiairGun_4 extends CGermanAntiairGun
{
  string LinkJointName = "_Gun_Fire_04";
}

class CGermanAntiairBehavior extends
    CBaseBehavior,
    CGermanAntiairMoveParameters,
    CGermanAntiairFireParameters,
    CGermanAntiairRadarParameters
{
  void CGermanAntiairBehavior()
  {
    CBaseBehavior();
  }
}

class CGermanAntiairMoveParameters
{
  boolean  CanMove               = true;
  float    MaxSpeed              = 25;  // m/s
  float    MaxAngleSpeed         = 8;   // rad/s
  float    MaxAccelleration      = 25;  // m/(s*s)
  float    MaxAngleAccelleration = 25;  // rad/(s*s)

  float  MoveBank     = -.03; //#TMP:
  float  RotationBank = .006;   //#TMP:
}

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

class CGermanAntiairRadarParameters
{
  boolean  HasRadar = true;

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

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

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


class CGermanAntiair extends
  CGroundUnit,
  CArmedUnit,
  CUnitWithSound,
  CUnitWithCamera,
  CUnitWithStateControl,
  CUnitWithBehavior
{
  void CGermanAntiair()
  {
    InitializeModelAsAnimated("CGermanAntiairMesh");
    CUnitWithStateControl("CGermanAntiairStateControl");
    InitializeSound("CGermanAntiairEngineSound");

    CreateAnimatedWeapon("Gun_1", "CGermanAntiairGun_1", "CGermanAntiairTargetingAnimator");
    CreateStaticWeapon("Gun_2", "CGermanAntiairGun_2");
    CreateStaticWeapon("Gun_3", "CGermanAntiairGun_3");
    CreateStaticWeapon("Gun_4", "CGermanAntiairGun_4");

    InitializeVehicleBehavior("CGermanAntiairBehavior");

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

