# SPDX-FileCopyrightText: 2022 Myctai <108953437+Myctai@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2023 crazybrain23 <44417085+crazybrain23@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 K-Dynamic <20566341+K-Dynamic@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Minemoder5000 <minemoder50000@gmail.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 wafehling <wafehling@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: BaseCargoPallet
  parent: BaseStructure
  name: cargo pallet
  description: Common fixture of logistics and cargo. Subtle reminder where crates go during transport to avoid bruised shins.
  abstract: true
  components:
  - type: InteractionOutline
  - type: Anchorable
    flags:
    - Anchorable
  - type: CollideOnAnchor
  - type: Physics
    canCollide: false
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        density: 15
        mask:
        - MachineMask
  - type: StaticPrice
    price: 100
  - type: Sprite
    drawdepth: FloorTiles
    layers:
    - sprite: Structures/catwalk.rsi
      state: catwalk_preview
  - type: GuideHelp
    guides:
    - Cargo

- type: entity
  id: CargoPallet
  parent: BaseCargoPallet
  components:
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 500
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          PartRodMetal: # takes two to construct, so drop less than that
            min: 0
            max: 1
      - !type:DoActsBehavior
        acts: [ "Destruction" ]

- type: entity
  id: CargoPalletSell
  name: cargo selling pallet
  description: Designates valid items to sell. Made of plastitanium to discourage pesky vandals.
  parent: BaseCargoPallet
  components:
  - type: CargoPallet
    palletType: sell
  - type: Sprite
    sprite: Structures/cargo_pallets.rsi
  - type: Icon
    sprite: Structures/cargo_pallets.rsi
    state: cargo_pallet_sell
  - type: IconSmooth
    key: cargo_pallet_sell
    base: cargo_pallet_sell_

- type: entity
  id: CargoPalletBuy
  name: cargo buying pallet
  description: Designates where orders will appear when purchased. Made of plastitanium to discourage pesky vandals.
  parent: BaseCargoPallet
  components:
  - type: CargoPallet
    palletType: buy
  - type: Sprite
    sprite: Structures/cargo_pallets.rsi
  - type: Icon
    sprite: Structures/cargo_pallets.rsi
    state: cargo_pallet_buy
  - type: IconSmooth
    key: cargo_pallet_buy
    base: cargo_pallet_buy_