# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 McBosserson <148172569+McBosserson@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 McBosserson <mcbosserson@hotmail.com>
# SPDX-FileCopyrightText: 2025 SoundingExpert <204983230+SoundingExpert@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 john git <113782077+whateverusername0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 router <messagebus@vk.com>
# SPDX-FileCopyrightText: 2025 whateverusername0 <whateveremail>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: MachinePowerTransmissionLaser
  parent: [ BaseMachine ]
  name: power transmission laser
  description: Sends power over a giant laser beam to an NT power processing facility. Simply plug it in and come back tomorrow for a big stack of cash (that is if you have power running). Also don't step in front of the firing line please.
  placement:
    mode: SnapgridCenter
  components:
  - type: PTL
    active: false
    baseBeamDamage:
      types:
        Heat: 5
  - type: PTLVisuals
  - type: Sprite
    sprite: _Goobstation/Structures/Machines/PTL/pt_laser.rsi
    layers:
    - state: base
      map: ["enum.PTLVisualLayers.Base"]
    - state: unpowered
      shader: unshaded
      visible: true
      map: ["enum.PTLVisualLayers.Unpowered"]
    - state: charge-1
      shader: unshaded
      visible: false
      map: ["enum.PTLVisualLayers.Charge"]
  - type: Transform
    anchored: true
    noRot: false
  - type: RadiationSource
  - type: Appearance
  - type: PowerNetworkBattery
    maxChargeRate: 5000000 # 5MJ
  - type: Battery
    startingCharge: 0
    maxCharge: 100000000 # 100MJ
  - type: ExaminableBattery
  - type: BatteryCharger
    voltage: High
    node: input
  - type: NodeContainer
    examinable: true
    nodes:
      input:
        !type:CableDeviceNode
        nodeGroupID: HVPower
  - type: StationInfiniteBatteryTarget
  - type: Damageable
    damageContainer: StructuralInorganic
    damageModifierSet: StructuralMetallicStrong
  - type: BatterySensor
  - type: Gun
    showExamineText: false
    fireRate: 10
    selectedMode: SemiAuto
    availableModes:
      - SemiAuto
    soundGunshot:
      path: /Audio/Weapons/Guns/Gunshots/laser_cannon.ogg
  - type: HitscanBatteryAmmoProvider
    examinable: false
    proto: PTL
    fireCost: 1000
  - type: Physics
    bodyType: Static
  - type: Rotatable # or people end up trying to rotate it by edging on solid ents in space, which never works
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-1.5,-1.5,1.5,1.5"
        density: 50
        mask:
        - LargeMobMask
        layer:
        - WallLayer
  - type: StationAiWhitelist
  # ui todo
  #- type: ActivatableUI
  #  key: enum.PTLUiKey.Key
  #- type: ActivatableUIRequiresPower
  #- type: UserInterface
  #  interfaces:
  #    enum.PTLUiKey.Key:
  #      type: PTLBoundUserInterface
  - type: AmbientSound
    range: 5
    sound:
      path: /Audio/Ambience/Objects/engine_hum.ogg

- type: hitscan
  id: PTL
  damage:
    types:
      Heat: 30
  muzzleFlash:
    sprite: _Goobstation/Structures/Machines/PTL/pt_beam.rsi
    state: ptl_beam
  travelFlash:
    sprite: _Goobstation/Structures/Machines/PTL/pt_beam.rsi
    state: ptl_beam
  impactFlash:
    sprite: _Goobstation/Structures/Machines/PTL/pt_beam.rsi
    state: ptl_beam
