# SPDX-FileCopyrightText: 2022 Alex Evgrashin <aevgrashin@yandex.ru>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Rinkashikachi <15rinkashikachi15@gmail.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 chromiumboy <50505512+chromiumboy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 root <root@DESKTOP-HJPF29C>
# SPDX-FileCopyrightText: 2024 Aidenkrz <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 MilenVolf <63782763+MilenVolf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Verm <32827189+Vermidia@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Ignaz "Ian" Kraft <ignaz.k@live.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: CrateArtifactContainer
  parent: BaseStructureDynamic
  name: artifact container
  description: Used to safely contain and move artifacts.
  components:
    - type: Transform
      noRot: true
    - type: AccessReader
      access: [["Research"], ["Cargo"]]
    - type: Lock
    - type: ResistLocker
    - type: Sprite
      drawdepth: Objects
      sprite: Structures/Storage/Crates/artifact.rsi
      layers:
      - state: artifact_container
        map: ["enum.StorageVisualLayers.Base"]
      - state: artifact_container_door
        map: ["enum.StorageVisualLayers.Door"]
      - state: welded
        visible: false
        map: ["enum.WeldableLayers.BaseWelded"]
      - state: locked
        map: ["enum.LockVisualLayers.Lock"]
        shader: unshaded
      - state: paper
        map: ["enum.PaperLabelVisuals.Layer"]
    - type: InteractionOutline
    - type: Physics
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeCircle
            radius: 0.45
          density: 50
          mask:
          - CrateMask #this is so they can go under plastic flaps
          layer:
          - MachineLayer
    - type: Icon
      sprite: Structures/Storage/Crates/artifact.rsi
      state: artifact_container_icon
    - type: EntityStorage
      capacity: 1
      whitelist:
        components:
        - XenoArtifact
    - type: Weldable
    - type: SuppressArtifactContainer
    - type: RadiationBlockingContainer
      resistance: 5
    - type: PlaceableSurface
      isPlaceable: false
    - type: Damageable
      damageContainer: StructuralInorganic
      damageModifierSet: StructuralMetallicStrong
    - type: Destructible
      thresholds:
        - trigger:
            !type:DamageTrigger
            damage: 50
          behaviors:
            - !type:DoActsBehavior
              acts: ["Destruction"]
    - type: PaperLabel
      labelSlot:
        insertVerbText: comp-paper-label-insert
        ejectVerbText: comp-paper-label-eject
        whitelist:
          components:
            - Paper
        blacklist:
          tags:
          - Book
    - type: Appearance
    - type: EntityStorageVisuals
      stateDoorOpen: artifact_container_open
      stateDoorClosed: artifact_container_door
    - type: GenericVisualizer
      visuals:
        enum.PaperLabelVisuals.HasLabel:
          enum.PaperLabelVisuals.Layer:
            True: { visible: true }
            False: { visible: false }
        enum.PaperLabelVisuals.LabelType:
          enum.PaperLabelVisuals.Layer:
            Paper: { state: paper }
            Bounty: { state: bounty }
            CaptainsPaper: { state: captains_paper }
            Invoice: { state: invoice }
        enum.StorageVisuals.Open:
          enum.PaperLabelVisuals.Layer:
            True: { offset: "0.0,0.3125" }
            False: { offset: "0.0,0.0" }
    - type: LockVisuals
    - type: ItemSlots
    - type: ContainerContainer
      containers:
        entity_storage: !type:Container
        paper_label: !type:ContainerSlot
    - type: StaticPrice
      price: 250

- type: entity
  parent: BaseStorageItem
  id: HandheldArtifactContainer
  name: handheld artifact container
  description: A handheld case used to safely contain and move small artifacts.
  components:
  - type: Sprite
    sprite: Objects/Storage/artifact_container.rsi
    state: icon
    layers:
      - state: icon
        map: [ base ]
      - state: locked
        map: ["enum.LockVisualLayers.Lock"]
        shader: unshaded
  - type: Storage
    maxItemSize: Normal
    grid:
    - 0,0,1,1
    whitelist:
      components:
      - XenoArtifact
  - type: Item
    sprite: Objects/Storage/artifact_container.rsi
    size: Huge
  - type: MeleeWeapon
    damage:
      types:
        Blunt: 12
    soundHit:
      path: "/Audio/Weapons/smash.ogg"
  - type: Appearance
  - type: AccessReader
    access: [["Research"], ["Cargo"]]
  - type: Lock
  - type: SuppressArtifactContainer
  - type: RadiationBlockingContainer
    resistance: 5
  - type: EmitSoundOnLand
    sound:
      path: /Audio/Items/toolbox_drop.ogg
  - type: LockVisuals
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: StructuralMetallicStrong
  - type: Destructible
    thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 50
        behaviors:
          - !type:DoActsBehavior
            acts: ["Destruction"]
  - type: PaperLabel
    labelSlot:
      insertVerbText: Attach Label
      ejectVerbText: Remove Label
      whitelist:
        components:
          - Paper
      blacklist:
        tags:
        - Book
  - type: GenericVisualizer
    visuals:
      enum.StorageVisuals.Open:
        base:
          True: { state: icon-open }
          False: { state: icon }
      enum.PaperLabelVisuals.HasLabel:
        enum.PaperLabelVisuals.Layer:
          True: { visible: true }
          False: { visible: false }
      enum.PaperLabelVisuals.LabelType:
        enum.PaperLabelVisuals.Layer:
          Paper: { state: paper }
          Bounty: { state: bounty }
          CaptainsPaper: { state: captain }
          Invoice: { state: invoice }
  - type: ItemSlots
  - type: ContainerContainer
    containers:
      paper_label: !type:ContainerSlot
      storagebase: !type:Container
        ents: []
  - type: UseDelay
    delay: 0.3
  - type: StaticPrice
    price: 250
