# SPDX-FileCopyrightText: 2022 ElectroJr <leonsfriedrich@gmail.com>
# SPDX-FileCopyrightText: 2022 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 T-Stalker <43253663+DogZeroX@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 T-Stalker <le0nel_1van@hotmail.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2023 Vordenburg <114301317+Vordenburg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Aviu00 <93730715+Aviu00@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Plykiya <plykiya@protonmail.com>
# SPDX-FileCopyrightText: 2024 Winkarst <74284083+Winkarst-cpu@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 username <113782077+whateverusername0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 whateverusername0 <whateveremail>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 BramvanZijp <56019239+BramvanZijp@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Ignaz "Ian" Kraft <ignaz.k@live.de>
# SPDX-FileCopyrightText: 2025 Killerqu00 <47712032+Killerqu00@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 SX-7 <92227810+SX-7@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Empty mags
- type: entity
  id: BaseMagazineLightRifle
  name: "magazine (.30 rifle)"
  parent: [ BaseItem, BaseSecurityContraband ]
  abstract: true
  components:
  - type: Tag
    tags:
      - MagazineLightRifle
  - type: BallisticAmmoProvider
    mayTransfer: true
    whitelist:
      tags:
        - CartridgeLightRifle
    proto: CartridgeLightRifle
    capacity: 30
  - type: Item
    size: Small
  - type: ContainerContainer
    containers:
      ballistic-ammo: !type:Container
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/Magazine/LightRifle/light_rifle_mag.rsi
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]
  - type: MagazineVisuals
    magState: mag
    steps: 2
    zeroVisible: false
  - type: Appearance

# Magazines
- type: entity
  id: MagazineLightRifleBox
  name: "L6 SAW magazine box (.30 rifle)"
  parent: BaseMagazineLightRifle
  description: Box containing a 100-round belt of linked .30 rifle rounds, used by light machine guns such as the L6. Intended to hold general-purpose kinetic ammunition.
  components:
  - type: Tag
    tags:
      - MagazineLightRifleBox
  - type: BallisticAmmoProvider
    proto: CartridgeLightRifle
    capacity: 100
  - type: Item
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/Magazine/LightRifle/light_rifle_box.rsi
  - type: MagazineVisuals
    magState: mag
    steps: 8
    zeroVisible: false
  - type: Appearance

- type: entity # Goobstation
  id: MagazineLightRifleBoxEmpty
  name: "L6 SAW magazine box (.30 rifle any)"
  parent: MagazineLightRifleBox
  components:
  - type: BallisticAmmoProvider
    proto: null

- type: entity
  id: MagazineLightRifle
  name: "magazine (.30 rifle)"
  parent: BaseMagazineLightRifle
  description: Curved 30-round double stack magazine for combat rifles. Intended to hold general-purpose kinetic ammunition.
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeLightRifle
  - type: Sprite
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      right:
      - state: inhand-right-mag

- type: entity
  id: MagazineLightRifleEmpty
  name: "magazine (.30 rifle any)"
  suffix: empty
  parent: MagazineLightRifle
  description: Curved 30-round double stack magazine for combat rifles.
  components:
  - type: BallisticAmmoProvider
    proto: null
  - type: Sprite
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      right:
      - state: inhand-right-mag

- type: entity
  id: MagazineLightRiflePractice
  name: "magazine (.30 rifle practice)"
  parent: BaseMagazineLightRifle
  description: Curved 30-round double stack magazine for combat rifles. Intended to hold non-harmful chalk ammunition.
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeLightRiflePractice
  - type: Sprite
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]
    - state: stripe
      color: "#dbdbdb"
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      - state: inhand-left-stripe
        color: "#dbdbdb"
      right:
      - state: inhand-right-mag
      - state: inhand-right-stripe
        color: "#dbdbdb"

- type: entity
  id: MagazineLightRifleUranium
  name: "magazine (.30 rifle uranium)"
  parent: BaseMagazineLightRifle
  description: Curved 30-round double stack magazine for combat rifles. Intended to hold exotic uranium-core ammunition.
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeLightRifleUranium
  - type: Sprite
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]
    - state: stripe
      color: "#00cd42"
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      - state: inhand-left-stripe
        color: "#00cd42"
      right:
      - state: inhand-right-mag
      - state: inhand-right-stripe
        color: "#00cd42"

- type: entity
  id: MagazineLightRifleIncendiary
  name: "magazine (.30 rifle incendiary)"
  parent: MagazineLightRifle
  description: Curved 30-round double stack magazine for combat rifles. Intended to hold self-igniting incendiary ammunition.
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeLightRifleIncendiary
  - type: Sprite
    layers:
    - state: base
      map: ["enum.GunVisualLayers.Base"]
    - state: mag-1
      map: ["enum.GunVisualLayers.Mag"]
    - state: stripe
      color: "#ff6e52"
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      - state: inhand-left-stripe
        color: "#ff6e52"
      right:
      - state: inhand-right-mag
      - state: inhand-right-stripe
        color: "#ff6e52"

- type: entity
  id: MagazineLightRifleMaxim
  name: "pan magazine (.30 rifle)"
  parent: BaseMagazineLightRifle
  components:
  - type: Tag
    tags:
      - MagazineLightRiflePan
  - type: BallisticAmmoProvider
    proto: CartridgeLightRifle
    capacity: 96
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/Magazine/LightRifle/maxim.rsi

- type: entity
  id: MagazineLightRiflePkBox
  name: "PK munitions box (.30 rifle)"
  parent: BaseMagazineLightRifle
  components:
  - type: Tag
    tags:
      - MagazineLightRifleBox
  - type: BallisticAmmoProvider
    proto: CartridgeLightRifle
    capacity: 80
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/Magazine/LightRifle/pk_box.rsi
  - type: MagazineVisuals
    magState: mag
    steps: 8
    zeroVisible: false
  - type: Appearance