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

class CSovietKatushaStateControl extends CMobileGroundUnitStateControl
{
  void CSovietKatushaStateControl()
  {
    CMobileGroundUnitStateControl(1000.0);
    m_DestroyPause = 7.5;
    m_ExplosionId  = "EXPLID_SovietKatushaExplosion";
  }
}

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

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

  float  MaxAngleSpeed  = 30.0;
}

class CSovietKatushaGun extends CWorldPhysics, CBaseWeaponDescriptor
{
  int    AmmoQuantity      = -1;
  float  BulletSpeed       = 150.0;
  vector GravityVector     = g_Gravity;
  float  FireDeviation     = 0.05;
  string BulletPatternId   = "BULLETID_SovietKatushaRocket";
  string EffectOnFire      = "";
  string FireCloudEffect   = "EFFECTID_KatushaRocketFireCloudEffect";
  string SoundOnFire       = "SOUNDID_KatushaRocketFireSound";

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

class CSovietKatushaGun_01 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_01";
}

class CSovietKatushaGun_02 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_02";
}

class CSovietKatushaGun_03 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_03";
}

class CSovietKatushaGun_04 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_04";
}

class CSovietKatushaGun_05 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_05";
}

class CSovietKatushaGun_06 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_06";
}

class CSovietKatushaGun_07 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_07";
}

class CSovietKatushaGun_08 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_08";
}

class CSovietKatushaGun_09 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_09";
}

class CSovietKatushaGun_10 extends CSovietKatushaGun
{
  string LinkJointName = "_Gun_Fire_10";
}

class CSovietKatushaBehavior extends
    CBaseBehavior, CSovietKatushaMoveParameters, CSovietKatushaFireParameters
{
  void CSovietKatushaBehavior()
  {
    CBaseBehavior();
  }
}

class CSovietKatushaMoveParameters
{
  boolean  CanMove = true;

  float  MaxSpeed              = 14;   // m/s
  float  MaxAngleSpeed         = 3;    // rad/s
  float  MaxAccelleration      = 15;   // m/(s*s)
  float  MaxAngleAccelleration = 10;   // rad/(s*s)

  float  MoveBank     = 0.0; // tank has no banking
  float  RotationBank = 0.0; // tank has no banking
}

class CSovietKatushaFireParameters
{
  bool  CanFire = true;

  int   FirePeriod        = 300; // ms
  int   FirePeriodRandAdd = 0; // ms

  int   ShootGunNum = 1;

  bool  BurstFire         = true;
  int   BurstTime         = 3000; // ms
  int   BurstTimeRandAdd  = 0; // ms

  int   BurstDelay        = 9000; // ms
  int   BurstDelayRandAdd = 5000; // ms

// radar

  bool  HasRadar = true;

  float MaxRadarDistance = 100; // m
  float MinRadarDistance = 100;   // m

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

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

class CSovietKatusha extends
  CGroundUnit,
  CArmedUnit,
  CUnitWithSound,
  CUnitWithCamera,
  CUnitWithStateControl,
  CUnitWithBehavior
{
  void CSovietKatusha()
  {
    InitializeModelAsAnimated("CSovietKatushaMesh");
    CUnitWithStateControl("CSovietKatushaStateControl");
    InitializeSound("CSovietKatushaEngineSound");

    CreateAnimatedWeapon("Slot_01", "CSovietKatushaGun_01", "CSovietKatushaTargetingAnimator");
    CreateStaticWeapon("Slot_02", "CSovietKatushaGun_02");
    CreateStaticWeapon("Slot_03", "CSovietKatushaGun_03");
    CreateStaticWeapon("Slot_04", "CSovietKatushaGun_04");
    CreateStaticWeapon("Slot_05", "CSovietKatushaGun_05");
    CreateStaticWeapon("Slot_06", "CSovietKatushaGun_06");
    CreateStaticWeapon("Slot_07", "CSovietKatushaGun_07");
    CreateStaticWeapon("Slot_08", "CSovietKatushaGun_08");
    CreateStaticWeapon("Slot_09", "CSovietKatushaGun_09");
    CreateStaticWeapon("Slot_10", "CSovietKatushaGun_10");

    InitializeVehicleBehavior("CSovietKatushaBehavior");

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

class CCapturedSovietKatusha extends CSovietKatusha
{
  void CCapturedSovietKatusha()
  {
    Core_RemoveClassificator("Russian");
    Core_AddClassificator("German");
  }
}
