- type: entity
  parent: BaseStructure
  id: BaseWeaponTurret
  name: turret
  abstract: true
  components:
  - type: Clickable
  - type: InteractionOutline
  - type: Actions
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.45,-0.45,0.45,0.45"
        density: 60
        mask:
        - MachineMask
        layer:
        - MachineLayer
  - type: Sprite
    sprite: Objects/Weapons/Guns/Turrets/turrets.rsi
    drawdepth: Mobs
    layers:
    - state: syndie_lethal
  - type: InteractionPopup
    interactDelay: 0.2
    successChance: 0.8
    interactSuccessString: petting-success-generic
    interactFailureString: petting-failure-generic
    interactSuccessSound:
      path: /Audio/Effects/double_beep.ogg
  - type: CombatMode
    toggleMouseRotator: false
  - type: Damageable
    damageContainer: Inorganic
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 600
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
    - trigger:
        !type:DamageTrigger
        damage: 300
       # TODO: Construction graph
      behaviors:
      - !type:DoActsBehavior
        acts: [ "Destruction" ]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          SheetSteel1:
            min: 3
            max: 5
  - type: HTN
    rootTask:
      task: TurretCompound
    blackboard:
      RotateSpeed: !type:Single
        1.57 # Mono
      SoundTargetInLOS: !type:SoundPathSpecifier
        path: /Audio/Effects/double_beep.ogg
  - type: MouseRotator
    angleTolerance: 5
    rotationSpeed: 90 # Mono
    simple4DirMode: false
  - type: NoRotateOnInteract
  - type: NoRotateOnMove
  - type: Input
    context: "human"
  - type: StaticPrice
    price: 100

- type: entity
  parent: BaseWeaponTurret
  id: BaseWeaponBallisticTurret
  description: A ballistic machine gun auto-turret.
  name: ballistic turret
  abstract: true
  components:
  - type: ContainerContainer
    containers:
      ballistic-ammo: !type:Container
  - type: Battery
    maxCharge: 2000
    startingCharge: 2000
  - type: Gun
    fireRate: 6
    projectileSpeed: 55
    maxAngle: 15 # Mono
    minAngle: 4 # Mono
    angleIncrease: -1.2 # Mono
    angleDecay: -4 # Mono
    selectedMode: FullAuto
    availableModes:
    - FullAuto
    soundGunshot:
      path: /Audio/Weapons/Guns/Gunshots/gun_sentry.ogg
  - type: ProjectileBatteryAmmoProvider
    proto: Cartridge635x40mmCaseless
    fireCost: 25
  - type: BatterySelfRecharger
    autoRecharge: true
    autoRechargeRate: 15

- type: entity
  parent: BaseWeaponTurret
  id: BaseWeaponEnergyTurret
  name: laser turret
  description: An auto-turret armed with a heavy laser. Its weapon will recharge while connected to an active power grid.
  abstract: true
  components:
  - type: Sprite
    sprite: Objects/Weapons/Guns/Turrets/sentry_turret.rsi
    drawdepth: FloorObjects
    granularLayersRendering: true
    layers:
    - state: support
      renderingStrategy: NoRotation
    - state: base
    - state: lethal
      shader: unshaded
  - type: Gun
    projectileSpeed: 15
    fireRate: 1.5
    maxAngle: 15 # Mono
    minAngle: 4 # Mono
    angleIncrease: -1.2 # Mono
    angleDecay: -4 # Mono
    soundGunshot:
      path: /Audio/Weapons/Guns/Gunshots/taser2.ogg
  - type: ProjectileBatteryAmmoProvider
    proto: BulletEnergyTurretLaser
    fireCost: 100
  - type: Battery
    maxCharge: 2000
    startingCharge: 0
  - type: ApcPowerReceiverBattery
    idlePowerUse: 5
    batteryRechargeRate: 200
    batteryRechargeEfficiency: 1.225
  - type: ApcPowerReceiver
    powerLoad: 5
  - type: ExtensionCableReceiver
