- type: entity
  parent: [BaseMob, StripableInventoryBase]
  id: BaseBorgChassisNotIonStormable
  name: cyborg
  description: A man-machine hybrid that assists in station activity. They love being asked to state their laws over and over.
  save: false
  abstract: true
  components:
  - type: Reactive
    groups:
      Acidic: [Touch]
  - type: DamageOnHighSpeedImpact
    damage:
      types:
        Blunt: 5
    soundHit:
      collection: MetalThud
  - type: CombatMode
  - type: NoSlip
  - type: StaticPrice
    price: 1250
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeCircle
          radius: 0.35
        density: 300
        mask:
        - MobMask
        layer:
        - MobLayer
  - type: MovementSpeedModifier
    baseWalkSpeed : 2.5
    baseSprintSpeed : 4.5
  - type: Sprite
    sprite: Mobs/Silicon/chassis.rsi
  - type: RotationVisuals
    horizontalRotation: 90
  - type: MobState
    allowedStates:
    - Alive
    - Critical
    - Dead
  - type: MobThresholds
    thresholds:
      0: Alive
      100: Critical
      300: Dead # Same as destruction threshold. Borgs act exactly like crit when dead, except for ghosting on move
    stateAlertDict:
      Alive: BorgHealth
      Critical: BorgCrit
      Dead: BorgDead
    showOverlays: false
    allowRevives: true
  - type: HealthExaminable
    examinableTypes:
      - Blunt
      - Slash
      - Piercing
      - Heat
      - Shock
    locPrefix: silicon
  - type: UserInterface
    interfaces:
      enum.SiliconLawsUiKey.Key:
        type: SiliconLawBoundUserInterface
        requireInputValidation: false
      enum.BorgUiKey.Key:
        type: BorgBoundUserInterface
      enum.StrippingUiKey.Key:
        type: StrippableBoundUserInterface
      # Only used for NT borgs that can switch type, defined here to avoid copy-pasting the rest of this component.
      enum.BorgSwitchableTypeUiKey.SelectBorgType:
        type: BorgSelectTypeUserInterface
  - type: ActivatableUI
    key: enum.BorgUiKey.Key
  - type: SiliconLawBound
  - type: ActionGrant
    actions:
    - ActionViewLaws
  - type: EmagSiliconLaw
    stunTime: 5
  - type: SiliconLawProvider
    laws: Crewsimov
  - type: Inventory
    templateId: borg
  - type: Hands
    showInHands: false
    disableExplosionRecursion: true
    canBeStripped: false
  - type: ComplexInteraction
  - type: IntrinsicRadioReceiver
  - type: IntrinsicRadioTransmitter
    channels:
    - Binary
    - Common
    - Science
  - type: ActiveRadio
    channels:
    - Binary
    - Common
    - Science
  - type: ZombieImmune
  - type: Repairable
    damageValue: -10 # 10 seconds to repair from crit
    doAfterDelay: 1
    fuelCost: 0.5
    allowSelfRepair: false
  - type: BorgChassis
  - type: LockingWhitelist
    blacklist:
      components:
      - BorgChassis
      - RoboticsConsole
  - type: WiresPanel
  - type: ActivatableUIRequiresPanel
  - type: NameIdentifier
    group: Silicon
  - type: ContainerContainer
    containers:
      borg_brain: !type:ContainerSlot { }
      cell_slot: !type:ContainerSlot { }
      borg_module: !type:Container { }
      part-container: !type:Container
  - type: PowerCellSlot
    cellSlotId: cell_slot
    fitsInCharger: true
  - type: Access
    enabled: false # needs a player so that scientists can't drag around an empty borg for free AA
  - type: PowerCellDraw
    drawRate: 0.6
    enabled: false # the borg is only activated when a player takes over, otherwise the battery is likely empty
  - type: ItemSlots
    slots:
      cell_slot:
        name: power-cell-slot-component-slot-name-default
  - type: Body
  - type: StatusEffects
    allowed:
    - Flashed
  - type: TypingIndicator
    proto: robot
  - type: Speech
    speechVerb: Robotic
    speechSounds: Borg
  - type: Vocal
    emoteSounds: UnisexSilicon
    wilhelmProbability: 0
  - type: DamagedSiliconAccent
    damageAtMaxCorruption: 300
  - type: UnblockableSpeech
  - type: FootstepModifier
    footstepSoundCollection:
      collection: FootstepBorg
  - type: Construction
    graph: Cyborg
    node: cyborg
    containers:
    - part-container
    - cell_slot
  - type: Lock
    locked: true
    unlockOnClick: false
  - type: UIRequiresLock
    userInterfaceKeys:
    - enum.BorgUiKey.Key
  - type: LockedWiresPanel
  - type: Damageable
  - type: Injurable
    damageContainer: Silicon
  - type: Destructible
    generateOverkillThreshold: false
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 75
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          path: /Audio/Machines/warning_buzzer.ogg
          params:
            volume: 5
    - trigger:
        !type:DamageTrigger
        damage: 300
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:GibBehavior
      - !type:SpawnEntitiesBehavior
        spawn:
          ScrapGlass:
            min: 1
            max: 1
          SheetSteel:
            min: 10
            max: 20
  - type: HandheldLight
    toggleOnInteract: false
    wattage: 0.2
    blinkingBehaviourId: blinking
    radiatingBehaviourId: radiating
  # These two components are required to make HandheldLight work, even though we don't even have ItemToggle.
  # The code is a total mess and needs a complete rewrite.
  - type: ItemTogglePointLight
  - type: ToggleableVisuals
    spriteLayer: light
  - type: LightBehaviour
    behaviours:
    - !type:FadeBehaviour
      id: radiating
      maxDuration: 2.0
      startValue: 3.0
      endValue: 2.0
      isLooped: true
      reverseWhenFinished: true
    - !type:PulseBehaviour
      id: blinking
      interpolate: Nearest
      maxDuration: 1.0
      startValue: 0.1
      endValue: 2.0
      isLooped: true
  - type: PointLight
    enabled: false
    mask: /Textures/Effects/LightMasks/cone.png
    autoRot: true
    radius: 4
    netsync: false
  - type: Pullable
  - type: Puller
    needsHands: false
  - type: StandingState
  - type: Tag
    tags:
    - DoorBumpOpener
    - FootstepSound
    - CanPilot
    - SiliconEmotes
    - Unimplantable
  - type: Emoting
  - type: GuideHelp
    guides:
    - Cyborgs
    - Robotics
  - type: ProtectedFromStepTriggers
  - type: DamageOnInteractProtection
    damageProtection:
      flatReductions:
        Heat: 10 # capable of touching light bulbs and stoves without feeling pain!
  - type: BypassLock
    openWiresPanel: true
  - type: BypassLockRequiresMobState
    requiredMobState:
    - Critical
    - Dead

