- type: entity
  parent: [ CMBaseWeaponRifle, RMCBaseWeaponMagazineVisuals ]
  id: WeaponRifleM16 # TODO: Make the M16 grenadier rifle when impact nades exist
  name: M16 rifle
  description: An old, reliable design first adopted by the U.N. military in the 1960s. Something like this belongs in a museum of war history. It is chambered in 5.56x45mm.
  suffix: Filled
  components:
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/Rifles/m16.rsi
    layers:
    - state: base
      map: [ "enum.GunVisualLayers.Base" ]
    - state: mag-0
      map: [ "enum.GunVisualLayers.Mag" ]
  - type: Clothing
    sprite: _RMC14/Objects/Weapons/Guns/Rifles/m16.rsi
  - type: Gun
    selectedMode: SemiAuto
    availableModes:
    - SemiAuto
    - Burst
    soundGunshot:
      path: /Audio/_RMC14/Weapons/Guns/Gunshots/gun_m16.ogg
  - type: RMCSelectiveFire
    baseFireModes:
    - SemiAuto
    - Burst
    recoilUnwielded: 3
    scatterWielded: 2
    scatterUnwielded: 20
    baseFireRate: 4
    burstScatterMult: 2
    modifiers:
      Burst:
        fireDelay: 0.1665
        maxScatterModifier: 10
        useBurstScatterMult: true
        unwieldedScatterMultiplier: 2
        shotsToMaxScatter: 6
      FullAuto:
        fireDelay: 0
        maxScatterModifier: 13
        useBurstScatterMult: true
        unwieldedScatterMultiplier: 2
        shotsToMaxScatter: 4
  - type: RMCWeaponAccuracy
    accuracyMultiplier: 1.35
    accuracyMultiplierUnwielded: 0.65
  - type: MagazineAmmoProvider
    autoEject: false
    soundAutoEject: null
  - type: ItemSlots
    slots:
      gun_magazine:
        name: Magazine
        startingItem: RMCMagazineRifleM16
        insertSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_m16_reload.ogg
        ejectSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_m16_unload.ogg
        priority: 2
        whitelist:
          tags:
          - RMCMagazineRifleM16
  - type: GunDamageModifier
    multiplier: 1.3
  - type: AttachableHolder
    randomAttachmentChance: 0.42
    slots:
      rmc-aslot-barrel:
        whitelist:
          tags:
          - RMCAttachmentBarrelCharger
          - RMCAttachmentExtendedBarrel
          - RMCAttachmentExtendedCompensator
          - RMCAttachmentSuppressor
          - RMCM5Bayonet
        random:
        - RMCAttachmentSuppressor
        - RMCM5Bayonet
        - RMCAttachmentRecoilCompensator
        - RMCAttachmentExtendedBarrel
      rmc-aslot-rail:
        whitelist:
          tags:
          - RMCAttachmentRailFlashlight
          - RMCAttachmentMagneticHarness
          - RMCAttachmentS5RedDotSight
          - RMCAttachmentS6ReflexSight
          - RMCAttachmentS84xTelescopicScope
          - RMCAttachmentS42xTelescopicMiniscope
        random:
        - RMCAttachmentS5RedDotSight
        - RMCAttachmentS6ReflexSight
        - RMCAttachmentS42xTelescopicMiniscope
      rmc-aslot-stock:
        locked: true
        startingAttachable: RMCAttachmentM16Stock
        whitelist:
          tags:
          - RMCAttachmentM16Stock
      rmc-aslot-underbarrel:
        whitelist:
          tags:
          - RMCAttachmentAngledGrip
          - RMCAttachmentVerticalGrip
          - RMCAttachmentFlashlightGrip
          - RMCAttachmentGyroscopicStabilizer
          - RMCAttachmentBipod
          - RMCAttachmentBurstFireAssembly
          - RMCAttachmentExtinguisher
          - RMCAttachmentFlamer # TODO RMC14 advanced flamer
          - RMCAttachmentU1GrenadeLauncher
          - RMCAttachmentU7UnderbarrelShotgun
          - RMCAttachmentLaserSight
          - RMCAttachmentM203GrenadeLauncher
        random:
        - RMCAttachmentAngledGrip
        - RMCAttachmentVerticalGrip
        - RMCAttachmentGyroscopicStabilizer
        - RMCAttachmentBurstFireAssembly
        - RMCAttachmentBipod
        - RMCAttachmentUnderbarrelExtinguisher
        - RMCAttachmentU7UnderbarrelShotgun
        - RMCAttachmentLaserSight
  - type: AttachableHolderVisuals
    offsets:
      rmc-aslot-barrel: 0.81, -0.03
      rmc-aslot-rail: -0.15, 0.12
      rmc-aslot-stock: -0.5, 0
      rmc-aslot-underbarrel: 0.28, -0.33

