- type: entity
  abstract: true
  parent: [ CMBaseWeaponGun, BaseItem, RMCBaseAttachableHolder ]
  id: RMCSmartGunNoCamo
  name: M56B smart gun
  description: The actual firearm in the Smart Gun System. Essentially a heavy, mobile machinegun.
  components:
  - type: Wieldable
  - 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: GunRequiresWield
  - type: Corrodible
    isCorrodible: false
  - type: GunIFF
    enabled: true
  - type: WieldDelay
    baseDelay: 0.4
  - type: WieldableSpeedModifiers
    base: 0.5
    light: 0.69
    medium: 0.75
    heavy: 0.806
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a.rsi
    layers:
    - state: base
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a.rsi
    - state: mag-0
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a.rsi
      map: [ "enum.GunVisualLayers.Mag" ]
  - type: Clothing
    sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a.rsi
    slots:
    - suitStorage
    - Back
  - type: MeleeWeapon
    damage:
      types:
        Blunt: 20
  - type: Gun
    selectedMode: FullAuto
    availableModes:
    - FullAuto
    soundGunshot:
      collection: AU14SmartgunFireSound
    soundEmpty:
      path: /Audio/Weapons/Guns/Empty/lmg_empty.ogg
  - type: RMCSelectiveFire
    baseFireModes:
    - FullAuto
    recoilWielded: 3
    scatterWielded: 10
    baseFireRate: 8
    burstScatterMult: 4
    modifiers:
      FullAuto:
        maxScatterModifier: 4
        useBurstScatterMult: true
        unwieldedScatterMultiplier: 2
        shotsToMaxScatter: 80
  - type: RMCWeaponAccuracy
    accuracyMultiplier: 1.05
  - type: ContainerContainer
    containers:
      gun_magazine: !type:ContainerSlot
      gun_chamber: !type:ContainerSlot
      cell_slot: !type:ContainerSlot { }
  - type: PowerCellSlot
    cellSlotId: cell_slot
  - type: ItemSlots
    slots:
      gun_magazine:
        name: Magazine
        startingItem: RMCMagazineSmartGun
        insertSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_sg_reload.ogg
        ejectSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_sg_unload.ogg
        priority: 2
        whitelist:
          tags:
          - RMCMagazineSmartGun
      cell_slot:
        name: power-cell-slot-component-slot-name-default
        startingItem: RMCPowerCellSmartgun
        whitelist:
          components:
          - SmartGunBattery
  - type: GunDamageModifier
    multiplier: 0.6
  - type: GunToggleableAmmo
    settings:
    - damage:
        types:
          Piercing: 30
      armorPiercing: 0
      name: rmc-toggleable-ammo-highly-precise
      icon:
        sprite: _RMC14/Actions/marine_smart_gun_actions.rsi
        state: ammo_swap_normal
    - damage:
        types:
          Piercing: 20
      armorPiercing: 40
      name: rmc-toggleable-ammo-armor-shredding
      icon:
        sprite: _RMC14/Actions/marine_smart_gun_actions.rsi
        state: ammo_swap_ap
  - type: RMCMagneticItem
  - type: GunRequiresSkills
    skills:
      RMCSkillSmartGun: 1
  - type: GunSkilledRecoil
    skills:
      RMCSkillFirearms: 100
  - type: GunDrainBatteryOnShoot
  - type: GunRequireEquipped
    whitelist:
      components:
      - SmartGunArmor
  - type: GunToggleableRecoil
  - type: GunToggleableAutoFire
  - type: ToggleableMotionDetector
  - type: IFFToggle
  - type: MotionDetector
    handToggleable: false
    deactivateOnDrop: false
    toggleSound: null
  - type: SmartGun
  - type: AttachableHolder
    slots:
      rmc-aslot-rail:
        whitelist:
          tags:
          - RMCAttachmentRailFlashlight
  - type: AttachableHolderVisuals
    offsets:
      rmc-aslot-rail: -0.1875, 0.125
  - type: WieldedCrosshair
    rsi:
      sprite: _RMC14/Interface/MousePointer/smartgun_mouse.rsi
      state: all

- type: entity
  parent: RMCSmartGunNoCamo
  id: RMCSmartGun
  components:
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a.rsi
    layers:
    - state: base
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a.rsi
    - state: camo
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a.rsi
      map: [ "enum.ItemCamouflageLayers.Layer" ]
    - state: mag-0
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a.rsi
      map: [ "enum.GunVisualLayers.Mag" ]
  - type: ItemCamouflage
    colors:
      Jungle: "#ccd08d"
      Desert: "#ffd2a6"
      Snow: "#ddcbc9"
      Classic: "#c7e7d9"
      Urban: "#acb8c7"