- type: entity
  abstract: true
  parent: BaseBorgChassisNotIonStormable
  id: BaseBorgChassis
  components:
  - type: IonStormTarget

- type: entity
  abstract: true
  id: BaseBorgTransponder
  components:
  - type: BorgTransponder
  - type: DeviceNetwork
    deviceNetId: Wireless
    receiveFrequencyId: CyborgControl
    transmitFrequencyId: RoboticsConsole
    savableAddress: false
  - type: TimerTrigger
    delay: 10
    examinable: false
    beepSound:
      path: /Audio/Effects/Cargo/buzz_two.ogg
      params:
        volume: -4
  # prevent any funnies if someone makes a cyborg item...
  - type: ExplodeOnTrigger
    keysIn:
    - timer
  # explosion does most of its damage in the center and less at the edges
  - type: Explosive
    explosionType: Minibomb
    deleteAfterExplosion: false # let damage threshold gib the borg
    totalIntensity: 30
    intensitySlope: 20
    maxIntensity: 20
    canCreateVacuum: false # its for killing the borg not the station

- type: entity
  abstract: true
  parent: BaseBorgTransponder
  id: BaseXenoborgTransponder
  components:
  - type: DeviceNetwork
    receiveFrequencyId: Xenoborg
    transmitFrequencyId: Mothership
  - type: SurveillanceCamera # they act like cameras for the mothership
    networkSet: true
    nameSet: True
    id: Xenoborg
    useEntityNameAsCameraId: true
  - type: Explosive
    explosionType: Minibomb
    deleteAfterExplosion: false # let damage threshold gib the borg
    totalIntensity: 200 # bigger kaboom
    intensitySlope: 20
    maxIntensity: 100
    canCreateVacuum: false

