# region LMGs
- type: entity
  parent: BaseWeaponLightMachineGun
  id: WeaponLightMachineGunPirateCannon
  description: Kaboom!
  components:
    - type: Sprite
      sprite: _Sunrise/Objects/Weapons/Guns/LMGs/piratecannon.rsi
      layers:
      - state: base
        map: ["enum.GunVisualLayers.Base"]
      - state: mag-3
        map: ["enum.GunVisualLayers.Mag"]
        type: ContainerContainer
    - type: Clothing
      sprite: _Sunrise/Objects/Weapons/Guns/LMGs/piratecannon.rsi
    - type: Item
      size: Huge
      shape:
      - 0,0,4,3
      sprite: _Sunrise/Objects/Weapons/Guns/LMGs/piratecannon_inhands_64x.rsi
      storedSprite:
        state: storage
        sprite: _Sunrise/Objects/Weapons/Guns/LMGs/piratecannon_storage_64x.rsi
    - type: Gun
      fireRate: 6.5
      soundGunshot:
        path: /Audio/Weapons/Guns/Gunshots/mateba.ogg
        params:
          volume: -1
          pitch: 1.2
      projectileSpeed: 20
      bigTrigger: true
      selectedMode: FullAuto
      availableModes:
        - FullAuto
    - type: GunRequiresWield
    - type: ChamberMagazineAmmoProvider
      soundRack:
        path: /Audio/Weapons/Guns/Gunshots/grenade_launcher.ogg
        params:
          volume: -10
          pitch: 0.8
      soundAutoEject:
        path: /Audio/Weapons/Guns/MagOut/lmg_magout.ogg
      autoEject: true
    - type: ItemSlots
      slots:
        gun_magazine:
          name: Magazine
          startingItem: MagazineCannonBallMini
          insertSound: /Audio/_Sunrise/Weapons/Guns/LMGs/reload.ogg
          ejectSound: /Audio/_Sunrise/Weapons/Guns/LMGs/unload.ogg
          priority: 2
          whitelist:
            tags:
            - MagazineCannonBallMini
        gun_chamber:
          name: Chamber
          startingItem: CannonBallMini
          priority: 1
          whitelist:
            tags:
            - CannonBallMini
    - type: SpeedModifiedOnWield
      walkModifier: 0.75
      sprintModifier: 0.75
    - type: Appearance
    - type: MagazineVisuals
      magState: mag
      steps: 6
      zeroVisible: true
    - type: StaticPrice
      price: 4000
    - type: KnockbackByUserTag
      doestContain:
        Resomi:
          knockback: 2
          staminaMultiplier: 15
        Felinid:
          knockback: 1 #half of what resomi take
          staminaMultiplier: 15