- type: entity
  parent: RMCSmartGun
  id: RMCSmartGunPMC
  name: M56T smart gun
  description: The actual firearm in the 4-piece M56T Smartgun System. If you have this, you're about to bring some serious pain to anyone in your way. You may toggle firing restrictions by using a special action.
  components:
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml79a.rsi
    layers:
    - state: base
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml79a.rsi
    - state: mag-0
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml79a.rsi
      map: [ "enum.GunVisualLayers.Mag" ]
  - type: Clothing
    sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml79a.rsi
  - type: ItemSlots
    slots:
      gun_magazine:
        name: Magazine
        startingItem: RMCMagazineSmartGun
        insertSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_sg_reload.ogg
        ejectSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_sg_unload.ogg
        priority: 2
        whitelist:
          tags:
          - RMCMagazineSmartGun #For some reason when this is removed mags literally becomes unusable :confused:
          - RMCMagazineSmartGunirradiated
      cell_slot:
        name: power-cell-slot-component-slot-name-default
        startingItem: RMCPowerCellSmartgun
        whitelist:
          components:
          - SmartGunBattery
  - type: GunToggleableAmmo
    settings:
    - damage:
        types:
          Piercing: 40
      armorPiercing: 0
      name: rmc-toggleable-ammo-highly-precise
      icon:
        sprite: _RMC14/Actions/marine_smart_gun_actions.rsi
        state: ammo_swap_normal
    - damage:
        types:
          Piercing: 30
      armorPiercing: 35
      name: rmc-toggleable-ammo-armor-shredding
      icon:
        sprite: _RMC14/Actions/marine_smart_gun_actions.rsi
        state: ammo_swap_ap

- type: entity
  parent: RMCSmartGunPMC
  id: RMCSmartGunWhiteOut
  name: "ML79A 'Breaker' smart gun"
  description: The actual firearm in the 4-piece ML79A Smartgun System, modified for extra power. If you have this, you're about to bring some serious pain to anyone in your way. You may toggle firing restrictions by using a special action.
  suffix: Whiteout
  components:
  - type: RMCSelectiveFire
    recoilWielded: 3
    scatterWielded: 10
    baseFireRate: 15
    burstScatterMult: 1
    modifiers:
      FullAuto:
        maxScatterModifier: 0
        useBurstScatterMult: true
        unwieldedScatterMultiplier: 2
        shotsToMaxScatter: 250
  - type: GunToggleableAmmo
    settings:
    - damage:
        types:
          Piercing: 62
      armorPiercing: 20
      name: rmc-toggleable-ammo-highly-precise
      icon:
        sprite: _RMC14/Actions/marine_smart_gun_actions.rsi
        state: ammo_swap_normal
    - damage:
        types:
          Piercing: 53
      armorPiercing: 60
      name: rmc-toggleable-ammo-armor-shredding
      icon:
        sprite: _RMC14/Actions/marine_smart_gun_actions.rsi
        state: ammo_swap_ap

- type: entity
  parent: RMCSmartGunNoCamo
  id: RMCSmartGunCO
  name: M56C 'cavalier' smart gun
  description: The actual firearm in the Smart Gun System. Back order only. Besides a more robust weapons casing, an ID lock system and a fancy paintjob, the gun's performance is identical to the standard-issue M56B.
  components:
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/CO.rsi
    layers:
    - state: base
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/CO.rsi
    - state: mag-0
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/CO.rsi
      map: [ "enum.GunVisualLayers.Mag" ]
  - type: Clothing
    sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/CO.rsi
  - type: Gun
    soundGunshot:
      collection: AU14SmartgunFireSound
  - type: ItemSlots
    slots:
      gun_magazine:
        name: Magazine
        startingItem: RMCMagazineSmartGun
        insertSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_sg_reload.ogg
        ejectSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_sg_unload.ogg
        priority: 2
        whitelist:
          tags:
          - RMCMagazineSmartGun
      cell_slot:
        name: power-cell-slot-component-slot-name-default
        startingItem: RMCPowerCellSmartgun
        whitelist:
          components:
          - SmartGunBattery
  - type: GunIDLock

- type: entity
  parent: RMCSmartGun
  id: RMCSmartGunCLF
  name: M56B 'freedom' smart gun
  description: The actual firearm in the 4-piece M56B Smartgun System. Essentially a heavy, mobile machinegun. This one has the CLF logo carved over the manufacturing stamp.
  components:
  - type: GunRequireEquipped
    whitelist: { }

- type: entity
  parent: RMCSmartGunNoCamo
  id: RMCSmartGunRoyal
  name: L56 smart gun
  description: The actual firearm in the 2-piece L56 Smart Gun System. This smartgun is used by Three World Empires Imperial Space Armed Forces and Royal Marine Commando units. You may toggle firing restrictions by using a special action.
  components:
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a_royal.rsi
    layers:
    - state: base
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a_royal.rsi
    - state: mag-0
      sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a_royal.rsi
      map: [ "enum.GunVisualLayers.Mag" ]
  - type: Clothing
    sprite: _RMC14/Objects/Weapons/Guns/SmartGuns/ml66a_royal.rsi
  - type: ItemSlots
    slots:
      gun_magazine:
        name: Magazine
        startingItem: RMCMagazineSmartGunHT
        insertSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_sg_reload.ogg
        ejectSound: /Audio/_RMC14/Weapons/Guns/Reload/gun_sg_unload.ogg
        priority: 2
        whitelist:
          tags:
          - RMCMagazineSmartGun
          - RMCMagazineSmartGunHT
      cell_slot:
        name: power-cell-slot-component-slot-name-default
        startingItem: RMCPowerCellSmartgun
        whitelist:
          components:
          - SmartGunBattery

