- type: startingGear
  id: MothershipCoreGear
  inhand:
  - DoorRemoteXenoborg
  - Omnitool

- type: entity
  parent: [ BaseControllable, BaseMachinePowered ]
  id: MothershipCore
  name: mothership core
  description: A sentient machine that can produce Xenoborgs. Without this the Xenoborgs are doomed.
  components:
  - type: Appearance
  - type: WiresVisuals
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.4,-0.4,0.4,0.4"
        density: 190
        mask:
        - MachineMask
        layer:
          - MachineLayer
  - type: Sprite
    sprite: Mobs/Silicon/mothership_core.rsi
    layers:
    - state: core-idle
      map: ["enum.LatheVisualLayers.IsRunning"]
    - state: core-load
      map: ["enum.MaterialStorageVisualLayers.Inserting"]
    - state: core-o
      map: ["enum.WiresVisualLayers.MaintenancePanel"]
  - type: Machine
    board: null
  - type: Lathe
    idleState: core-idle
    runningState: core-active
    staticPacks:
    - EmptyXenoborgs
    - XenoborgUpgradeModules
  - type: MaterialStorage
    whitelist:
      tags:
      - Sheet
      - RawMaterial
      - Ingot
  - type: PointLight
    color: "#0033ff"
    enabled: true
    radius: 4
    netsync: false
  - type: Anchorable
    flags:
    - Anchorable
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 200
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
      - !type:ExplodeBehavior
      - !type:SpawnEntitiesBehavior
        spawn:
          MachineFrameDestroyed:
            min: 1
            max: 1
      - !type:SpawnGasBehavior
        gasMixture:
          volume: 1000
          moles:
            CarbonDioxide: 340.5701689 # carbon dioxide
          temperature: 373.15
  - type: Repairable
    doAfterDelay: 30 # you can heal the mothership core, but it takes a while
  - type: DamagedSiliconAccent
    enableChargeCorruption: false
  - type: Explosive
    explosionType: Default
    maxIntensity: 100
    intensitySlope: 2
    totalIntensity: 200
  - type: SurveillanceCameraSpeaker
  - type: SurveillanceCameraMonitor
  - type: RoboticsConsole
    allowBorgControl: false
    radioChannel: Xenoborg
  - type: DeviceNetwork
    deviceNetId: Wireless
    receiveFrequencyId: Mothership
    transmitFrequencyId: Mothership
  - type: WirelessNetworkConnection
    range: 10000 # mothership can see them from very far
  - type: WiresPanel
  - type: ActivatableUI
    key: enum.LatheUiKey.Key
  - type: ActivatableUIRequiresPower
  - type: UserInterface
    interfaces:
      enum.SiliconLawsUiKey.Key:
        type: SiliconLawBoundUserInterface
        requireInputValidation: false
      enum.RadarConsoleUiKey.Key:
        type: RadarConsoleBoundUserInterface
      enum.RoboticsConsoleUiKey.Key:
        type: RoboticsConsoleBoundUserInterface
      enum.SurveillanceCameraMonitorUiKey.Key:
        type: SurveillanceCameraMonitorBoundUserInterface
      enum.LatheUiKey.Key:
        type: LatheBoundUserInterface
      enum.ResearchClientUiKey.Key:
        type: ResearchClientBoundUserInterface
  - type: Transform
    anchored: true
  - type: Pullable
  - type: StaticPrice
    price: 800
  - type: WarpPoint
    location: Mothership Core
    follow: true
  - type: VoiceOverride
    nameOverride: MOTHERSHIP CORE
  - type: TypingIndicator
    proto: xenoborg
  - type: Speech
    speechVerb: Robotic
    speechSounds: Xenoborg
    allowedEmotes:
    - Laugh
  - type: Vocal
    sounds:
      Unsexed: UnisexSiliconXenoborg
    wilhelmProbability: 0
  - type: IntrinsicRadioReceiver
  - type: IntrinsicRadioTransmitter
    channels:
    - Mothership
    - Xenoborg
    - Binary
  - type: ActiveRadio
    channels:
    - Mothership
    - Xenoborg
    - Binary
  - type: XenoborgMothership
  - type: Tag
    tags:
    - SiliconEmotes
    - CanPilot
    - Structure
  - type: Inventory
    templateId: borg
  - type: Loadout
    prototypes: [MothershipCoreGear]
  - type: NpcFactionMember
    factions:
    - Xenoborg
  - type: Hands
    hands:
      hand_right1:
        location: Right
      hand_right2:
        location: Right
      hand_left1:
        location: Left
      hand_left2:
        location: Left
    sortedHands:
    - hand_right1
    - hand_right2
    - hand_left1
    - hand_left2
  # - type: Puller # use the conveyor
  - type: Eye
    drawFov: false
  # - type: StationAiOverlay # removed until is no longer buggy
  - type: IgnoreUIRange
  - type: ComplexInteraction
  - type: MindContainer
  - type: SiliconLawBound
  - type: Actions
  - type: ActionGrant
    actions:
    - ActionViewLaws
  - type: SiliconLawProvider
    laws: MothershipCoreLawset # custom laws here
    subverted: true
  - type: Stripping
  - type: Access
    enabled: true
    tags:
    - Xenoborg
  - type: LockingWhitelist
    blacklist:
      components:
      - RoboticsConsole
    whitelist:
      components:
      - BorgChassis
  - type: IntrinsicUI
    uis:
      enum.RadarConsoleUiKey.Key:
        toggleAction: ActionAGhostShowRadar
      enum.RoboticsConsoleUiKey.Key:
        toggleAction: ActionXenoborgControlMonitor
      enum.SurveillanceCameraMonitorUiKey.Key:
        toggleAction: ActionXenoborgCameraMonitor
  - type: ShowElectrocutionHUD
  - type: PowerMonitoringCableNetworks
  - type: RadarConsole

- type: entity
  parent: BaseAGhostAction
  id: ActionXenoborgControlMonitor
  name: Xenoborgs Control Console
  description: View the Xenoborgs Control Console
  components:
  - type: Action
    icon: { sprite: Interface/Actions/actions_borg.rsi, state: xenoborg-basic-module }
    iconOn: { sprite: Interface/Actions/actions_borg.rsi, state: xenoborg-basic-module }
    keywords: [ "Mothership Core", "console", "interface" ]
    priority: -6
  - type: InstantAction
    event: !type:ToggleIntrinsicUIEvent { key: enum.RoboticsConsoleUiKey.Key }

- type: entity
  parent: BaseAGhostAction
  id: ActionXenoborgCameraMonitor
  name: Xenoborgs Camera Monitor
  description: View the Xenoborgs Camera Monitor
  components:
  - type: Action
    icon: { sprite: Interface/Actions/actions_borg.rsi, state: xenoborg-eye-module }
    iconOn: { sprite: Interface/Actions/actions_borg.rsi, state: xenoborg-eye-module }
    keywords: [ "Mothership Core", "console", "interface" ]
    priority: -6
  - type: InstantAction
    event: !type:ToggleIntrinsicUIEvent { key: enum.SurveillanceCameraMonitorUiKey.Key }
