- type: entity
  id: BaseThruster
  parent: BaseStructureDynamic
  name: thruster
  description: A thruster that allows a shuttle to move.
  abstract: true
  components:
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.45,-0.45,0.45,0.45"
          density: 60
          mask:
          - MachineMask
          layer:
          - MachineLayer
    - type: AmbientSound
      enabled: false
      range: 4
      volume: -4
      sound:
        path: /Audio/Effects/shuttle_thruster.ogg
    - type: Transform
      anchored: true
    - type: Physics
      bodyType: Static
    - type: Rotatable
      rotateWhileAnchored: false # Starlight
    - type: Thruster
      damage:
        types:
          Heat: 40
    - type: InteractionOutline
    - type: Sprite
    - type: Appearance
    - type: ThrusterVisuals
    - type: ApcPowerReceiver
      powerLoad: 1500
    - type: ExtensionCableReceiver
    - type: Damageable
      damageContainer: StructuralInorganic
      damageModifierSet: Electronic
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 300  # Changed 100->300 because impact damage is real
        behaviors:
          - !type:DoActsBehavior
            acts: ["Destruction"]
          - !type:PlaySoundBehavior
            sound:
              collection: MetalBreak
    - type: StaticPrice
      price: 300
    - type: GuideHelp
      guides:
      - ShuttleCraft
    - type: Anchorable # Starlight
      delay: 10
  placement:
    mode: SnapgridCenter

- type: entity
  id: Thruster
  name: thruster
  parent: [ BaseThruster, ConstructibleMachine ]
  components:
  - type: Machine
    board: ThrusterMachineCircuitboard
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 600
      behaviors:
        - !type:DoActsBehavior
          acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
        - !type:DoActsBehavior
          acts: ["Destruction"]
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:ChangeConstructionNodeBehavior
          node: machineFrame
  - type: Sprite
    sprite: Structures/Shuttles/thruster.rsi
    layers:
    - state: base
      map: ["enum.ThrusterVisualLayers.Base"]
    - state: thrust
      map: ["enum.ThrusterVisualLayers.ThrustOn"]
      shader: unshaded
      visible: false
    - state: thrust_burn_unshaded
      map: ["enum.ThrusterVisualLayers.ThrustingUnshaded"]
      shader: unshaded
      visible: false
      offset: 0, 1

- type: entity
  parent: Thruster
  id: ThrusterXenoborg
  name: xenoborg thruster # Starlight
  components:
  - type: Sprite
    sprite: Structures/Shuttles/xenoborg_thruster.rsi

- type: entity
  id: ThrusterLarge
  name: large thruster
  parent: [ BaseThruster]
  placement:
    mode: AlignTileAny
  components:
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 1800
      behaviors:
        - !type:DoActsBehavior
          acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 900
      behaviors:
        - !type:DoActsBehavior
          acts: ["Destruction"]
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-1.45,1.45,0.45"
        density: 1750
        mask:
        - MachineMask
        layer:
        - MachineLayer
  - type: ApcPowerReceiver
    powerLoad: 10000
  - type: Thruster
    thrust: 1600
    burnShape: ["-0.3,0.5","0.2,1.6","0.8,1.6","1.3,0.5"]
    damage:
      types:
        Heat: 120
  - type: Sprite
    sprite: Structures/Shuttles/thruster_large.rsi
    offset: 0.5,-0.5
    layers:
    - state: base
      map: ["enum.ThrusterVisualLayers.Base"]
    - state: thrust
      map: ["enum.ThrusterVisualLayers.ThrustOn"]
      shader: unshaded
      visible: false
    - state: thrust_burn_unshaded
      map: ["enum.ThrusterVisualLayers.ThrustingUnshaded"]
      shader: unshaded
      visible: false
      offset: 0, 2
  - type: Anchorable
    flags: None
  - type: StaticPrice
    price: 1500

- type: entity
  id: ThrusterUnanchored
  parent: Thruster
  suffix: Unanchored
  components:
    - type: Transform
      anchored: false
    - type: Physics
      bodyType: Dynamic

