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

class CGermanMobileFlakStateControl extends CMobileGroundUnitStateControl
{
  void CGermanMobileFlakStateControl()
  {
    CMobileGroundUnitStateControl(1000.0);
    m_DestroyPause = 7.5;
    m_ExplosionId  = "EXPLID_GermanMobileFlakExplosion";
  }
}

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

  float  LeftEndAngle   = -180.0;
  float  RightEndAngle  =  180.0;
  float  TopEndAngle    =  0.0;
  float  BottomEndAngle =  60.0;

  float  MaxAngleSpeed  = 180.0;
}

class CGermanMobileFlakGun extends CBaseWeaponDescriptor
{
  int    AmmoQuantity      = -1;
  float  BulletSpeed       = 500.0;
  float  FireDeviation     = 0.015;
  string BulletPatternId   = "BULLETID_GermanMobileFlakGunBullet";
  string LinkJointName     = "_Gun_Fire_01";
  string EffectOnFire      = "EFFECTID_MobileFlakGunFireEffect";
  string FireCloudEffect   = "EFFECTID_MobileFlakGunFireCloudEffect";
  string SoundOnFire       = "SOUNDID_MobileFlakGunFireSound";

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

class CGermanMobileFlakBehavior extends
    CBaseBehavior, CGermanMobileFlakMoveParameters, CGermanMobileFlakFireParameters
{
  void CGermanMobileFlakBehavior()
  {
    CBaseBehavior();
  }
}

class CGermanMobileFlakMoveParameters
{
  bool  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 CGermanMobileFlakFireParameters
{
  bool CanFire = true;

  int  FirePeriod        = 2000;//400; // ms
  int  FirePeriodRandAdd = 1000;//0;  // ms
  int  ShootGunNum = 1;

  bool BurstFire         = false;//true;
  int  BurstTime         = 2000; // ms
  int  BurstTimeRandAdd  = 0; // ms

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

// radar

  bool  HasRadar = true;

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

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

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

class CGermanMobileFlak extends
  CGroundUnit, CUnitWithStateControl, CUnitWithBehavior, CUnitWithSound, CArmedUnit
{
  void CGermanMobileFlak()
  {
    InitializeModelAsAnimated("CGermanMobileFlakMesh");
    CUnitWithStateControl("CGermanMobileFlakStateControl");
    CreateAnimatedWeapon("Weapon", "CGermanMobileFlakGun", "CGermanMobileFlakTargetingAnimator");
    InitializeVehicleBehavior("CGermanMobileFlakBehavior");
    InitializeSound("CGermanMobileFlakEngineSound");

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

