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

class CSovietTankStateControl extends CMobileGroundUnitStateControl
{
  void CSovietTankStateControl()
  {
    CMobileGroundUnitStateControl(1000.0);
    m_DestroyPause = 7.5;
    m_ExplosionId  = "EXPLID_SovietTankExplosion";
  }
}

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

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

  float  MaxAngleSpeed  = 90.0;
}

class CSovietTankGun extends CBaseWeaponDescriptor
{
  int    AmmoQuantity      = -1;
  float  BulletSpeed       = 500.0;
  float  FireDeviation     = 0.005;
  string BulletPatternId   = "BULLETID_SovietTankGunBullet";
  string LinkJointName     = "_Gun_Fire_01";
  string EffectOnFire      = "EFFECTID_TankGunFireEffect";
  string FireCloudEffect   = "EFFECTID_TankGunFireCloudEffect";
  string SoundOnFire       = "SOUNDID_TankGunFireSound";

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

class CSovietTankBehavior extends
    CBaseBehavior, CSovietTankMoveParameters, CSovietTankFireParameters
{
  void CSovietTankBehavior()
  {
    CBaseBehavior();
  }
}

class CSovietTankMoveParameters
{
  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     = -.03; //#TMP:
  float  RotationBank = .006;   //#TMP:
}

class CSovietTankFireParameters
{
  boolean  CanFire = true;

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

  int  ShootGunNum = 1;

  boolean  BurstFire = false;

// radar

  boolean  HasRadar = true;

  float  MaxRadarDistance = 500; // m
  float  MinRadarDistance = 1;   // m

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

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

class CSovietTank extends
  CGroundUnit,
  CArmedUnit,
  CUnitWithSound,
  CUnitWithCamera,
  CUnitWithStateControl,
  CUnitWithBehavior
{
  void CSovietTank()
  {
    InitializeModelAsAnimated("CSovietTankMesh");
    CUnitWithStateControl("CSovietTankStateControl");
    InitializeSound("CSovietTankEngineSound");

    CreateAnimatedWeapon("Weapon", "CSovietTankGun", "CSovietTankTargetingAnimator");

    InitializeVehicleBehavior("CSovietTankBehavior");

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

