- type: entity
  parent: [ BaseStructure, StructureHealthDoor ]
  id: EnergyGate
  name: energy gate
  description: An advanced gate that permits one-way access and prevents tailgating.
  components:
  - type: Sprite
    sprite: Structures/Doors/Misc/energy-gate.rsi
    drawdepth: Doors
    layers:
    - state: security
    - state: idle-security
      shader: unshaded
      map: [ "barrier" ]
    - state: direction
      shader: unshaded
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.TurnstileVisualLayers.Base:
        barrier:
          Idle: { state: idle-security }
          Spin: { state: operate }
          Deny: { state: deny }
  - type: AnimationPlayer
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.49,-0.49,0.49,0.49" # same dimensions as a door for tall turnstile, prevents objects being thrown through
        density: 100
        mask:
        - FullTileMask
        layer:
        - GlassAirlockLayer
      fix2:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.50,-0.50,0.50,0.50" # same dimensions as a door for tall turnstile, prevents objects being thrown through
        hard: false
        mask:
        - FullTileMask
        layer:
        - GlassAirlockLayer
  - type: MeleeSound
    soundGroups:
      Brute:
        path:
          "/Audio/Weapons/smash.ogg"
  - type: InteractionOutline
  - type: Turnstile
    processWhitelist:
      components:
      - MobState # no mobs
      - Pullable # no dragging things in
  - type: Damageable
    damageModifierSet: SteelStaticMod
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
  - type: AccessReader
  - type: Construction
    graph: EnergyGate
    node: energyGate
  - type: DirectionalArrowIndicator
  - type: IconSmooth
    key: walls
    mode: NoSprite
  - type: PointLight
    energy: 2.2
    color: "#cc3a41"
    radius: 2.2
  - type: PlacementReplacement
    key: walls

# Genpop
- type: entity
  id: EnergyGateGenpopEnter
  parent: EnergyGate
  suffix: Genpop Enter
  components:
  - type: AccessReader
    access: [["GenpopEnter"], ["Security"]]

- type: entity
  id: EnergyGateGenpopLeave
  parent: EnergyGate
  suffix: Genpop Leave
  components:
  - type: AccessReader
    access: [["GenpopLeave"], ["Security"]]

# Airtight
- type: entity
  parent: EnergyGate
  id: EnergyGateAirtight
  name: airtight energy gate
  suffix: Airtight
  components:
  - type: Airtight
  - type: RadiationBlocker
    resistance: 4
  - type: Sprite
    layers:
    - state: regular
    - state: idle
      shader: unshaded
      map: [ "barrier" ]
    - state: direction
      shader: unshaded
  - type: GenericVisualizer
    visuals:
      enum.TurnstileVisualLayers.Base:
        barrier:
          Idle: { state: idle }
          Spin: { state: operate }
          Deny: { state: deny }
  - type: PointLight
    energy: 2.2
    color: "#50abff"
    radius: 2.2
