- type: entity
  parent: [ BaseControllable, BaseStructure ]
  id: MothershipCore
  name: mothership core
  description: A sentient machine that can produce Xenoborgs. Without this the Xenoborgs are doomed.
  components:
  - type: InputMover # needs this to pilot the mothership
  - type: BlockMovement # They should never be moving!
    blockInteraction: false
    blockUse: false
  - type: Appearance
  - type: WiresVisuals
  - type: Damageable
    damageContainer: Inorganic
  - 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"]
    - state: core-e
      map: ["enum.BorgVisualLayers.Light"]
      shader: unshaded
  - 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
  # TODO: make it explosive again once until issue https://github.com/space-wizards/space-station-14/issues/40606 is fixed
  # - 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: 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: Xenoborg
    mindRole: MindRoleMothershipCore
    briefingText: mothership-welcome
  - type: MothershipCore
  - type: Tag
    tags:
    - SiliconEmotes
    - CanPilot
    - Structure
  - type: GuideHelp
    guides:
    - Robotics
    - Xenoborgs
  - type: Inventory
    templateId: borg
  - type: NpcFactionMember
    factions:
    - Xenoborg
  - type: Hands
    showInHands: false
    disableExplosionRecursion: true
    canBeStripped: false
  - type: BorgChassis
    canOpenSelfUi: true
    maxModules: 2
    hasMindState: core-e
    noMindState: core-e
    moduleWhitelist:
      tags:
      - MothershipModule
      - BorgModuleEngineering
  - type: ContainerFill
    containers:
      borg_module:
      - MothershipModule
      - BorgModuleAdvancedTool
  - type: ContainerContainer
    containers:
      cell_slot: !type:ContainerSlot { }
      borg_module: !type:Container { }
  - type: PowerCellSlot
    cellSlotId: cell_slot
  - type: ItemSlots
    slots:
      cell_slot:
        name: power-cell-slot-component-slot-name-default
        startingItem: PowerCellMicroreactor
  - type: Puller
    needsHands: false
  - 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-control-computer }
    iconOn: { sprite: Interface/Actions/actions_borg.rsi, state: xenoborg-control-computer }
    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-camera-computer }
    iconOn: { sprite: Interface/Actions/actions_borg.rsi, state: xenoborg-camera-computer }
    keywords: [ "Mothership Core", "console", "interface" ]
    priority: -6
  - type: InstantAction
    event: !type:ToggleIntrinsicUIEvent { key: enum.SurveillanceCameraMonitorUiKey.Key }