- type: entity
  id: BaseBorgChassisNT
  parent: [BaseBorgChassis, BaseBorgTransponder]
  abstract: true
  components:
  - type: RandomMetadata
    nameSegments:
    - NamesBorg
  - type: NpcFactionMember
    factions:
    - NanoTrasen
  - type: Access
    groups:
    - AllAccess
    tags:
    - Borg
  - type: AccessReader
    access: [["Command"], ["Research"]]
  - type: ShowJobIcons
  - type: ShowCrewIcons
  - type: InteractionPopup
    interactSuccessSound:
      path: /Audio/Ambience/Objects/periodic_beep.ogg

- type: entity
  id: BaseBorgChassisSyndicate
  parent: BaseBorgChassis
  abstract: true
  components:
  - type: NpcFactionMember
    factions:
    - Syndicate
  - type: Access
    tags:
    - NuclearOperative
    - SyndicateAgent
  - type: AccessReader
    access: [["SyndicateAgent"], ["NuclearOperative"]]
  - type: SiliconLawProvider
    laws: SyndicateStatic
    subverted: true
  - type: IntrinsicRadioTransmitter
    channels:
    - Binary
    - Syndicate
  - type: ActiveRadio
    channels:
    - Binary
    - Syndicate
  - type: ShowSyndicateIcons
  - type: MovementAlwaysTouching
  - type: Speech
    speechSounds: SyndieBorg
    allowedEmotes:
    - Laugh
  - type: Vocal
    emoteSounds: UnisexSiliconSyndicate
  - type: PointLight
    color: "#dd200b"
  - type: BypassLock
    bypassDelay: 15 # We don't want people to easily be able to remove syndieborg brains.

- type: entity
  id: BaseBorgChassisDerelict
  parent: BaseBorgChassis
  abstract: true
  components:
  - type: NpcFactionMember
    factions:
    - NanoTrasen #The seemingly best fit. It was a regular NT cyborg once, after all.
  - type: Access
    groups:
    - AllAccess #Randomized access would be fun. AllAccess is the best i can think of right now that does make it too hard for it to enter the station or navigate it..
  - type: AccessReader
    access: [["Command"], ["Research"]]
  - type: StartIonStormed
    ionStormAmount: 3
  - type: IonStormTarget
    chance: 1
  - type: ShowJobIcons
  - type: ShowCrewIcons

- type: entity
  id: BaseBorgChassisSyndicateDerelict #For assault borg and maybe others in time
  parent: BaseBorgChassis # We don't want them to see Nukies or have syndi comms, their database is out of date
  abstract: true
  components:
  - type: SiliconLawProvider
    laws: SyndicateStatic #Non-subverted version so they can still be changed
  - type: StartIonStormed
    ionStormAmount: 3
  - type: IonStormTarget
    chance: 1
  - type: ShowJobIcons
  - type: ShowCrewIcons
  - type: NpcFactionMember # They're still syndicate even if they can't listen to the radio or see icons
    factions:
    - Syndicate
  - type: Access
    tags:
    - NuclearOperative
    - SyndicateAgent
  - type: AccessReader
    access: [ [ "SyndicateAgent" ], [ "NuclearOperative" ] ]
  - type: IntrinsicRadioTransmitter # Copy components from base SyndiBorg but without the stuff we don't want
    channels:
    - Binary #1984
  - type: ActiveRadio
    channels:
    - Binary
  - type: MovementAlwaysTouching
  - type: Speech
    speechSounds: SyndieBorg
    allowedEmotes:
    - Laugh
  - type: Vocal
    emoteSounds: UnisexSiliconSyndicate
  - type: PointLight
    color: "#dd200b"
  - type: BypassLock
    bypassDelay: 15 # We don't want people to easily be able to remove syndieborg brains.

