- type: entityTable
  id: XenoArtifactTriggerDefaultTable
  table: !type:GroupSelector
    conditionsForChildren:
      - !type:ExcludeEntitiesFromContextCondition
    children:
    - id: TriggerMusic
    - id: TriggerHeat
    - id: TriggerCold
      weight: 0.5
    - id: TriggerNoOxygen
    - id: TriggerWater
    - id: TriggerCO2
      weight: 0.5
    - id: TriggerPlasma
      weight: 0.5
    - id: TriggerN2O
      weight: 0.5
    - id: TriggerTritium
      weight: 0.1
    - id: TriggerAmmonia
      weight: 0.1
    - id: TriggerFrezon
      weight: 0.1
    - id: TriggerRadiation
    - id: TriggerPressureHigh
      weight: 0.5
    - id: TriggerPressureLow
    - id: TriggerExamine
    - id: TriggerBruteDamage
    #- id: TriggerInteraction #this one interferes with activating artifact AND brute dmg!
    - id: TriggerWrenching
      weight: 0.5
    - id: TriggerPrying
      weight: 0.5
    - id: TriggerScrewing
      weight: 0.5
    - id: TriggerPulsing
      weight: 0.5
    - id: TriggerTimer
      weight: 0.25
    - id: TriggerBlood
    - id: TriggerDeath
    - id: TriggerMagnet
    - id: TriggerConsumeMoney
    - id: TriggerConsumeKnowledge
      weight: 0.25
    - id: TriggerConsumeCarbs
    - id: TriggerConsumeMeat
      weight: 0.5
    - id: TriggerConsumeProduce
      weight: 0.5
    - id: TriggerInteractStamp
    - id: TriggerInteractShock
    - id: TriggerAttackParticleAnomaly
    - id: TriggerAttackStaminaDamage
    - id: TriggerAttackLaser
      weight: 0.5
    - id: TriggerAttackParticleEngine
      weight: 0.1

- type: entityTable
  id: XenoArtifactHandheldOnlyTriggerTable
  table: !type:GroupSelector
    conditionsForChildren:
    - !type:ExcludeEntitiesFromContextCondition
    children:
    - !type:NestedSelector
      tableId: XenoArtifactTriggerDefaultTable
      weight: 35
    - !type:GroupSelector # Handheld exclusive
      weight: 2
      children:
      - id: TriggerThrow
      - id: TriggerMicrowave

- type: entity
  abstract: true
  id: BaseXenoArtifactTrigger
  name: Unknown
  categories: [XenoArtifactTriggers]

