# SPDX-FileCopyrightText: 2021 Alex Evgrashin <aevgrashin@yandex.ru>
# SPDX-FileCopyrightText: 2021 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2021 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Visne <39844191+Visne@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Interrobang01 <113810873+Interrobang01@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 MilenVolf <63782763+MilenVolf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  name: deployable barrier
  id: DeployableBarrier
  description: A deployable barrier. Swipe your ID card to lock/unlock it.
  parent: BaseStructure
  components:
  - type: Transform
    anchored: false
    noRot: true
  - type: Sprite
    sprite: Objects/Specific/Security/barrier.rsi
    layers:
    - state: idle
    - state: locked
      map: ["enum.LockVisualLayers.Lock"]
  - type: Appearance
  - type: LockVisuals
  - type: InteractionOutline
  - type: Physics
    bodyType: Dynamic
    canCollide: false
  - type: Fixtures
    fixtures:
      base:
        shape:
          !type:PhysShapeCircle
          radius: 0.45
        density: 75
        mask:
        - MachineMask
      barrier:
        shape:
          !type:PhysShapeCircle
          radius: 0.45
        layer:
        - WallLayer
  - type: DeployableBarrier
    fixture: barrier
  - type: AccessReader
    access: [["Security"]]
  - type: Lock
    locked: false
    lockOnClick: true # toggle lock just by clicking on barrier
    lockTime: 5
    unlockTime: 5
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Metallic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 600
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel:
            min: 5
            max: 5
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: PointLight
    enabled: false
    radius: 3
    color: red
  - type: StaticPrice
    price: 200