# SPDX-FileCopyrightText: 2022 ElectroJr <leonsfriedrich@gmail.com>
# SPDX-FileCopyrightText: 2022 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 PixelTK <85175107+PixelTheKermit@users.noreply.github.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 <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2022 ninruB <38016303+asperger-sind@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Flareguy <78941145+Flareguy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 LankLTE <135308300+LankLTE@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Vordenburg <114301317+Vordenburg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@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 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: 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

- type: entity
  id: BaseSpeedLoaderMagnum
  name: "speed loader (.45 magnum)"
  parent: [ BaseItem, BaseSecurityContraband ]
  abstract: true
  components:
  - type: Tag
    tags:
      - SpeedLoaderMagnum
  - type: SpeedLoader
  - type: BallisticAmmoProvider
    whitelist:
      tags:
        - CartridgeMagnum
    capacity: 6
  - type: Sprite
  - type: ContainerContainer
    containers:
      ballistic-ammo: !type:Container
        ents: []

- type: entity
  id: SpeedLoaderMagnum
  name: "speed loader (.45 magnum)"
  parent: BaseSpeedLoaderMagnum
  description: Designed to quickly refill an empty revolver, it fits up to six rounds. Intended to hold general-purpose kinetic ammunition.
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeMagnum
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/SpeedLoaders/Magnum/magnum_speed_loader.rsi
    layers:
      - state: base
        map: [ "enum.GunVisualLayers.Base" ]
      - state: base-6
        map: [ "enum.GunVisualLayers.Mag" ]
  - type: MagazineVisuals
    magState: base
    steps: 7
    zeroVisible: false
  - type: Appearance
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      - state: inhand-left-ammo
      right:
      - state: inhand-right-mag
      - state: inhand-right-ammo

- type: entity
  id: SpeedLoaderMagnumEmpty
  name: "speed loader (.45 magnum any)"
  parent: SpeedLoaderMagnum
  description: Designed to quickly refill an empty revolver, it fits up to six rounds for the big iron on your hip. #Big Iron reference (duh)
  components:
  - type: BallisticAmmoProvider
    proto: null
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/SpeedLoaders/Magnum/magnum_speed_loader.rsi
    layers:
      - state: base
        map: [ "enum.GunVisualLayers.Base" ]
      # TODO: This is actually a issue with all the speed loaders:
      #       You can mix different ammo types, but it will always
      #       use the one it was printed for.
      - state: base-6
        map: [ "enum.GunVisualLayers.Mag" ]
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      right:
      - state: inhand-right-mag

- type: entity
  id: SpeedLoaderMagnumIncendiary
  name: "speed loader (.45 magnum incendiary)"
  parent: SpeedLoaderMagnum
  description: Designed to quickly refill an empty revolver, it fits up to six rounds. Intended to hold self-igniting incendiary ammunition.
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeMagnumIncendiary

- type: entity
  id: SpeedLoaderMagnumPractice
  name: "speed loader (.45 magnum practice)"
  parent: BaseSpeedLoaderMagnum
  description: Designed to quickly refill an empty revolver, it fits up to six rounds. Intended to hold non-harmful chalk ammunition, perfect for practicing your quick draw.
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeMagnumPractice
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/SpeedLoaders/Magnum/magnum_speed_loader.rsi
    layers:
      - state: base
        map: [ "enum.GunVisualLayers.Base" ]
      - state: practice-6
        map: [ "enum.GunVisualLayers.Mag" ]
  - type: MagazineVisuals
    magState: practice
    steps: 7
    zeroVisible: false
  - type: Appearance
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      - state: inhand-left-ammo
      - state: inhand-left-stripe
        color: "#ea5800"
      right:
      - state: inhand-right-mag
      - state: inhand-right-ammo
      - state: inhand-right-stripe
        color: "#ea5800"

- type: entity
  id: SpeedLoaderMagnumAP
  name: "speed loader (.45 magnum armor-piercing)"
  parent: BaseSpeedLoaderMagnum
  description: Designed to quickly refill an empty revolver, it fits up to six rounds. Intended to hold rare armor-piercing ammunition.
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeMagnumAP
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/SpeedLoaders/Magnum/magnum_speed_loader.rsi
    layers:
      - state: base
        map: [ "enum.GunVisualLayers.Base" ]
      - state: piercing-6
        map: [ "enum.GunVisualLayers.Mag" ]
  - type: MagazineVisuals
    magState: piercing
    steps: 7
    zeroVisible: false
  - type: Appearance
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      - state: inhand-left-ammo
      - state: inhand-left-stripe
        color: "#540000"
      right:
      - state: inhand-right-mag
      - state: inhand-right-ammo
      - state: inhand-right-stripe
        color: "#540000"

- type: entity
  id: SpeedLoaderMagnumUranium
  name: "speed loader (.45 magnum uranium)"
  parent: BaseSpeedLoaderMagnum
  description: Designed to quickly refill an empty revolver, it fits up to six rounds. Intended to hold exotic uranium-core ammunition.
  components:
  - type: BallisticAmmoProvider
    proto: CartridgeMagnumUranium
  - type: Sprite
    sprite: Objects/Weapons/Guns/Ammunition/SpeedLoaders/Magnum/magnum_speed_loader.rsi
    layers:
      - state: base
        map: [ "enum.GunVisualLayers.Base" ]
      - state: uranium-6
        map: [ "enum.GunVisualLayers.Mag" ]
  - type: MagazineVisuals
    magState: uranium
    steps: 7
    zeroVisible: false
  - type: Appearance
  - type: Item
    inhandVisuals:
      left:
      - state: inhand-left-mag
      - state: inhand-left-ammo
      - state: inhand-left-stripe
        color: "#00cd42"
      right:
      - state: inhand-right-mag
      - state: inhand-right-ammo
      - state: inhand-right-stripe
        color: "#00cd42"
