- type: entity
  id: BaseFirelock
  abstract: true
  parent: BaseStructure
  name: firelock
  description: Apply crowbar.
  components:
    - type: Anchorable
      flags:
      - Anchorable
    - type: Rotatable
    - type: AtmosAlarmable
      syncWith:
        - FireAlarm
        - AirAlarm
    - type: ApcPowerReceiver
    - type: ExtensionCableReceiver
    - type: DeviceNetwork
      deviceNetId: AtmosDevices
      receiveFrequencyId: AtmosMonitor
    - type: DeviceNetworkRequiresPower
    - type: InteractionOutline
    - type: Damageable
      damageContainer: StructuralInorganic
      damageModifierSet: StructuralMetallicStrong
    - type: RCDDeconstructable
      cost: 4
      delay: 6
      fx: EffectRCDDeconstruct6
    - type: Tag
      tags:
      - ForceFixRotations # Allow fixrotations to target these
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 500
        behaviors:
        - !type:DoActsBehavior
          acts: ["Destruction"]
    - type: Sprite
      sprite: Structures/Doors/Airlocks/Standard/firelock.rsi
      snapCardinals: true
      layers:
        - state: closed
          map: ["enum.DoorVisualLayers.Base"]
        - state: closed_unlit
          shader: unshaded
          map: ["enum.DoorVisualLayers.BaseUnlit"]
          visible: false
        - state: welded
          map: ["enum.WeldableLayers.BaseWelded"]
        - state: bolted_unlit
          shader: unshaded
          map: ["enum.DoorVisualLayers.BaseBolted"]
          visible: false
        - state: panel_open
          map: ["enum.WiresVisualLayers.MaintenancePanel"]
        - state: pressure_unlit
          visible: false
          shader: unshaded
          map: ["enum.FirelockVisualLayersPressure.Base"]
        - state: temperature_unlit
          visible: false
          shader: unshaded
          map: ["enum.FirelockVisualLayersTemperature.Base"]
    - type: GenericVisualizer
      visuals:
        enum.FirelockVisuals.PressureWarning:
          enum.FirelockVisualLayersPressure.Base:
            True: { visible: true }
            False: { visible: false }
        enum.FirelockVisuals.TemperatureWarning:
          enum.FirelockVisualLayersTemperature.Base:
            True: { visible: true }
            False: { visible: false }
    - type: AnimationPlayer
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.49,-0.49,0.49,0.49"  # don't want this colliding with walls or they won't close
          density: 100
          mask:
          - FullTileMask
          layer:
          - AirlockLayer
    - type: Door
      openDrawDepth: WallTops
      closeTimeOne: 0.1
      closeTimeTwo: 0.6
      openTimeOne: 0.1
      openTimeTwo: 0.6
      state: Open
      bumpOpen: false
      clickOpen: true
      crushDamage:
        types:
          Blunt: 15
      openSound:
        path: /Audio/Machines/airlock_open.ogg
      closeSound:
        path: /Audio/Machines/airlock_close.ogg
      denySound:
        path: /Audio/Machines/airlock_deny.ogg
      openingAnimationTime: 0.6
      closingAnimationTime: 0.6
    - type: Weldable
      fuel: 5
      time: 3
    - type: Firelock
    - type: Appearance
    - type: WiresVisuals
    - type: WiresPanel
    - type: UserInterface
      interfaces:
        enum.WiresUiKey.Key:
          type: WiresBoundUserInterface
    - type: Physics
      canCollide: false
    - type: Airtight
      airBlocked: false
      noAirWhenFullyAirBlocked: true
    - type: RadiationBlocker
      enabled: false
    - type: Occluder
      enabled: false
    - type: WallMount
      arc: 360
    - type: StaticPrice
      price: 150
    - type: AccessReader
      access: [ [ "Engineering" ] ]
      examinationText: access-reader-examination-functionality-restricted
    - type: PryUnpowered
      pryModifier: 0.5
    - type: PointLight
      energy: 0.5
      radius: 1.75
      color: Red
      enabled: false
      castShadows: false
    - type: NavMapDoor
    - type: GuideHelp
      guides:
      - FireAndGasControl
      - Fires
      - Spacing
    - type: SyncSprite

- type: entity
  id: Firelock
  parent: BaseFirelock
  components:
  - type: StationAiWhitelist
  - type: ContainerContainer
    containers:
      board: !type:Container
  - type: Construction
    graph: Firelock
    node: Firelock
    containers:
    - board
  - type: ContainerFill
    containers:
      board: [ FirelockElectronics ]

- type: entity
  id: FirelockGlass
  parent: Firelock
  name: glass firelock
  components:
    - type: StationAiWhitelist
    - type: Sprite
      sprite: Structures/Doors/Airlocks/Glass/firelock.rsi
    - type: Occluder
      enabled: false
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.49,-0.49,0.49,0.49"  # don't want this colliding with walls or they won't close
          mask:
          - Impassable
          - HighImpassable
          layer:
          - GlassAirlockLayer
    - type: Door
      occludes: false
    - type: Construction
      node: FirelockGlass

- type: entity
  id: FirelockEdge
  parent: Firelock
  name: firelock
  components:
    - type: StationAiWhitelist
    - type: Sprite
      sprite: Structures/Doors/edge_door_hazard.rsi
      snapCardinals: false
    - type: Airtight
      airBlocked: false
      noAirWhenFullyAirBlocked: false
      airBlockedDirection:
        - South
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.49,-0.49,0.49,-0.2" # don't want this colliding with walls or they won't close
          mask:
          - Impassable
          - HighImpassable
          layer:
          - GlassAirlockLayer
    - type: Occluder
      enabled: false
    - type: Tag
      tags:
      - ForceNoFixRotations # Prevent fixrotations from targeting these, since the base Firelock is targeted
    - type: Door
      occludes: false
    - type: Physics
      canCollide: false
    - type: StaticPrice
      price: 100
    - type: Construction
      graph: Firelock
      node: FirelockEdge
