# SPDX-FileCopyrightText: 2024 12rabbits <53499656+12rabbits@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Alzore <140123969+Blackern5000@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 August Sun <45527070+august-sun@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 AutoOtter <joshuademorris@gmail.com>
# SPDX-FileCopyrightText: 2024 Brandon Hu <103440971+Brandon-Huu@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 DieselMohawk <gavin.drinka@gmail.com>
# SPDX-FileCopyrightText: 2024 Dimastra <65184747+Dimastra@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Dimastra <dimastra@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Emisse <99158783+Emisse@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Eoin Mcloughlin <helloworld@eoinrul.es>
# SPDX-FileCopyrightText: 2024 Errant <35878406+Errant-4@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 JIPDawg <51352440+JIPDawg@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 JIPDawg <JIPDawg93@gmail.com>
# SPDX-FileCopyrightText: 2024 JustCone <141039037+JustCone14@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Mervill <mervills.email@gmail.com>
# SPDX-FileCopyrightText: 2024 MisterMecky <mrmecky@hotmail.com>
# SPDX-FileCopyrightText: 2024 Moomoobeef <62638182+Moomoobeef@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 PJBot <pieterjan.briers+bot@gmail.com>
# SPDX-FileCopyrightText: 2024 Partmedia <kevinz5000@gmail.com>
# SPDX-FileCopyrightText: 2024 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2024 Pieter-Jan Briers <pieterjan.briers@gmail.com>
# SPDX-FileCopyrightText: 2024 Piras314 <p1r4s@proton.me>
# SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 PopGamer46 <yt1popgamer@gmail.com>
# SPDX-FileCopyrightText: 2024 PursuitInAshes <pursuitinashes@gmail.com>
# SPDX-FileCopyrightText: 2024 QueerNB <176353696+QueerNB@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 RumiTiger <154005209+RumiTiger@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Saphire Lattice <lattice@saphi.re>
# SPDX-FileCopyrightText: 2024 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Simon <63975668+Simyon264@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Spessmann <156740760+Spessmann@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2024 Thomas <87614336+Aeshus@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Unisol <1929445+Unisol@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Winkarst <74284083+Winkarst-cpu@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 august-sun <45527070+august-sun@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 august-sun <45527070+august.sun@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 beck-thompson <107373427+beck-thompson@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 coolboy911 <85909253+coolboy911@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org>
# SPDX-FileCopyrightText: 2024 eoineoineoin <github@eoinrul.es>
# SPDX-FileCopyrightText: 2024 github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lunarcomets <140772713+lunarcomets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2024 nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 osjarw <oskariwjarvinen@gmail.com>
# SPDX-FileCopyrightText: 2024 plykiya <plykiya@protonmail.com>
# SPDX-FileCopyrightText: 2024 saintmuntzer <47153094+saintmuntzer@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 slarticodefast <161409025+slarticodefast@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 stellar-novas <stellar_novas@riseup.net>
# SPDX-FileCopyrightText: 2024 themias <89101928+themias@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 yglop <95057024+yglop@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aidenkrz <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2025 Aviu00 <93730715+Aviu00@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Comet.Void <80859724+CometVoid@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 CometVoid <cometsstrile@gmail.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 SX-7 <sn1.test.preria.2002@gmail.com>
# SPDX-FileCopyrightText: 2025 gus <august.eymann@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
## Event Tables

- type: entityTable
  id: MeteorSwarmDustEventsTable
  table: !type:AllSelector # we need to pass a list of rules, since rules have further restrictions to consider via StationEventComp
    children:
    - id: GameRuleSpaceDustMinor
    - id: GameRuleSpaceDustMajor

- type: entityTable
  id: MeteorSwarmSmallChanceEventsTable
  table: !type:AllSelector # we need to pass a list of rules, since rules have further restrictions to consider via StationEventComp
    children:
    - id: GameRuleMeteorSwarmSmall
      prob: 0.15

- type: entityTable
  id: MeteorSwarmMildTable
  table: !type:AllSelector # we need to pass a list of rules, since rules have further restrictions to consider via StationEventComp
    children:
    - !type:NestedSelector
        tableId: MeteorSwarmDustEventsTable
    - !type:NestedSelector
        tableId: MeteorSwarmSmallChanceEventsTable

- type: entityTable
  id: BasicMeteorSwarmEventsTable
  table: !type:AllSelector # we need to pass a list of rules, since rules have further restrictions to consider via StationEventComp
    children:
    - !type:NestedSelector
        tableId: MeteorSwarmDustEventsTable
    - id: GameRuleMeteorSwarmSmall
    - id: GameRuleMeteorSwarmMedium
    - id: GameRuleMeteorSwarmLarge
    - id: GameRuleUristSwarm
    - id: ImmovableRodSpawn

- type: weightedRandomEntity
  id: MeteorSpawnAsteroidWallTable
  weights:
    MeteorRock: 10
    MeteorRockCoal: 5
    MeteorRockQuartz: 5
    MeteorRockTin: 5
    MeteorRockSilver: 2
    MeteorRockGold: 2
    MeteorRockPlasma: 2
    MeteorRockDiamond: 2
    MeteorRockUranium: 0.5
    MeteorRockBananium: 0.5
    MeteorRockBSCrystal: 0.5 # Goobstation

## Event Schedulers