- type: entity
  id: DebugThruster
  parent: BaseThruster
  suffix: DEBUG
  components:
  - type: Thruster
    requireSpace: false
  - type: ApcPowerReceiver
    needsPower: false
    powerLoad: 0
  - type: Sprite
    sprite: Structures/Shuttles/thruster.rsi
    layers:
    - state: base
      map: ["enum.ThrusterVisualLayers.Base"]
    - state: thrust
      map: ["enum.ThrusterVisualLayers.ThrustOn"]
      shader: unshaded
      visible: false
    - state: thrust_burn_unshaded
      map: ["enum.ThrusterVisualLayers.ThrustingUnshaded"]
      shader: unshaded
      visible: false
      offset: 0, 1

- type: entity
  id: Gyroscope
  parent: [ BaseThruster, ConstructibleMachine ]
  name: gyroscope
  description: Increases the shuttle's potential angular rotation.
  components:
  - type: Thruster
    thrusterType: Angular
    requireSpace: false
    thrust: 2000
    machinePartThrust: Manipulator
  - type: Sprite
    # Listen I'm not the biggest fan of the sprite but it was the most appropriate thing I could find.
    sprite: Structures/Shuttles/gyroscope.rsi
    snapCardinals: true
    layers:
    - state: base
      map: ["enum.ThrusterVisualLayers.Base"]
    - state: thrust
      map: ["enum.ThrusterVisualLayers.ThrustOn"]
      shader: unshaded
      visible: false
    - state: thrust_burn
      map: [ "enum.ThrusterVisualLayers.Thrusting" ]
      visible: false
    - state: thrust_burn_unshaded
      map: ["enum.ThrusterVisualLayers.ThrustingUnshaded"]
      shader: unshaded
      visible: false
  - type: PointLight
    radius: 1.3
    energy: 0.8
    enabled: false
    mask: /Textures/Effects/LightMasks/cone.png
    autoRot: true
    offset: "0, 0.1" # shine from the top, not bottom of the computer
    color: "#4246b3"
  - type: Machine
    board: GyroscopeMachineCircuitboard
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
        - !type:DoActsBehavior
          acts: ["Destruction"]
    - trigger:
        !type:DamageTrigger
        damage: 100
      behaviors:
        - !type:DoActsBehavior
          acts: ["Destruction"]
        - !type:PlaySoundBehavior
          sound:
            collection: MetalBreak
        - !type:ChangeConstructionNodeBehavior
          node: machineFrame
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: Electronic
  - type: StaticPrice
    price: 2000

- type: entity
  id: GyroscopeUnanchored
  parent: Gyroscope
  suffix: Unanchored
  components:
    - type: Transform
      anchored: false
    - type: Physics
      bodyType: Dynamic

- type: entity
  id: DebugGyroscope
  parent: BaseThruster
  name: gyroscope # Starlight
  suffix: DEBUG
  components:
  - type: Thruster
    thrusterType: Angular
    requireSpace: false
    thrust: 100
  - type: ApcPowerReceiver
    needsPower: false
    powerLoad: 0
  - type: Sprite
    sprite: Structures/Shuttles/gyroscope.rsi
    snapCardinals: true
    layers:
    - state: base
      map: ["enum.ThrusterVisualLayers.Base"]
    - state: thrust
      map: ["enum.ThrusterVisualLayers.ThrustOn"]
      shader: unshaded
      visible: false
    - state: thrust_burn_unshaded
      map: ["enum.ThrusterVisualLayers.ThrustingUnshaded"]
      shader: unshaded
      visible: false

- type: entity
  id: RustedThruster
  parent: BaseStructureDynamic
  name: rusted thruster
  description: An unrepairable thruster, broken down from wear and tear. Only useful for scrapping.
  components:
    - type: Fixtures
      fixtures:
        fix1:
          shape:
            !type:PhysShapeAabb
            bounds: "-0.45,-0.45,0.45,0.45"
          density: 60
          mask:
          - MachineMask
          layer:
          - MachineLayer
    - type: Transform
      anchored: true
    - type: Physics
      bodyType: Static
    - type: Rotatable
      rotateWhileAnchored: true
    - type: Sprite
      sprite: Structures/Shuttles/old_thruster.rsi
      state: base
    - type: Damageable
      damageContainer: Inorganic
      damageModifierSet: Electronic
    - type: Destructible
      thresholds:
      - trigger:
          !type:DamageTrigger
          damage: 100  # Considering we need a lot of thrusters didn't want to make an individual one too tanky
        behaviors:
          - !type:DoActsBehavior
            acts: ["Destruction"]
          - !type:PlaySoundBehavior
            sound:
              collection: MetalBreak
    - type: PhysicalComposition
      materialComposition:
        Steel: 1200 # 12 sheets