- type: entity
  parent: WeaponRifleM16
  id: RMCWeaponRifleM16A5
  name: M16A5 Rifle
  description: Modernized version of M16 platform rifle, probably originated from bottomless stockpiles of the United Nations when they switched to more modern rifles. It is chambered in 5.56x45mm.
  components:
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/Rifles/m16a5.rsi
    layers:
    - state: base
      map: [ "enum.GunVisualLayers.Base" ]
    - state: mag-0
      map: [ "enum.GunVisualLayers.Mag" ]
  - type: Clothing
    sprite: _RMC14/Objects/Weapons/Guns/Rifles/m16a5.rsi
  - type: AttachableHolder
    randomAttachmentChance: 0.42
    slots:
      rmc-aslot-barrel:
        whitelist:
          tags:
          - RMCAttachmentBarrelCharger
          - RMCAttachmentExtendedBarrel
          - RMCAttachmentExtendedCompensator
          - RMCAttachmentSuppressor
          - RMCM5Bayonet
        random:
        - RMCAttachmentSuppressor
        - RMCM5Bayonet
        - RMCAttachmentRecoilCompensator
        - RMCAttachmentExtendedBarrel
      rmc-aslot-rail:
        whitelist:
          tags:
          - RMCAttachmentRailFlashlight
          - RMCAttachmentMagneticHarness
          - RMCAttachmentS5RedDotSight
          - RMCAttachmentS6ReflexSight
          - RMCAttachmentS84xTelescopicScope
          - RMCAttachmentS42xTelescopicMiniscope
        random:
        - RMCAttachmentS5RedDotSight
        - RMCAttachmentS6ReflexSight
        - RMCAttachmentS42xTelescopicMiniscope
      rmc-aslot-stock:
        locked: true
      rmc-aslot-underbarrel:
        whitelist:
          tags:
          - RMCAttachmentAngledGrip
          - RMCAttachmentVerticalGrip
          - RMCAttachmentFlashlightGrip
          - RMCAttachmentGyroscopicStabilizer
          - RMCAttachmentBipod
          - RMCAttachmentBurstFireAssembly
          - RMCAttachmentExtinguisher
          - RMCAttachmentFlamer # TODO RMC14 advanced flamer
          - RMCAttachmentU1GrenadeLauncher
          - RMCAttachmentU7UnderbarrelShotgun
          - RMCAttachmentLaserSight
          - RMCAttachmentM203GrenadeLauncher
        random:
        - RMCAttachmentAngledGrip
        - RMCAttachmentVerticalGrip
        - RMCAttachmentGyroscopicStabilizer
        - RMCAttachmentBurstFireAssembly
        - RMCAttachmentBipod
        - RMCAttachmentUnderbarrelExtinguisher
        - RMCAttachmentU7UnderbarrelShotgun
        - RMCAttachmentLaserSight
  - type: AttachableHolderVisuals
    offsets:
      rmc-aslot-barrel: 0.81, 0
      rmc-aslot-rail: -0.15, 0.12
      rmc-aslot-stock: -0.5, 0
      rmc-aslot-underbarrel: 0.28, -0.30

- type: entity
  parent: CMMagazineRifleBase
  id: RMCMagazineRifleM16
  name: "M16 Magazine (5.56x45mm)"
  components:
  - type: Tag
    tags:
    - CMMagazineRifle
    - RMCMagazineRifleM16
  - type: BallisticAmmoProvider
    mayTransfer: True
    whitelist:
      tags:
      - RMCCartridgeRifleM16
    proto: RMCCartridgeRifleM16
    capacity: 20
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/Ammunition/Magazines/m16.rsi
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]
  - type: Appearance
  - type: RefillableByBulletBox
    bulletType: CMUBoxBulletsRifle556x45MM
    
- type: entity
  parent: CMBaseCartridgeRifle
  id: RMCCartridgeRifleM16
  name: cartridge (5.56x45mm)
  description: "A 5.56x45mm cartridge for the M16 rifle."
  components:
  - type: Tag
    tags:
    - Cartridge
    - RMCCartridgeRifleM16
  - type: CartridgeAmmo
    proto: BulletRifle556x45mm

- type: entity
  parent: BulletRifle10x24mm
  id: BulletRifle556x45mm
  categories: [ HideSpawnMenu ]
  components:
  - type: Projectile
    damage:
      types:
        Piercing: 40
  - type: CMArmorPiercing
    amount: 5

- type: Tag
  id: RMCMagazineRifleM16

- type: Tag
  id: RMCCartridgeRifleM16