- type: entity
  parent: BaseGameRule
  id: MeteorSwarmScheduler
  components:
  - type: GameRule
  - type: BasicStationEventScheduler
    minimumTimeUntilFirstEvent: 600 # 10 min
    minMaxEventTiming:
      min: 300 # 5 min - Goob Edit
      max: 5400 # 90 min - Goob Edit
    scheduledGameRules: !type:NestedSelector
      tableId: BasicMeteorSwarmEventsTable

- type: entity
  parent: BaseGameRule
  id: MeteorSwarmMildScheduler
  components:
  - type: GameRule
  - type: BasicStationEventScheduler
    minimumTimeUntilFirstEvent: 600 # 10 min
    minMaxEventTiming:
      min: 300 # 5 min - Goob Edit
      max: 5400 # 90 min - Goob Edit
    scheduledGameRules: !type:NestedSelector
      tableId: MeteorSwarmMildTable

- type: entity
  parent: BaseGameRule
  id: KesslerSyndromeScheduler
  components:
  - type: GameRule
  - type: RampingStationEventScheduler
    scheduledGameRules: !type:NestedSelector
      tableId: BasicMeteorSwarmEventsTable

## Game Rules

- type: entity
  parent: BaseGameRule
  id: GameRuleMeteorSwarm
  abstract: true
  components:
  - type: GameRule
  - type: StationEvent
    reoccurrenceDelay: 1
    earliestStart: 12
    minimumPlayers: 25
  - type: MeteorSwarm

- type: entity
  parent: GameRuleMeteorSwarm
  id: GameRuleSpaceDustMinor
  components:
  - type: StationEvent
    weight: 44
    earliestStart: 2
    minimumPlayers: 0
    chaos: # Goobstation
      Power: 10
      Atmos: 10
  - type: MeteorSwarm
    announcement: null
    announcementSound: null
    nonDirectional: true
    meteors:
      MeteorSpaceDust: 1
    waves:
      min: 2
      max: 3
    meteorsPerWave:
      min: 3
      max: 5

- type: entity
  parent: GameRuleMeteorSwarm
  id: GameRuleSpaceDustMajor
  components:
  - type: StationEvent
    weight: 22
    minimumPlayers: 0
    chaos: # Goobstation
      Power: 25
      Atmos: 25
  - type: MeteorSwarm
    announcement: station-event-space-dust-start-announcement
    announcementSound: /Audio/Announcements/attention.ogg
    nonDirectional: true
    meteors:
      MeteorSpaceDust: 1
    waves:
      min: 2
      max: 3
    meteorsPerWave:
      min: 8
      max: 12

- type: entity
  parent: GameRuleMeteorSwarm
  id: GameRuleMeteorSwarmSmall
  components:
  - type: StationEvent
    weight: 18
    minimumPlayers: 15
    chaos: # Goobstation
      Power: 40
      Atmos: 40
  - type: MeteorSwarm
    meteors:
      MeteorSmall: 7
      MeteorMedium: 3

- type: entity
  parent: GameRuleMeteorSwarm
  id: GameRuleMeteorSwarmMedium
  components:
  - type: StationEvent
    weight: 10
    chaos: # Goobstation
      Power: 50
      Atmos: 50
  - type: MeteorSwarm
    meteors:
      MeteorSmall: 3
      MeteorMedium: 6
      MeteorLarge: 1

- type: entity
  parent: GameRuleMeteorSwarm
  id: GameRuleMeteorSwarmLarge
  components:
  - type: StationEvent
    weight: 5
    chaos: # Goobstation
      Power: 60
      Atmos: 60
  - type: MeteorSwarm
    meteors:
      MeteorSmall: 2
      MeteorMedium: 4
      MeteorLarge: 4

- type: entity
  parent: GameRuleMeteorSwarm
  id: GameRuleUristSwarm
  components:
  - type: StationEvent
    weight: 0.05
  - type: MeteorSwarm
    announcement: station-event-meteor-urist-start-announcement
    announcementSound: /Audio/Announcements/attention.ogg
    meteors:
      MeteorUrist: 1
    waves:
      min: 3
      max: 3
    meteorsPerWave:
      min: 10
      max: 10

- type: entity
  id: ImmovableRodSpawn
  parent: BaseGameRule
  components:
  - type: StationEvent
    startAnnouncement: station-event-immovable-rod-start-announcement
    startAudio:
      path: /Audio/Announcements/attention.ogg
    weight: 3.5
    reoccurrenceDelay: 1
    duration: 1
    earliestStart: 30
    minimumPlayers: 25
    chaos: # Goobstation
      Power: 100
      Atmos: 100
  - type: ImmovableRodRule
    rodPrototypes:
    - id: ImmovableRodKeepTiles
      prob: 0.94
      orGroup: rodProto
    - id: ImmovableRodMop
      prob: 0.0075
      orGroup: rodProto
    - id: ImmovableRodShark
      prob: 0.0075
      orGroup: rodProto
    - id: ImmovableRodClown
      prob: 0.0075
      orGroup: rodProto
    - id: ImmovableRodBanana
      prob: 0.0075
      orGroup: rodProto
    - id: ImmovableRodHammer
      prob: 0.0075
      orGroup: rodProto
    - id: ImmovableRodThrongler
      prob: 0.0075
      orGroup: rodProto
    - id: ImmovableRodGibstick
      prob: 0.0075
      orGroup: rodProto
    - id: ImmovableRodWeh
      prob: 0.0075
      orGroup: rodProto
