# SPDX-FileCopyrightText: 2023 Tom Leys <tom@crump-leys.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 AJCM <AJCM@tutanota.com>
# SPDX-FileCopyrightText: 2024 IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 MilenVolf <63782763+MilenVolf@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 ShadeAware <57020074+ShadeAware@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aidenkrz <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 Ilya246 <57039557+Ilya246@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Ilya246 <ilyukarno@gmail.com>
# SPDX-FileCopyrightText: 2025 gus <august.eymann@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Tables --  Add your new event to this Table if you want it to happen via the basic/ramping schedulers.

- type: entityTable
  id: CargoGiftsTable
  table: !type:GroupSelector # ~~we need to pass a list of rules, since rules have further restrictions to consider via StationEventComp~~ But we arent doing that shit yet, it picks a random one StationEventComp be damned.
    children:
    - id: GiftsEngineering
    - id: GiftsFireProtection
    - id: GiftsJanitor
    - id: GiftsMedical
    - id: GiftsPizzaPartyLarge
    - id: GiftsPizzaPartySmall
    - id: GiftsSecurityGuns
    - id: GiftsSecurityRiot
    - id: GiftsSpacingSupplies
    - id: GiftsVendingRestock

# Game Rules

- type: entity
  id: CargoGiftsBase
  parent: BaseGameRule
  abstract: true
  components:
  - type: GameRule
    delay:
      min: 10
      max: 10
  - type: StationEvent
    startColor: "#18abf5"
    startAudio:
      path: /Audio/Announcements/announce.ogg
  - type: CargoGiftsRule
    sender: cargo-gift-default-sender

- type: entity
  id: GiftsPizzaPartySmall
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 5
    duration: 120
    earliestStart: 20
    chaos: # Goobstation
      Hunger: -80
      Thirst: -40
    eventType: FreeStuff # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -15
  - type: CargoGiftsRule
    description: cargo-gift-pizza-small
    dest: cargo-gift-dest-bar
    gifts:
      FoodPizza: 2              # 8 pizzas
      FoodBarSupply: 1
      FoodSoftdrinks: 2
      CrateVendingMachineRestockRobustSoftdrinks: 1

- type: entity
  id: GiftsPizzaPartyLarge
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 2
    duration: 240
    earliestStart: 20
    minimumPlayers: 40
    chaos: # Goobstation
      Hunger: -300
      Thirst: -120
    eventType: FreeStuff # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -30
  - type: CargoGiftsRule
    description: cargo-gift-pizza-large
    dest: cargo-gift-dest-bar
    gifts:
      FoodPizzaLarge: 1              # 16 pizzas
      FoodBarSupply: 1
      FoodSoftdrinksLarge: 1

- type: entity
  id: GiftsEngineering
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 5
    duration: 240
    earliestStart: 30
    minimumPlayers: 10
    chaos: # Goobstation
      Atmos: -300
      Power: -100
    eventType: FreeStuffUseful # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -40
  - type: CargoGiftsRule
    description: cargo-gift-eng
    dest: cargo-gift-dest-eng
    gifts:
      EngineeringCableBulk: 1
      AirlockKit: 1
      MaterialSteel: 1
      MaterialPlasteel: 1
      MaterialGlass: 1
      CrateVendingMachineRestockEngineering: 1

- type: entity
  id: GiftsVendingRestock
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 4
    duration: 120
    minimumPlayers: 40
    earliestStart: 30
    chaos: # Goobstation
      Hunger: -100
      Thirst: -100
    eventType: FreeStuff # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -20
  - type: CargoGiftsRule
    description: cargo-gift-vending
    dest: cargo-gift-dest-supp
    gifts:
      CrateVendingMachineRestockHotDrinks: 3
      CrateVendingMachineRestockBooze: 1
      CrateVendingMachineRestockNutriMax: 1
      CrateVendingMachineRestockRobustSoftdrinks: 2
      CrateVendingMachineRestockVendomat: 1
      CrateVendingMachineRestockGetmoreChocolateCorp: 1

- type: entity
  id: GiftsJanitor
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 6
    duration: 120
    minimumPlayers: 30
    earliestStart: 20
    chaos: # Goobstation
      Mess: -200
    eventType: FreeStuff # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -20
  - type: CargoGiftsRule
    description: cargo-gift-cleaning
    dest: cargo-gift-dest-janitor
    gifts:
      ServiceJanitorial: 2
      ServiceLightsReplacement: 2
      ServiceJanitorBiosuit: 1

- type: entity
  id: GiftsMedical
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 8
    duration: 120
    earliestStart: 20
    minimumPlayers: 30
    chaos: #Goobstation
      Medical: -200
      Friend: 10
    eventType: FreeStuffUseful # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -40
  - type: CargoGiftsRule
    description: cargo-gift-medical-supply
    dest: cargo-gift-dest-med
    gifts:
      MedicalSupplies: 1
      MedicalChemistrySupplies: 1
      EmergencyBruteKit: 1
      EmergencyAdvancedKit: 1
      MedicalBiosuit: 1

- type: entity
  id: GiftsSpacingSupplies
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 4
    duration: 120
    earliestStart: 10
    minimumPlayers: 40
    chaos: # Goobstation
      Atmos: -300
    eventType: FreeStuffUseful # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -40
  - type: CargoGiftsRule
    description: cargo-gift-space-protection
    dest: cargo-gift-dest-supp
    gifts:
      EmergencyInternalsLarge: 2
      EmergencyInflatablewall: 1
      EmergencyAdvancedKit: 1
      MedicalBiosuit: 1
      EmergencyO2Kit: 1

- type: entity
  id: GiftsFireProtection
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 4
    duration: 120
    earliestStart: 20
    minimumPlayers: 40
    chaos: # Goobstation
      Atmos: -200
    eventType: FreeStuffUseful # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -35
  - type: CargoGiftsRule
    description: cargo-gift-fire-protection
    dest: cargo-gift-dest-supp
    gifts:
      EmergencyFire: 2
      EmergencyBurnKit: 1
      EmergencyBruteKit: 1

- type: entity
  id: GiftsSecurityGuns
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 3
    duration: 120
    earliestStart: 20
    minimumPlayers: 50
    chaos: # Goobstation
      Hostile: -100
      Combat: -100
    eventType: FreeStuffUseful # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -90
  - type: CargoGiftsRule
    description: cargo-gift-security-guns
    dest: cargo-gift-dest-sec
    gifts:
      SecurityArmor: 3
      ArmorySmg: 1
      ArmoryShotgun: 1
      ArmoryLaser: 1
      ArmoryRifle: 1

- type: entity
  id: GiftsSecurityRiot
  parent: CargoGiftsBase
  components:
  - type: StationEvent
    weight: 4
    duration: 120
    earliestStart: 20
    minimumPlayers: 50
    chaos: # Goobstation
      Hostile: -30
      Combat: -30
    eventType: FreeStuffUseful # Goobstation
  # Goobstation
  - type: GameRule
    chaosScore: -80
  - type: CargoGiftsRule
    description: cargo-gift-security-riot
    dest: cargo-gift-dest-sec
    gifts:
      SecurityRiot: 2
      SecurityRestraints: 2
      SecurityNonLethal: 2
      SecurityNonlethalThrowables: 1
