# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 Acruid <shatter66@gmail.com>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2021 cyclowns <cyclowns@protonmail.ch>
# SPDX-FileCopyrightText: 2021 mirrorcult <notzombiedude@gmail.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@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: 2023 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2023 Naive817 <31364560+Naive817@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 c4llv07e <38111072+c4llv07e@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  parent: BaseStructure
  id: ContainmentFieldGenerator
  name: containment field generator
  description: A machine that generates a containment field when powered by an emitter. Keeps the Singularity docile.
  components:
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeCircle
          radius: 0.4
        density: 190
        mask:
        - FullTileMask
        layer:
        - WallLayer
  - type: InteractionOutline
  - type: Anchorable
  - type: Sprite
    sprite: Structures/Power/Generation/Singularity/containment.rsi
    state: icon
    noRot: true
    layers:
      - state: icon
      - state: p1
        map: ["powerLight"]
        visible: false
        shader: unshaded
      - state: a1
        map: ["fieldLight"]
        visible: false
        shader: unshaded
      - state: on
        map: ["connectedLight"]
        visible: false
        shader: unshaded
  - type: Icon
    sprite: Structures/Power/Generation/Singularity/containment.rsi
    state: icon
  - type: ContainmentFieldGenerator
  - type: PointLight
    enabled: false
    color: "#4080FF"
    radius: 32
    energy: 2.0
    softness: 32.0
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.ContainmentFieldGeneratorVisuals.PowerLight:
        powerLight:
          NoPower: {visible: false}
          LowPower: {visible: true, state: p1}
          MediumPower: {visible: true, state: p3}
          HighPower: {visible: true, state: p6}
      enum.ContainmentFieldGeneratorVisuals.FieldLight:
        fieldLight:
          NoLevel: {visible: false}
          On: {visible: true, state: a1}
          OneField: {visible: true, state: a2}
          MultipleFields: {visible: true, state: a3}
      enum.ContainmentFieldGeneratorVisuals.OnLight:
        connectedLight:
          True: { visible: true }
          False: { visible: false }
  - type: GuideHelp
    guides:
    - SingularityTeslaEngine
    - SingularityEngine
    - Power


- type: entity
  id: ContainmentField
  name: containment field
  description: A containment field that repels gravitational singularities.
  placement:
    mode: SnapgridCenter
  components:
  - type: InteractionOutline
  - type: Clickable
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.5,-0.5,0.5,0.5"
        mask:
        - FullTileMask
        layer:
        - GlassLayer
  - type: Sprite
    sprite: Structures/Power/Generation/Singularity/containment_field.rsi
    state: field
    noRot: true
  - type: Icon
    sprite: Structures/Power/Generation/Singularity/containment_field.rsi
    state: field
  - type: ContainmentField
    throwForce: 50
  - type: SyncSprite
  - type: GuideHelp
    guides:
    - SingularityTeslaEngine
    - SingularityEngine
    - Power