- type: entity
  parent: [ CMBaseWeaponGun, BaseItem]
  id: RuMCMachineGunUTES-C
  categories: [ HideSpawnMenu ]
  name: UTES-C heavy machine gun
  description: UPP 12.7x108mm heavy machine gun. If you're carrying this without a tripod, you hate your back. If you're shooting it with a tripod, you hate the enemy.
  components:
  - type: Item
    size: Huge
  - type: AmmoCounter
  - type: StaticPrice
    price: 500
  - type: MagazineAmmoProvider
    autoEject: true
  - type: RMCAmmoEject
  - type: MagazineVisuals
    magState: mag
    steps: 1
    zeroVisible: true
  - type: Appearance
  - type: RMCNameItemOnVend
    item: PrimaryGun
  - type: Sprite
    sprite: _RuMC14/Objects/Weapons/Guns/HMGs/UTES-C.rsi
    layers:
    - state: utes-c_gun_mount
    - state: mag-0
      map: [ "enum.GunVisualLayers.Mag" ]
  - type: Clothing
    slots:
    - suitStorage
    - Back
  - type: MeleeWeapon
    damage:
      types:
        Blunt: 5
  - type: Gun
    selectedMode: FullAuto
    availableModes:
    - FullAuto
    soundGunshot:
      path: /Audio/_RuMC14/Weapons/Guns/Gunshots/gun_UTES-C.ogg
      params:
        volume: -1
        variation: 0.05
    soundEmpty:
      path: /Audio/Weapons/Guns/Empty/lmg_empty.ogg
  - type: RMCSelectiveFire
    baseFireModes:
    - FullAuto
    recoilUnwielded: 0
    scatterUnwielded: 0
    baseFireRate: 7.2
    modifiers:
      FullAuto:
        maxScatterModifier: 2
        useBurstScatterMult: false
        unwieldedScatterMultiplier: 0
        shotsToMaxScatter: 110
  - type: RMCWeaponAccuracy
  - type: ContainerContainer
    containers:
      gun_magazine: !type:ContainerSlot
      gun_chamber: !type:ContainerSlot
  - type: ItemSlots
    slots:
      gun_magazine:
        name: Magazine
        insertSound: /Audio/_RMC14/Weapons/Guns/Reload/m41_reload.ogg
        ejectSound: /Audio/_RMC14/Weapons/Guns/Reload/m41_reload.ogg
        priority: 2
        whitelist:
          tags:
          - RuMCMagazineUTES-C
          - RuMCMagazineUTES-CTracter
  - type: GunDamageModifier
    multiplier: 1
  - type: GunRequiresSkills
    skills:
      RMCSkillEngineer: 1
      RMCSkillFirearms: 1
  - type: GunSkilledRecoil
    setRecoil: 0
    skills:
      RMCSkillFirearms: 0
    mustBeWielded: false
  - type: WieldedCrosshair
    rsi:
      sprite: _RMC14/Interface/MousePointer/lmg_mouse.rsi
      state: all
  - type: MountableWeapon
  - type: GunUnskilledPenalty
    firearms: 0
    angleIncrease: 0
    accuracyAddMult: 0
  - type: Scope
    scopePopup: null
    unScopePopup: null
    canUseInsideContainer: true
    canUseNightVision: true
    zoomLevels:
    - zoom: 1
      offset: 7
      doAfter: 0
      allowMovement: true
  - type: Tag
    tags:
    - RuMCMachineGunUTES-C
  - type: Overheat

# Magazines
- type: entity
  parent: CMMagazineRifleBase
  id: RuMCMagazineUTES-C
  name: Box of UTES-C ammunition (12.7x108 mm steel-core cartridges)
  description: Box of 110 12.7x108 mm armor-piercing cartridges for the UTES-C heavy machine gun.
  components:
  - type: Tag
    tags:
    - RuMCMagazineUTES-C
  - type: BallisticAmmoProvider
    whitelist:
      tags:
      - RuMCCartridgeHMG127x108mm
    proto: RuMCCartridgeHMG127x108mm
    capacity: 110
    deleteWhenEmpty: false
  - type: Sprite
    sprite: _RuMC14/Objects/Weapons/Guns/Ammunition/Magazines/HMGs/UTES-C.rsi
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]
  - type: Clothing
    slots:
    - suitStorage

- type: entity
  parent: RuMCMagazineUTES-C
  id: RuMCMagazineUTES-CTracter
  name: Box of UTES-C ammunition (12.7x108 mm armor-piercing tracer cartridges)
  description: A box with 110 12.7x108 mm armor-piercing tracer rounds for the UTES-S heavy machine gun.
  components:
  - type: Tag
    tags:
    - RuMCMagazineUTES-CTracter
  - type: BallisticAmmoProvider
    whitelist:
      tags:
      - RuMCCartridgeHMG127x108mmTracer
    proto: RuMCCartridgeHMG127x108mmTracer
    capacity: 110
    deleteWhenEmpty: false

# Cartridges

- type: entity
  parent: CMBaseCartridgeRifle
  id: RuMCCartridgeHMG127x108mm
  name: 12.7x108mm
  components:
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/Casings/large_casing.rsi
    layers:
    - state: base
      map: ["enum.AmmoVisualLayers.Base"]
  - type: CartridgeAmmo
    proto: RuMCBulletHMG127x108mm
  - type: Tag
    tags:
    - RuMCCartridgeHMG127x108mm

- type: entity
  parent: RuMCCartridgeHMG127x108mm
  id: RuMCCartridgeHMG127x108mmTracer
  name: 12.7x108mm Tracer
  components:
  - type: CartridgeAmmo
    proto: RuMCBulletHMG127x108mmTracer
  - type: Tag
    tags:
    - RuMCCartridgeHMG127x108mmTracer

# Projectiles

- type: entity
  parent: CMBulletBase
  id: RuMCBulletHMG127x108mm
  name: bullet (12.7x108mm)
  categories: [ HideSpawnMenu ]
  components:
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/Ammunition/Projectiles/bullet_projectiles.rsi
    layers:
    - state: bullet
      shader: unshaded
  - type: Projectile
    damage:
      types:
        Piercing: 54
  - type: CMArmorPiercing
    amount: 30
  - type: RMCProjectileDamageFalloff
    thresholds:
    - range: 2 # cm13 code says 7 but after testing it looks like it starts losing damage after the first tile
      falloff: 3
    - range: 15
      falloff: 9999
  - type: RMCProjectileAccuracy
    accuracy: 75
    thresholds:
    - range: 6 #cm13(10)
      falloff: 5
  - type: RMCStunOnHit
    stuns:
    - whitelist:
        minMobSize: VerySmallXeno
      maxRange: 1
      slowTime: 0.5
    - whitelist:
        components:
        - Marine
      maxRange: 1
      slowTime: 2

- type: entity
  parent: RuMCBulletHMG127x108mm
  id: RuMCBulletHMG127x108mmTracer
  name: bullet (12.7x108mm Tracer)
  categories: [ HideSpawnMenu ]
  components:
  - type: PointLight
    enabled: true
    color: "#00ff66"
    radius: 2
    energy: 8.0

# Tags
- type: Tag
  id: RuMCMagazineUTES-C

- type: Tag
  id: RuMCMagazineUTES-CTracter

- type: Tag
  id: RuMCMachineGunUTES-C

- type: Tag
  id: RuMCCartridgeHMG127x108mm

- type: Tag
  id: RuMCCartridgeHMG127x108mmTracer