#region Standard triggers

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerMusic
  name: Harmonical sound vibrations
  components:
  - type: XATCompNearby
    requireComponentWithName: ActiveInstrument
    radius: 2

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerHeat
  name: High temperature gas
  components:
  - type: XATTemperature
    targetTemperature: 373
    triggerOnHigherTemp: true
  - type: XATDamageThresholdReached
    typesNeeded:
      Heat: 20
  # This kinda trivializes the difficulty.
  #  - type: XATToolUse
  #    requiredTool: Welding
  #    delay: 5
  #    fuel: 10

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerCold
  name: Low temperature gas
  components:
  - type: XATTemperature
    targetTemperature: 255
    triggerOnHigherTemp: false
  - type: XATDamageThresholdReached
    typesNeeded:
      Cold: 20

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerNoOxygen
  name: Oxygen-free environment
  components:
  - type: XATGas
    targetGas: Oxygen
    moles: 10
    shouldBePresent: false

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerWater
  name: Water
  components:
  - type: XATGas
    targetGas: WaterVapor
  - type: XATReactive
    reagents:
    - Water

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerCO2
  name: Carbon dioxide
  components:
  - type: XATGas
    targetGas: CarbonDioxide
  - type: XATReactive
    reagents:
    - CarbonDioxide

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerPlasma
  name: Non-solid plasma
  components:
  - type: XATGas
    targetGas: Plasma
  - type: XATReactive
    reagents:
    - Plasma

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerTritium
  name: Tritium
  components:
  - type: XATGas
    targetGas: Tritium
  - type: XATReactive
    reagents:
    - Tritium

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerAmmonia
  name: Ammonia
  components:
  - type: XATGas
    targetGas: Ammonia
  - type: XATReactive
    reagents:
    - Ammonia

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerN2O
  name: Nitrous oxide
  components:
  - type: XATGas
    targetGas: NitrousOxide
  - type: XATReactive
    reagents:
    - NitrousOxide

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerFrezon
  name: Frezon
  components:
  - type: XATGas
    targetGas: Frezon
  - type: XATReactive
    reagents:
    - Frezon

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerRadiation
  name: Heavy-ion radiation
  components:
  - type: XATDamageThresholdReached
    typesNeeded:
      Radiation: 20

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerPressureHigh
  name: High pressure
  components:
  - type: XATPressure
    maxPressureThreshold: 385

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerPressureLow
  name: Low pressure
  components:
  - type: XATPressure
    minPressureThreshold: 50

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerExamine
  name: Close inspection
  components:
  - type: XATExamine

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerBruteDamage
  name: Physical damage
  components:
  - type: XATDamageThresholdReached
    groupsNeeded:
      Brute: 20

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerInteraction
  name: Physical interaction
  components:
  - type: XATInteraction

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerWrenching
  name: Tightening
  components:
  - type: XATToolUse
    requiredTool: Anchoring
  - type: XATExaminableText
    examineText: xenoarch-trigger-examine-wrenching

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerPrying
  name: Prying
  components:
  - type: XATToolUse
    requiredTool: Prying
  - type: XATExaminableText
    examineText: xenoarch-trigger-examine-prying

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerScrewing
  name: Screwing
  components:
  - type: XATToolUse
    requiredTool: Screwing
  - type: XATExaminableText
    examineText: xenoarch-trigger-examine-screwing

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerPulsing
  name: Pulsing
  components:
  - type: XATToolUse
    requiredTool: Pulsing
  - type: XATExaminableText
    examineText: xenoarch-trigger-examine-pulsing

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerTimer
  name: Regular self-activation
  components:
  - type: XATTimer
    possibleDelayInSeconds:
      min: 80
      max: 120

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerBlood
  name: Blood
  components:
  - type: XATReactive
    reagents:
    - Blood
    - CopperBlood
    - InsectBlood
    - Slime
    - AmmoniaBlood
    - ZombieBlood
    - Sap
    - SulfurBlood

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerDeath
  name: Death
  components:
  - type: XATDeath

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerMagnet
  name: Magnetic waves
  components:
  - type: XATMagnet

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerConsumeMoney
  name: Bribery
  components:
  - type: XATInteractWith
    interactionCount:
      min: 100
      max: 200
    destroyAfter: true
    interactionTime: 1.5
    successTriggerSound: /Audio/Machines/machine_vend.ogg
    whitelist:
      components:
      - Cash

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerConsumeKnowledge
  name: Knowledge intake
  components:
  - type: XATInteractWith
    destroyAfter: true
    interactionTime: 1.5
    successTriggerSound: /Audio/Machines/machine_vend.ogg
    whitelist:
      components:
      - TechnologyDisk
      tags:
      - Book

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerConsumeCarbs
  name: Carbohydrate intake
  components:
  - type: XATInteractWith
    destroyAfter: true
    interactionTime: 1.5
    successTriggerSound:
      collection: eating
      params:
        volume: 5
    whitelist:
      tags:
      - Bread
      - Cake
      - DonkPocket
      - Donut
      - Pie
      - Pizza

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerConsumeMeat
  name: Protein intake
  components:
  - type: XATInteractWith
    destroyAfter: true
    interactionTime: 1.5
    successTriggerSound:
      collection: eating
      params:
        volume: 5
    whitelist:
      tags:
      - Meat
  - type: XATReactive
    reagents:
    - Protein
    - UncookedAnimalProteins

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerConsumeProduce
  name: Healthy produce intake
  components:
  - type: XATInteractWith
    destroyAfter: true
    interactionTime: 1.5
    successTriggerSound:
      collection: eating
      params:
        volume: 5
    whitelist:
      tags:
      - Fruit
      - Vegetable
      - CottonBoll
      - Ambrosia
      - Mushroom

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerInteractStamp
  name: Bureaucratic approval
  components:
  - type: XATInteractWith
    interactionTime: 0.5
    successTriggerSound:
      path: /Audio/Items/Stamp/thick_stamp_sub.ogg
      params:
        volume: -2
        maxDistance: 5
    whitelist:
      components:
      - Stamp

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerInteractShock
  name: Electrical shock
  components:
  - type: XATShock
  - type: XATDamageThresholdReached
    typesNeeded:
      Shock: 5

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerAttackParticleEngine
  name: Singularity-Effecting particles
  components:
  - type: XATInteractAttack
    whitelist:
      components:
      - ParticleProjectile

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerAttackParticleAnomaly
  name: Anomaly-Effecting particles
  components:
  - type: XATInteractAttack
    whitelist:
      components:
      - AnomalousParticle

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerAttackStaminaDamage
  name: Organic exhaustion
  components:
  - type: XATStaminaDamageThresholdReached
    damageNeeded: 8 # half a practice disabler capacity

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerAttackLaser
  name: High-Intensity photon impacts
  components:
  - type: XATInteractAttack
    interactionCount:
      max: 3
    whitelist:
      components:
      - LaserProjectile
      tags:
      - EmitterBolt

#endregion
#region Handheld triggers

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerMicrowave
  name: Microwave radiation
  components:
  - type: XATMicrowave

- type: entity
  parent: BaseXenoArtifactTrigger
  id: TriggerThrow
  name: Being thrown
  components:
  - type: XATItemLand

#endregion