- type: entity
  id: WeaponMachineGunLCG
  name: light chain gun
  parent: BaseWeaponLightMachineGun
  description: Light machine gun with a high rate of fire and low recoil. Effective for firing on the move and suppressing advancing squads. The high rate of fire and heat reduce accuracy, and prolonged firing increases the chance of jamming.
  components:
  - type: Sprite
    sprite: _Sunrise/Objects/Weapons/Guns/LMGs/light_chaingun/big.rsi
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-0
      map: ["enum.GunVisualLayers.Mag"]
  - type: Clothing
    sprite: _Sunrise/Objects/Weapons/Guns/LMGs/light_chaingun/tiny.rsi
  - type: Item
    size: Ginormous
    sprite: _Sunrise/Objects/Weapons/Guns/LMGs/light_chaingun/tiny.rsi
  - type: GunWieldBonus
    minAngle: 0
    maxAngle: 0
  - type: Gun
    minAngle: 1
    maxAngle: 45
    angleIncrease: 1
    angleDecay: 25
    fireRate: 15
    soundGunshot:
      collection: L6
      params:
        volume: -6
        pitch: 1.03
  - type: ItemSlots
    slots:
      gun_magazine:
        name: Magazine
        startingItem: MagazineChainGunImprovised
        insertSound: /Audio/_Sunrise/Weapons/Guns/LMGs/reload.ogg
        ejectSound: /Audio/_Sunrise/Weapons/Guns/LMGs/unload.ogg
        priority: 2
        whitelist:
          tags:
          - MagazineChainGun
      gun_chamber:
        name: Chamber
        startingItem: null
        priority: 1
        whitelist:
          tags:
          - CartridgeHeavyRifle
  - type: ContainerContainer
    containers:
      gun_magazine: !type:ContainerSlot
      gun_chamber: !type:ContainerSlot
  - type: MagazineVisuals
    magState: mag
    steps: 6
    zeroVisible: true
  - type: Appearance
  - type: Wieldable
  - type: UseDelay
    delay: 0.75
  - type: GunRequiresWield
  - type: ChamberMagazineAmmoProvider
    boltClosed: null
    soundRack:
      path: /Audio/_Sunrise/Weapons/Guns/LMGs/cocked.ogg
  - type: SpeedModifiedOnWield
    walkModifier: 1
    sprintModifier: 0.95
  - type: HeldSpeedModifier
  - type: CursorOffsetRequiresWield
  - type: EyeCursorOffset
    maxOffset: 3
    pvsIncrease: 0.3
  - type: WeaponDismantleOnShoot
    dismantleChance: 0.002 # 50% chance per 300 shots
    dismantleDistance: 1
    items:
      - id: WeaponMachineGunLCGEmpty
        launchAngle: 0
        prob: 1
      - id: MagazineChainGunRandomSpawner
        launchAngle: 90
        prob: 1
      - id: MagazineChainGunLooseAmmoSpawner
        launchAngle: -90
        prob: 1

- type: entity
  id: WeaponMachineGunLCGEmpty
  name: light chain gun
  parent: WeaponMachineGunLCG
  suffix: Empty
  categories: [HideSpawnMenu]
  components:
    - type: ItemSlots
      slots:
        gun_magazine:
          name: Magazine
          startingItem: null
          insertSound: /Audio/_Sunrise/Weapons/Guns/LMGs/reload.ogg
          ejectSound: /Audio/_Sunrise/Weapons/Guns/LMGs/unload.ogg
          priority: 2
          whitelist:
            tags:
            - MagazineChainGun
        gun_chamber:
          name: Chamber
          startingItem: null
          priority: 1
          whitelist:
            tags:
            - CartridgeHeavyRifle

# region Magazines
- type: entity
  id: MagazineCannonBallMini
  name: cannonball suitcase
  description: A suitcase for neatly storing cannonballs for the pirate’s belt-fed cannon.
  parent: BaseItem
  components:
  - type: Tag
    tags:
    - MagazineCannonBallMini
  - type: BallisticAmmoProvider
    mayTransfer: false
    proto: CannonBallMini
    whitelist:
      tags:
      - CannonBallMini
    capacity: 50
  - type: Item
    size: Normal
    shape:
    - 0,0,2,1
  - type: ContainerContainer
    containers:
      ballistic-ammo: !type:Container
  - type: Sprite
    sprite: _Sunrise/Objects/Weapons/Guns/Ammunition/Magazines/cannonball_belt.rsi
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-5
      map: ["enum.GunVisualLayers.Mag"]
  - type: MagazineVisuals
    magState: mag
    steps: 6
    zeroVisible: false
  - type: Appearance

- type: entity
  id: MagazineCannonBallGrapeshotMini
  name: grapeshot suitcase
  parent: MagazineCannonBallMini
  suffix: Admeme
  components:
  - type: BallisticAmmoProvider
    mayTransfer: false
    proto: CannonBallGrapeshotMini
    whitelist:
      tags:
      - CannonBallMini
    capacity: 50

