- type: entity
  parent: [BaseMachinePowered, ConstructibleMachine] # Monolith
  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: Transform
    noRot: false # Mono
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeCircle
          radius: 0.4
        density: 190
        mask:
        - FullTileMask
        layer:
        - WallLayer
  # Monolith - durable
  - type: Damageable
    damageModifierSet: StructuralMetallicHeatReinforced
  # Monolith - as durable as a normal wall
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 1600
      behaviors:
        - !type:DoActsBehavior
          acts: [ "Destruction" ]
    - trigger:
        !type:DamageTrigger
        damage: 800
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
  - type: InteractionOutline
  - type: Anchorable
  - type: Sprite
    sprite: Structures/Power/Generation/Singularity/containment.rsi
    state: icon
    noRot: false # Mono
    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: Machine # Mono
    board: ContainmentFieldGeneratorCircuitboard
  - 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
  - type: Icon
    sprite: Structures/Power/Generation/Singularity/containment_field.rsi
    state: field
  - type: ContainmentField
    throwForce: 50
  - type: SyncSprite
  - type: GuideHelp
    guides:
    - SingularityTeslaEngine
    - SingularityEngine
    - Power