- type: entity
  parent: BaseBorgChassisNotIonStormable
  id: BaseXenoborgChassis
  name: xenoborg
  description: A man-machine hybrid that aims to replicate itself. They love extracting brains to insert into fresh Xenoborg chassis to grow their army.
  save: false
  abstract: true
  components:
  - type: RandomMetadata
    nameSegments:
    - NamesXenoborg
  - type: NameIdentifier
    group: Xenoborg
  - type: Sprite
    sprite: Mobs/Silicon/chassis.rsi
  - type: MobThresholds
    thresholds: # slightly tankier than a normal borg
      0: Alive
      125: Critical
      375: Dead # Same as destruction threshold. Borgs act exactly like crit when dead, except for ghosting on move
  - type: EmagSiliconLaw # should xenoborgs be emagable?
    stunTime: 5
  - type: SiliconLawProvider
    laws: XenoborgLawset # custom laws here
  - type: IntrinsicRadioTransmitter # can only use binary and xenoborg channel
    channels:
    - Xenoborg
    - Binary
  - type: ActiveRadio # but can hear the mothership channel
    channels:
    - Mothership
    - Xenoborg
    - Binary
  - type: BorgChassis
    maxModules: 0
    hasMindState: robot_e
    noMindState: robot_e_r
    moduleWhitelist:
      tags:
      - XenoborgModuleGeneric
  - type: TypingIndicator
    proto: xenoborg
  - type: Speech
    speechVerb: Robotic
    speechSounds: Xenoborg
    allowedEmotes:
    - Laugh
  - type: Vocal
    emoteSounds: UnisexSiliconXenoborg
    wilhelmProbability: 0
  - type: DamagedSiliconAccent
  - type: UnblockableSpeech
  - type: FootstepModifier
    footstepSoundCollection:
      collection: FootstepXenoborg
  # - type: SpamEmitSound # makes a creppy noise randomly
  #   minInterval: 30
  #   maxInterval: 45
  #   sound:
  #     path: /Audio/Machines/genetics.ogg
  #     params:
  #       volume: -8
  #       maxDistance: 5
  #       variation: 0.05
  - type: NpcFactionMember
    factions:
    - Xenoborg
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 90
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          path: /Audio/Machines/warning_buzzer_xenoborg.ogg
          params:
            volume: 5
    - trigger:
        !type:DamageTrigger
        damage: 375
      behaviors:
      - !type:PlaySoundBehavior
        sound:
          collection: MetalBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          PinpointerMothershipPiece: # drop a piece of core pinpointer upon being destructed (4 pieces to make a core pinpointer)
            min: 1
            max: 1
      - !type:EmptyContainersBehaviour
        containers:
        - borg_brain
        - borg_module
        - cell_slot
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: PointLight
    color: "#3010ff"
    energy: 7
  - type: GuideHelp
    guides:
    - Cyborgs
    - Robotics
    - Xenoborgs
  - type: Access
    tags:
    - Xenoborg
  - type: AccessReader
    access: [["Xenoborg"]]
  - type: ShowJobIcons # not sure if it is needed
  - type: ShowCrewIcons
  - type: InteractionPopup
    interactSuccessSound:
      path: /Audio/Ambience/Objects/periodic_beep.ogg
  - type: Xenoborg
  - type: BypassLock
    bypassDelay: 15 # We don't want people to easily be able to remove xenoborg brains.