- type: entity
  id: MagazineChainGun
  name: chaingun ammo drum
  description: Heavy ammo drum for belt-fed chaingun.
  parent: BaseItem
  components:
  - type: Tag
    tags:
    - MagazineChainGun
  - type: BallisticAmmoProvider
    mayTransfer: false
    proto: CartridgeMinigun
    whitelist:
      tags:
      - CartridgeMinigun
      - CartridgeRifleImprovised
    capacity: 300
  - type: Item
    size: Normal
    shape:
    - 0,0,1,1
  - type: ContainerContainer
    containers:
      ballistic-ammo: !type:Container
  - type: Sprite
    sprite: _Sunrise/Objects/Weapons/Guns/Ammunition/Magazines/chaingundrum.rsi
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-5
      map: ["enum.GunVisualLayers.Mag"]
  - type: MagazineVisuals
    magState: mag
    steps: 6
    zeroVisible: false
  - type: Appearance

- type: entity
  id: MagazineChainGun250
  name: chaingun ammo drum
  parent: MagazineChainGun
  suffix: 250
  components:
  - type: BallisticAmmoProvider
    capacity: 250

- type: entity
  id: MagazineChainGun200
  name: chaingun ammo drum
  parent: MagazineChainGun
  suffix: 200
  components:
  - type: BallisticAmmoProvider
    capacity: 200

- type: entity
  id: MagazineChainGun100
  name: chaingun ammo drum
  parent: MagazineChainGun
  suffix: 100
  components:
  - type: BallisticAmmoProvider
    capacity: 100

- type: entity
  id: MagazineChainGunImprovised
  name: chaingun ammo drum (5.56mm improvised)
  parent: MagazineChainGun
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeRifleImprovised
  - type: Sprite
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
      color: "#9e9292"
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]

- type: entity
  id: MagazineChainGunRandomSpawner
  name: random chaingun ammo drum
  categories: [HideSpawnMenu]
  components:
  - type: EntityTableSpawner
    table: !type:GroupSelector
      children:
      - id: MagazineChainGun
        weight: 1
      - id: MagazineChainGun250
        weight: 2
      - id: MagazineChainGun200
        weight: 3
      - id: MagazineChainGun100
        weight: 4

- type: entity
  id: MagazineChainGunLooseAmmoSpawner
  name: random chaingun loose ammo
  categories: [HideSpawnMenu]
  components:
  - type: EntityTableSpawner
    table: !type:EntSelector
      id: CartridgeMinigun
      amount: !type:RangeNumberSelector
        range: 3, 10
# endregion
# endregion

# region Revolvers
- type: entity
  parent:
  - WeaponRevolverPirate
  - PowerCellSlotSmallItem
  id: SunriseWeaponRevolverPirateJammer
  name: pirate jammer revolver
  description: A battered revolver with an improvised radio jammer built into the grip. It blocks nearby radio traffic while active, but leaves the Freelance channel untouched.
  components:
  - type: Sprite
    sprite: _Sunrise/Objects/Weapons/Guns/Revolvers/pirate_revolver.rsi
    layers:
    - state: icon
    - state: jammer_high_charge
      map: ["enum.PowerDeviceVisualLayers.Powered"]
      shader: unshaded
      visible: false
  - type: Clothing
    sprite: _Sunrise/Objects/Weapons/Guns/Revolvers/pirate_revolver.rsi
  - type: RadioJammer
    frequenciesExcluded:
    - 1984
    settings:
    - wattage: 5
      range: 6
      message: radio-jammer-component-set-message-low
      name: radio-jammer-component-setting-low
    - wattage: 15
      range: 12
      message: radio-jammer-component-set-message-high
      name: radio-jammer-component-setting-high
  - type: ItemToggle
    onUse: false
  - type: ContainerContainer
    containers:
      revolver-ammo: !type:Container
        showEnts: false
        occludes: true
        ents: []
      cell_slot: !type:ContainerSlot
        showEnts: false
        occludes: true
        ent: null
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.BatteryVisuals.State:
        enum.PowerDeviceVisualLayers.Powered:
          Full: { state: jammer_high_charge }
          Neither: { state: jammer_medium_charge }
          Empty: { state: jammer_low_charge }
      enum.ToggleableVisuals.Enabled:
        enum.PowerDeviceVisualLayers.Powered:
          True: { visible: true }
          False: { visible: false }
  - type: ToggleCellDraw
  - type: BatteryVisuals
  - type: ItemSlots
    slots:
      cell_slot:
        name: power-cell-slot-component-slot-name-default
        startingItem: PowerCellSmallNuclear
        disableEject: true
        whitelist:
          tags:
          - PowerCell
        swap: false
