# SPDX-FileCopyrightText: 2020 Exp <theexp111@gmail.com>
# SPDX-FileCopyrightText: 2020 GlassEclipse <tsymall5@gmail.com>
# SPDX-FileCopyrightText: 2020 Hugo Laloge <hugo.laloge@gmail.com>
# SPDX-FileCopyrightText: 2020 Jackson Lewis <inquisitivepenguin@protonmail.com>
# SPDX-FileCopyrightText: 2020 Pieter-Jan Briers <pieterjan.briers@gmail.com>
# SPDX-FileCopyrightText: 2020 Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 py01 <60152240+collinlunn@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 py01 <pyronetics01@gmail.com>
# SPDX-FileCopyrightText: 2021 20kdc <asdd2808@gmail.com>
# SPDX-FileCopyrightText: 2021 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Acruid <shatter66@gmail.com>
# SPDX-FileCopyrightText: 2021 Julian Giebel <j.giebel@netrocks.info>
# SPDX-FileCopyrightText: 2021 Metal Gear Sloth <metalgearsloth@gmail.com>
# SPDX-FileCopyrightText: 2021 Paul <ritter.paul1+git@googlemail.com>
# SPDX-FileCopyrightText: 2021 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2021 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <zddm@outlook.es>
# SPDX-FileCopyrightText: 2021 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2022 EmoGarbage404 <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Jacob Tong <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Moony <moonheart08@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Peptide90 <78795277+Peptide90@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 DrSmugleaf <DrSmugleaf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Morb <14136326+Morb0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 TemporalOroboros <TemporalOroboros@gmail.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Арт <123451459+JustArt1m@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 EmoGarbage404 <retron404@gmail.com>
# SPDX-FileCopyrightText: 2024 Julian Giebel <juliangiebel@live.de>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aviu00 <93730715+Aviu00@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: GravityGenerator
  parent: BaseMachinePowered
  name: gravity generator
  description: It's what keeps you to the floor.
  placement:
    mode: AlignTileAny
  components:
  - type: StationAiWhitelist
  - type: AmbientSound
    enabled: false
    volume: -6
    range: 7
    sound:
      path: /Audio/Ambience/Objects/gravity_gen_hum.ogg
  - type: Sprite
    sprite: Structures/Machines/gravity_generator.rsi
    layers:
      - state: on
        map: ["enum.GravityGeneratorVisualLayers.Base"]
      - sprite: Structures/Machines/gravity_generator_core.rsi
        state: activated
        shader: unshaded
        map: ["enum.GravityGeneratorVisualLayers.Core"]
  - type: Transform
    anchored: true
  - type: ApcPowerReceiver
    powerLoad: 2500
  - type: ExtensionCableReceiver
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-1.5,-1.5,1.5,1.5"
        density: 50
        mask:
        - LargeMobMask
        layer:
        - WallLayer
  - type: Repairable
    fuelCost: 10
    doAfterDelay: 5
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 150
      behaviors:
      - !type:DoActsBehavior
        acts: ["Breakage"]
  - type: PowerCharge
    windowTitle: gravity-generator-window-title
    idlePower: 50
    activePower: 2500
  - type: GravityGenerator
    lightRadiusMin: 0.75
    lightRadiusMax: 2.5
    spriteMap:
      broken: "broken"
      unpowered: "off"
      off: "off"
      on: "on"
  - type: ActivatableUI
    key: enum.PowerChargeUiKey.Key
  - type: ActivatableUIRequiresPower
  - type: UserInterface
    interfaces:
      enum.PowerChargeUiKey.Key:
        type: PowerChargeBoundUserInterface
  - type: Appearance
  - type: PointLight
    radius: 2.5
    energy: 0.5
    # Gravity generator is a large machine, not casting shadows is fine within the radius set above.
    castShadows: false
    color: "#a8ffd9"
  - type: StaticPrice
    price: 5000
  - type: Tag # Goobstation
    tags:
    - Structure
    - IgnoreImmovableRod

- type: entity
  id: GravityGeneratorMini
  parent: [ GravityGenerator, ConstructibleMachine ]
  name: mini gravity generator
  description: It's what keeps you to the floor, now in fun size.
  components:
  - type: StationAiWhitelist
  - type: Sprite
    sprite: Structures/Machines/gravity_generator_mini.rsi
    snapCardinals: true
    layers:
      - state: on
        map: ["enum.GravityGeneratorVisualLayers.Base"]
      - sprite: Structures/Machines/gravity_generator_core.rsi
        state: activated
        shader: unshaded
        map: ["enum.GravityGeneratorVisualLayers.Core"]
        scale: "0.4,0.4"
        offset: "0,0.2"
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.4,-0.4,0.4,0.4"
        density: 3125
        mask:
        - LargeMobMask
        layer:
        - WallLayer
  - type: Destructible
    thresholds:
    - trigger:
        !type:DamageTrigger
        damage: 500
      behaviors:
      - !type:DoActsBehavior
        acts: ["Destruction"]
      - !type:PlaySoundBehavior
        sound:
          collection: MetalGlassBreak
      - !type:SpawnEntitiesBehavior
        spawn:
          MachineFrameDestroyed:
            min: 1
            max: 1
  - type: WiresPanel
  - type: Machine
    board: MiniGravityGeneratorCircuitboard
  - type: ApcPowerReceiver
    powerLoad: 500
  - type: PowerCharge
    idlePower: 15
    activePower: 500
  - type: GravityGenerator
    lightRadiusMin: 0.75
    lightRadiusMax: 2.5
  - type: StaticPrice
    price: 2000
  - type: Tag # Goobstation
    tags:
    - Structure