- type: entity
  id: Incorporeal
  save: false
  abstract: true
  description: Mobs without physical bodies
  components:
  - type: Sprite
    noRot: true
    overrideContainerOcclusion: true # Always show up regardless of where they're contained.
    drawdepth: Ghosts
  - type: FTLSmashImmune
  - type: CargoSellBlacklist
  - type: MovementSpeedModifier
    baseSprintSpeed: 12
    baseWalkSpeed: 8
  - type: MovementIgnoreGravity
  - type: Physics
    bodyType: KinematicController
    bodyStatus: InAir
  - type: CanMoveInAir
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeCircle
          radius: 0.35
        density: 15
        layer:
        - GhostImpassable

# shared parent between aghosts, replay spectators and normal observers
- type: entity
  parent:
  - Incorporeal
  - BaseMob
  id: MobObserverBase
  abstract: true
  name: observer
  description: Boo!
  categories: [ HideSpawnMenu ]
  components:
  - type: Sprite
    sprite: Mobs/Ghosts/ghost_human.rsi
    color: "#fff8"
    layers:
    - state: animated
      map: [ "ghostVariant" ]
      shader: unshaded
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.GhostVisuals.Damage:
        ghostVariant:
          ghost_Blunt0: { state: ghost_Blunt0 } # this is an icki way of doing this u.u -Thinbug
          ghost_Blunt1: { state: ghost_Blunt1 }
          ghost_Blunt2: { state: ghost_Blunt2 }
          ghost_Slash0: { state: ghost_Slash0 }
          ghost_Slash1: { state: ghost_Slash1 }
          ghost_Slash2: { state: ghost_Slash2 }
          ghost_Piercing0: { state: ghost_Piercing0 }
          ghost_Piercing1: { state: ghost_Piercing1 }
          ghost_Piercing2: { state: ghost_Piercing2 }
          ghost_Heat0: { state: ghost_Heat0 }
          ghost_Cold0: { state: ghost_Cold0 }
          ghost_Shock0: { state: ghost_Shock0 }
          ghost_Radiation0: { state: ghost_Radiation0 }
          ghost_Cellular0: { state: ghost_Cellular0 }
          ghost_Poison0: { state: ghost_Poison0 }
          ghost_Asphyxiation0: { state: ghost_Asphyxiation0 }
          ghost_Explosion0: { state: ghost_Explosion0 }
          ghost_Explosion1: { state: ghost_Explosion1 }
          ghost_Explosion2: { state: ghost_Explosion2 }
  - type: ContentEye
    maxZoom: 1.44,1.44
  - type: Eye
    drawFov: false
  - type: Input
    context: "ghost"
  - type: Examiner
    skipChecks: true
  - type: Ghost
  - type: GhostSpriteState
    damageMap:
      Blunt: 3
      Slash: 3
      Piercing: 3
      Heat: 1
      Cold: 1
      Shock: 1
      Radiation: 1
      Cellular: 1
      Poison: 1
      Asphyxiation: 1
    prefix: "ghost_"
  - type: GhostHearing
  - type: ShowElectrocutionHUD
  - type: IntrinsicRadioReceiver
  - type: ActiveRadio
    receiveAllChannels: true
    globalReceive: true
  - type: NightVision
    netsync: false
    enabled: false
    prioritized: false
    relayOverlay: false # In case default values change
    lightingColor: '#FFFFFF20'
    overlayColor: '#FFFFFF00'
    noiseAmount: 0 # In case default values change
    noiseMultiplier: 0 # In case default values change

# proto for player ghosts specifically
- type: entity
  parent: MobObserverBase
  id: MobObserver
  components:
  - type: Spectral
  - type: Tag
    tags:
    - AllowGhostShownByEvent
    - AllowPortalTraversal
    - PreventPortalCollision

- type: entity
  parent: BaseMentalAction
  id: ActionGhostBoo
  name: Boo!
  description: Scare your crew members because of boredom!
  components:
  - type: Action
    checkCanInteract: false
    startDelay: true
    useDelay: 120
  - type: Sprite
    layers:
    - texture: Interface/Actions/scream.png
  - type: InstantAction
    event: !type:BooActionEvent

- type: entity
  parent: BaseMentalAction
  id: ActionToggleLighting
  name: Toggle Lighting
  description: Toggle light rendering to better observe dark areas.
  components:
  - type: Action
    clientExclusive: true
  - type: Sprite
    layers:
    - texture: Interface/VerbIcons/light.svg.192dpi.png
  - type: InstantAction
    event: !type:ToggleLightingActionEvent

- type: entity
  parent: BaseMentalAction
  id: ActionToggleFov
  name: Toggle FoV
  description: Toggles field-of-view in order to see what players see.
  components:
  - type: Action
    clientExclusive: true
  - type: Sprite
    layers:
    - texture: Interface/VerbIcons/vv.svg.192dpi.png
  - type: InstantAction
    event: !type:ToggleFoVActionEvent

- type: entity
  parent: BaseMentalAction
  id: ActionToggleGhosts
  name: Toggle Ghosts
  description: Toggle the visibility of other ghosts.
  components:
  - type: Action
    clientExclusive: true
  - type: Sprite
    sprite: Mobs/Ghosts/ghost_human.rsi
    layers:
    - state: icon
  - type: InstantAction
    event: !type:ToggleGhostsActionEvent

- type: entity
  parent: BaseMentalAction
  id: ActionToggleGhostHearing
  name: Toggle Ghost Hearing
  description: Toggle between hearing all messages and hearing only radio & nearby messages.
  components:
  - type: Action
  - type: Sprite
    sprite: Clothing/Ears/Headsets/base.rsi
    layers:
    - state: icon
      map: ["enum.ActionVisuals.Icon"]
    - texture: Interface/Actions/ghostHearingToggled.png
      map: ["enum.ActionVisuals.IconToggled"]
      visible: false
  - type: InstantAction
    event: !type:ToggleGhostHearingActionEvent