- type: entity
  parent: CMMagazineRifleBase
  id: RMCMagazineSmartGun
  name: "M56 drum magazine (10x30mm)"
  components:
  - type: Tag
    tags:
    - RMCMagazineSmartGun
  - type: BallisticAmmoProvider
    whitelist:
      tags:
      - CMCartridgeSmartGun10x30mm
    proto: CMCartridgeSmartGun10x30mm
    capacity: 500
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/Ammunition/Magazines/SmartGuns/magazine_smart_gun.rsi
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]
  - type: Clothing
    slots:
    - suitStorage
  - type: RefillableByBulletBox
    bulletType: RMCBoxBulletsSmartGun

- type: entity
  parent: RMCMagazineSmartGun
  id: RMCMagazineSmartGunirradiated
  name: "M56 drum magazine irradiated (10x30mm)"
  components:
  - type: BallisticAmmoProvider
    whitelist:
      tags:
      - RMCCartridgeSmartGun10x30mmirradiated
    proto: RMCCartridgeSmartGun10x30mmirradiated
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/Ammunition/Magazines/SmartGuns/magazine_smart_gun_deplated.rsi

- type: entity
  parent: RMCMagazineSmartGun
  id: RMCMagazineSmartGunHT
  name: "holotargeting smart gun drum (10x30mm)"
  components:
  - type: BallisticAmmoProvider
    whitelist:
      tags:
      - RMCCartridgeSmartGun10x30mmHT
    proto: RMCCartridgeSmartGun10x30mmHT

- type: entity
  parent: CMBaseCartridgeRifle
  id: CMCartridgeSmartGun10x30mm
  name: cartridge (10x30mm)
  components:
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/Casings/large_casing.rsi
    layers:
    - state: base
      map: ["enum.AmmoVisualLayers.Base"]
  - type: CartridgeAmmo
    proto: CMBulletSmartGun10x30mm
  - type: Tag
    tags:
    - CMCartridgeSmartGun10x30mm

- type: entity
  parent: CMCartridgeSmartGun10x30mm
  id: RMCCartridgeSmartGun10x30mmirradiated
  name: irradiated cartridge (10x30mm)
  components:
  - type: CartridgeAmmo
    proto: RMCBulletSmartGun10x30mmirradiated
  - type: Tag
    tags:
    - RMCCartridgeSmartGun10x30mmirradiated

- type: entity
  parent: CMCartridgeSmartGun10x30mm
  id: RMCCartridgeSmartGun10x30mmHT
  name: ht cartridge (10x30mm)
  components:
  - type: CartridgeAmmo
    proto: RMCBulletSmartGun10x30mmHT
  - type: Tag
    tags:
    - RMCCartridgeSmartGun10x30mmHT

- type: entity
  parent: CMBulletBase
  id: CMBulletSmartGun10x30mm
  name: bullet (10x30mm)
  categories: [ HideSpawnMenu ]
  components:
  - type: Sprite
    sprite: _RMC14/Objects/Weapons/Guns/Ammunition/Projectiles/bullet_projectiles.rsi
    drawdepth: OverMobs
    layers:
    - state: bullet
      shader: unshaded
  - type: Projectile
    damage:
      types:
        Piercing: 30
  - type: CMArmorPiercing
    amount: 0
  - type: RMCProjectileDamageFalloff
    thresholds:
    - range: 12
      falloff: 9999
      ignoreModifiers: true
    - range: 10
      falloff: 4
  - type: RMCProjectileAccuracy
    accuracy: 105
    thresholds:
    - range: 5
      falloff: 10

- type: entity
  parent: CMBulletSmartGun10x30mm
  id: RMCBulletSmartGun10x30mmirradiated
  name: irradiated bullet (10x30mm)
  categories: [ HideSpawnMenu ]
  components:
  - type: Projectile
    damage:
      types:
        Piercing: 40

- type: entity
  parent: CMBulletSmartGun10x30mm
  id: RMCBulletSmartGun10x30mmHT
  name: ht bullet (10x30mm)
  categories: [ HideSpawnMenu ]
  components:
  - type: Projectile
    damage:
      types:
        Piercing: 30
  - type: HoloTargeting
    stacks: 15

- type: Tag
  id: RMCMagazineSmartGun

- type: Tag
  id: RMCMagazineSmartGunirradiated

- type: Tag
  id: RMCMagazineSmartGunHT

- type: Tag
  id: CMCartridgeSmartGun10x30mm

- type: Tag
  id: RMCCartridgeSmartGun10x30mmirradiated

- type: Tag
  id: RMCCartridgeSmartGun10x30mmHT
