# SPDX-FileCopyrightText: 2020 Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 Víctor Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2020 ancientpower <ancientpowerer@gmail.com>
# SPDX-FileCopyrightText: 2020 ancientpower <evafleck@gmail.com>
# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 Acruid <shatter66@gmail.com>
# SPDX-FileCopyrightText: 2021 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Julian Giebel <j.giebel@netrocks.info>
# SPDX-FileCopyrightText: 2021 Julian Giebel <juliangiebel@live.de>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2021 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 SweptWasTaken <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2021 Visne <39844191+Visne@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 mirrorcult <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 ElectroJr <leonsfriedrich@gmail.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Moony <moonheart08@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Profane McBane <profanedbane+github@gmail.com>
# SPDX-FileCopyrightText: 2022 Rane <60792108+Elijahrane@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 TekuNut <13456422+TekuNut@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 TekuNut <3456422+TekuNut@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 keronshb <54602815+keronshb@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2022 metalgearsloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2023 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 Tom Leys <tom@crump-leys.com>
# SPDX-FileCopyrightText: 2023 chromiumboy <50505512+chromiumboy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 moonheart08 <moonheart08@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 LordCarve <27449516+LordCarve@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Sergey Dikiy <siarhei.dziki@gmail.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 plykiya <plykiya@protonmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Fishbait <Fishbait@git.ml>
# SPDX-FileCopyrightText: 2025 ScarKy0 <scarky0@onet.eu>
# SPDX-FileCopyrightText: 2025 fishbait <gnesse@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: AmeController
  name: AME controller
  description: It's a controller for the antimatter engine.
  placement:
    mode: SnapgridCenter
  components:
  - type: Clickable
  - type: InteractionOutline
  - type: Sprite
    snapCardinals: true
    sprite: Structures/Power/Generation/ame.rsi
    state: control
    layers:
    - state: control
    - state: control_on
      map: ["display"]
      visible: false
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        density: 190
        mask:
        - FullTileMask
        layer:
        - WallLayer
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: StructuralMetallicStrong
  - type: Destructible
    thresholds:
    - trigger: # Excess damage, don't spawn entities
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 1
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Transform
    anchored: true
    noRot: true
  - type: Anchorable
  - type: Pullable
  - type: AmeController
    fuelSlot:
      whitelist:
        components:
        - AmeFuelContainer
      whitelistFailPopup: ame-controller-component-fuel-slot-fail-whitelist
      lockedFailPopup: ame-controller-component-fuel-slot-fail-locked
      insertSuccessPopup: ame-controller-component-fuel-slot-success-insert
  - type: Explosive
    explosionType: Default
    intensitySlope: 5
    maxIntensity: 60
  - type: ActivatableUI
    key: enum.AmeControllerUiKey.Key
  - type: UserInterface
    interfaces:
      enum.AmeControllerUiKey.Key:
        type: AmeControllerBoundUserInterface
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.AmeControllerVisuals.DisplayState:
        display:
          Off: { visible: false }
          On: { state: control_on, visible: true }
          Warning: { state: control_warning, visible: true }
          Critical: { state: control_critical, visible: true }
          Fuck: { state: control_fuck, visible: true }
  - type: NodeContainer
    examinable: true
    nodes:
      ame:
        !type:AdjacentNode
        nodeGroupID: AMEngine
      input:
        !type:CableDeviceNode
        nodeGroupID: HVPower
  - type: PowerMonitoringDevice
    group: Generator
    loadNode: input
    sprite: Structures/Power/Generation/ame.rsi
    state: static
  - type: PowerSupplier
    supplyRate: 0
  - type: ItemSlots
  - type: ContainerContainer
    containers:
      fuelSlot: !type:ContainerSlot
  - type: GuideHelp
    guides:
    - AME
    - Power
  - type: Tag
    tags:
    - DroneUsable # Goobstation
  - type: Electrified
    onHandInteract: false
    onInteractUsing: false
    onBump: false
    requirePower: true
    highVoltageNode: input
    mediumVoltageNode: ame

- type: entity
  categories: [ HideSpawnMenu ]
  parent: AmeController
  id: AmeControllerUnanchored
  suffix: Unanchored
  components:
  - type: Transform
    anchored: false
  - type: Physics
    bodyType: Dynamic

- type: entity
  id: AmeShielding
  name: AME shielding
  description: Keeps the antimatter in and the matter out.
  placement:
    mode: SnapgridCenter
  components:
  - type: Clickable
  - type: InteractionOutline
  - type: Sprite
    drawdepth: Walls
    sprite: Structures/Power/Generation/ame.rsi
    state: shield_0
    layers:
    - state: shield_0
    - state: core
      map: ["core"]
      visible: false
    - state: core_weak
      map: ["core_glow"]
      shader: unshaded
      visible: false
  - type: Physics
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.5,-0.5,0.5,0.5"
        density: 190
        mask:
        - FullTileMask
        layer:
        - WallLayer
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: StructuralMetallicStrong
  - type: Destructible
    thresholds:
    - trigger: # Excess damage, don't spawn entities
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 1
            max: 2
      - !type:DoActsBehavior
        acts: ["Destruction"]
  - type: Transform
    anchored: true
  - type: IconSmooth
    mode: CardinalFlags
    base: shield_
    key: ame_shield
  - type: AmeShield
  - type: NodeContainer
    nodes:
      ame:
        !type:AdjacentNode
        nodeGroupID: AMEngine
  - type: PointLight
    enabled: false
    radius: 5
    energy: 0.5
    color: "#00AAFF"
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.AmeShieldVisuals.Core:
        core:
          True: { visible: true }
          False: { visible: false }
      enum.AmeShieldVisuals.CoreState:
        core_glow:
          Off: { visible: false }
          Weak: { state: core_weak, visible: true }
          Strong: { state: core_strong, visible: true }
  - type: Construction
    graph: AmeShielding
    node: ameShielding
  - type: GuideHelp
    guides:
    - AME
    - Power
  - type: Electrified
    onHandInteract: false
    onInteractUsing: false
    onBump: false
    requirePower: true
    highVoltageNode: ame