- 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
    defaultRotation: 90 # Sunrise-Edit
    horizontalRotation: 90
  - type: MobState
    allowedStates:
    - Alive
    - Critical
    - Dead
  - type: MobThresholds
    thresholds:
      0: Alive
      100: Critical
      200: Dead
    stateAlertDict:
      Alive: BorgHealth
      Critical: BorgCrit
      Dead: BorgDead
    showOverlays: false
    allowRevives: true
  - type: HealthExaminable
    examinableTypes:
      - Blunt
      - Slash
      - Piercing
      - Heat
      - Shock
      - Mangleness #Sunrise-Edit
    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
      enum.BorgVoiceUiKey.Key:
        type: BorgVoiceBoundUserInterface
  - type: ActivatableUI
    key: enum.BorgUiKey.Key
  - type: SiliconLawBound
  - type: ActionGrant
    actions:
    - ActionViewLaws
    - ActionChangeBorgVoice
  - type: EmagSiliconLaw
    stunTime: 5
  - type: SiliconLawProvider
    laws: NTDefault # Sunrise-Edit
  - 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
  # Sunrise-Start
  - type: Repairable
    doAfterDelay: 3
    damage:
      types:
        Blunt: -15
        Slash: -15
        Piercing: -15
        Caustic: -15
        Structural: -15
        Mangleness: 5 #SUNRISE-EDIT
    allowSelfRepair: false
  # Sunrise-End
  - type: BorgChassis
  - type: BorgVoice # Sunrise-TTS: Allow cyborgs to change their voice
  - type: LockingWhitelist
    blacklist:
      components:
      - BorgChassis
      - RoboticsConsole
  - type: WiresPanel
    openingTool: Prying
    openDelay: 3
  - 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: ItemToggle
    onActivate: false # You should not be able to turn off a borg temporarily.
    activated: false # gets activated when a mind is added
    onUse: false # no item-borg toggling sorry
  - type: ItemTogglePointLight
  - type: AccessToggle
  # TODO: refactor movement to just be based on toggle like speedboots but for the boots themselves
  # TODO: or just have sentient speedboots be fast idk
  - type: PowerCellDraw
    drawRate: 0.6
  # no ToggleCellDraw since dont want to lose access when power is gone
  - type: ItemSlots
    slots:
      cell_slot:
        name: power-cell-slot-component-slot-name-default
  - type: Body
  - type: StatusEffects
    allowed:
    - Flashed
    - Jump # Sunrise-Edit
    - Flip # Sunrise-Edit
    - Fall # Sunrise-Edit
  - type: TypingIndicator
    proto: robot
  - type: Speech
    speechVerb: Robotic
    speechSounds: Borg
  - type: Vocal
    sounds:
      Unsexed: UnisexSilicon
    wilhelmProbability: 0
  - type: DamagedSiliconAccent
  - 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
    damageContainer: Silicon
    damageModifierSet: Silicon # Sunrise-Edit
  - type: Destructible
    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:EmptyContainersBehaviour
        containers:
        - borg_brain
        - borg_module
        - cell_slot
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: HandheldLight
    toggleOnInteract: false
    wattage: 0.2
    blinkingBehaviourId: blinking
    radiatingBehaviourId: radiating
  - 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: ToggleableVisuals
    spriteLayer: light
  - type: PointLight
    enabled: false
    mask: /Textures/Effects/LightMasks/cone.png
    autoRot: true
    energy: 2 # Sunrise-edit
    radius: 12 # Sunrise-edit
    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!
  # Sunrise-start
  - type: TTS
    voice: Portal2FactCore
  - type: Climbing
  - type: BorgMagboots
    walkModifier: 0.8
    sprintModifier: 0.8
  - type: Strap
    position: Stand
    buckleOffsets: # Sunrise-Edit
    - "0,0.15"
  - type: Stripping
    useDragDrop: false
  - type: CyborgSparkEffect
  # Sunrise-end

- 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
  - 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
    enabled: false
    # Sunrise-Start
    tags:
    - Borg
    - EmergencyShuttleRepealAll
    - Command
    - Lawyer
    - Engineering
    - Medical
    - Salvage
    - Cargo
    - Research
    - Service
    - Maintenance
    - External
    - Janitor
    - Theatre
    - Bar
    - Chemistry
    - Kitchen
    - Chapel
    - Hydroponics
    - Atmospherics
    # Sunrise-End
  - type: AccessReader
    access: [["Command"], ["Research"]]
  - type: ShowJobIcons
  - type: InteractionPopup
    interactSuccessSound:
      path: /Audio/Ambience/Objects/periodic_beep.ogg
  # Sunrise-Start
  - type: StationAiVision
    range: 3
  - type: InnateItem
    instantActions:
    - HandheldStationMapUnpowered
  - type: BorgCrewManifestViewer
  - type: StationRecordKeyStorage
  # Sunrise-End

- 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
    sounds:
      Unsexed: UnisexSiliconSyndicate
  # Sunrise-start
  - type: PointLight
    color: "#f51e0f"
    radius: 6
    energy: 3
  - type: ShowJobIcons
  - type: FlashImmunity
  - type: TypingIndicator
    proto: syndibot
  - type: Tag
    tags:
    - DoorBumpOpener
    - CanPilot
    - FootstepSound
    - EmagImmune
  - type: BlockLawChange
  # Sunrise-end

- 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
    enabled: false
    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: 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: 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
    sounds:
      Unsexed: UnisexSiliconSyndicate
  - type: PointLight
    color: "#dd200b"

- 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
      250: Dead
  - type: EmagSiliconLaw # should xenoborgs be emagable?
    stunTime: 5
  - type: SiliconLawProvider
    laws: XenoborgLawset # custom laws here
    subverted: true
  - 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: Repairable
    doAfterDelay: 13 # 25% more HP, so 30% more time to heal
  - 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
    sounds:
      Unsexed: 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:EmptyContainersBehaviour
        containers:
        - borg_brain
        - borg_module
        - cell_slot
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
  - type: PointLight
    color: "#0033ff"
  - type: GuideHelp
    guides:
    - Cyborgs
    - Robotics
    # TODO: add Xenoborg guide (part 7 spoilers)
  - type: Access
    enabled: false
    tags:
    - Xenoborg
  - type: AccessReader
    access: [["Xenoborg"]]
  - type: ShowJobIcons # not sure if it is needed
  - type: InteractionPopup
    interactSuccessSound:
      path: /Audio/Ambience/Objects/periodic_beep.ogg