# endregion

# region Rifles
- type: entity
  id: SunriseWeaponRifleRomulan
  parent: [BaseWeaponRifle, BaseMajorContraband]
  name: Romulan
  description: Yarrr, a retrofitted lecter befitting of a pirate! Make lotta dakka dakka. Uses .20 rifle ammo.
  components:
  - type: Sprite
    sprite: _Sunrise/Objects/Weapons/Guns/Rifles/romulan.rsi
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-0
      map: ["enum.GunVisualLayers.Mag"]
  - type: Clothing
    sprite: _Sunrise/Objects/Weapons/Guns/Rifles/romulan.rsi
  - type: Gun
    minAngle: 3.3
    maxAngle: 66
    angleIncrease: 3.3
    fireRate: 6.6
  - type: ItemSlots
    slots:
      gun_magazine:
        name: Magazine
        startingItem: MagazineRifleImprovised
        insertSound: /Audio/Weapons/Guns/MagIn/ltrifle_magin.ogg
        ejectSound: /Audio/Weapons/Guns/MagOut/ltrifle_magout.ogg
        priority: 2
        whitelist:
          tags:
          - MagazineRifle
        whitelistFailPopup: gun-magazine-whitelist-fail
      gun_chamber:
        name: Chamber
        startingItem: CartridgeRifleSP
        priority: 1
        whitelist:
          tags:
          - CartridgeRifle
  - type: ContainerContainer
    containers:
      gun_magazine: !type:ContainerSlot
      gun_chamber: !type:ContainerSlot
  - type: MagazineVisuals
    magState: mag
    steps: 3
    zeroVisible: true
  - type: Appearance
  - type: CanDualWield
    dualWieldInaccuracyPenalty: 1
    dualWieldFireRatePenalty: 0.06
    dualWieldRecoilPenalty: 0.6
# endregion

# region Snipers
- type: entity
  id: WeaponPistolFlintlockPirateMarker
  parent: [BaseItem, BaseMajorContraband]
  name: marker flintlock pistol
  description: A self-loading flintlock pistol that marks targets for pirate raiders.
  components:
  - type: Sprite
    sprite: Objects/Weapons/Guns/Snipers/flintlock.rsi
    layers:
    - state: base
  - type: Clothing
    sprite: Objects/Weapons/Guns/Snipers/flintlock.rsi
    quickEquip: false
    slots:
    - Back
    - suitStorage
  - type: Item
    size: Small
    shape:
    - 0,0,1,0
    - 0,1,0,1
  - type: Gun
    minAngle: 0
    maxAngle: 18
    fireRate: 0.75
    selectedMode: SemiAuto
    availableModes:
    - SemiAuto
    soundGunshot:
      path: /Audio/Weapons/Guns/Gunshots/sniper.ogg
  - type: UseDelayOnShoot
  - type: UseDelay
    delay: 5
  - type: BatteryAmmoProvider
    proto: SunrisePirateMarkerShot10
    fireCost: 100
  - type: BatteryWeaponFireModes
    fireModes:
    - proto: SunrisePirateMarkerShot10
    - proto: SunrisePirateMarkerShot30
    - proto: SunrisePirateMarkerShot60
  - type: Battery
    maxCharge: 100
    startingCharge: 100
  - type: BatterySelfRecharger
    autoRechargeRate: 20
  - type: StaticPrice
    price: 0
  - type: EmitSoundOnPickup
    sound:
      collection: SnipersPickUp
  - type: EmitSoundOnDrop
    sound:
      collection: SnipersDrop
  - type: EmitSoundOnLand
    sound:
      collection: SnipersDrop
# endregion
