# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 ThunderBear2006 <100388962+ThunderBear2006@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 brainfood1183 <113240905+brainfood1183@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Errant <35878406+Errant-4@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2025 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 botanySupremist <160211017+botanySupremist@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 botanySupremist <definitelyrealBotSupremist@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: RandomAnomalySpawner
  name: random anomaly spawner
  parent: MarkerBase
  components:
  - type: Sprite
    layers:
    - state: red
    - sprite: Structures/Specific/anomaly.rsi
      state: anom1
  - type: EntityTableSpawner # Goobstation: adding individual anomaly weights
    #chance: 1
    table: !type:NestedSelector
      tableId: RandomAnomalyTable
    offset: 0.15 # not to put it higher. The anomaly sychnronizer looks for anomalies within this radius, and if the radius is higher, the anomaly can be attracted from a neighboring tile.

- type: entityTable
  id: RandomAnomalyTable
  table: !type:GroupSelector
    children:
    - id: AnomalyPyroclastic
    - id: AnomalyGravity
    - id: AnomalyElectricity
    - id: AnomalyFlesh
    - id: AnomalyBluespace
    - id: AnomalyIce
    - id: RandomRockAnomalySpawner
    - id: AnomalyLiquid
    - id: AnomalyFlora
    - id: AnomalyShadow
    - id: AnomalyTech
    - id: AnomalySanta
      weight: .4 #  Make more common in december
    - id: RandomAnomalyInjectorSpawner # formerly rareChance 0.3, 30% chance of spawning. keep similar
      weight: 3.97 # (1/12*3.97)-(0.4/13) is very close to 30%

- type: entity
  id: RandomRockAnomalySpawner
  name: random rock anomaly spawner
  parent: MarkerBase
  components:
  - type: Sprite
    layers:
    - state: red
    - sprite: Structures/Specific/anomaly.rsi
      state: anom6
  - type: RandomSpawner
    prototypes:
    - AnomalyRockIron
    - AnomalyRockCoal
    - AnomalyRockSilver
    - AnomalyRockGold
    - AnomalyRockQuartz
    - AnomalyRockUranium
    - AnomalyRockBananium
    chance: 1
    offset: 0.15

- type: entity
  id: RandomAnomalyInjectorSpawner
  name: random anomaly injector spawner
  parent: MarkerBase
  components:
  - type: Sprite
    layers:
    - state: red
    - sprite: Structures/Specific/Anomalies/tech_anom.rsi
      state: pulse
  - type: EntityTableSpawner # Goobstation: adding individual anomaly weights
    table: !type:NestedSelector
      tableId: RandomAnomalyInjectorTable

- type: entityTable
  id: RandomAnomalyInjectorTable
  table: !type:GroupSelector
    children:
    - id: AnomalyTrapPyroclastic
    - id: AnomalyTrapElectricity
    - id: AnomalyTrapShadow
    - id: AnomalyTrapIce
    - id: AnomalyTrapFlora
    - id: AnomalyTrapBluespace
    - id: AnomalyTrapFlesh
    - id: AnomalyTrapGravity
    - id: AnomalyTrapTech
    - id: AnomalyTrapRock
    - id: AnomalyTrapSanta # Make more common in December
      weight: .4
