# SPDX-FileCopyrightText: 2024 Aidenkrz <aiden@djkraz.com>
# SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Flareguy <78941145+Flareguy@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 brainfood1183 <113240905+brainfood1183@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 plykiya <plykiya@protonmail.com>
# SPDX-FileCopyrightText: 2024 slarticodefast <161409025+slarticodefast@users.noreply.github.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  id: MobSpawnCrabQuartz
  name: mobspawner quartzcrab
  categories: [ HideSpawnMenu, Spawner ]
  components:
  - type: Transform
    anchored: True
  - type: InteractionOutline
  - type: Physics
    bodyType: Static
  - type: Sprite
    sprite: /Textures/Effects/mobspawn.rsi
    state: crab_quartz
  - type: Fixtures
    fixtures:
      portalFixture:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.25,-0.48,0.25,0.48"
        mask:
        - FullTileMask
        layer:
        - WallLayer
        hard: false
  - type: TimedDespawn
    lifetime: 2.1
  - type: SpawnOnDespawn
    prototype: MobQuartzCrab

- type: entity
  id: MobSpawnCrabIron
  parent: MobSpawnCrabQuartz
  name: mobspawner ironcrab
  categories: [ HideSpawnMenu, Spawner ]
  components:
  - type: Sprite
    sprite: /Textures/Effects/mobspawn.rsi
    state: crab_iron
  - type: SpawnOnDespawn
    prototype: MobIronCrab

- type: entity
  id: MobSpawnCrabCoal
  parent: MobSpawnCrabQuartz
  name: mobspawner coalcrab
  categories: [ HideSpawnMenu, Spawner ]
  components:
  - type: Sprite
    sprite: /Textures/Effects/mobspawn.rsi
    state: crab_coal
  - type: SpawnOnDespawn
    prototype: MobCoalCrab

- type: entity
  id: MobSpawnCrabSilver
  parent: MobSpawnCrabQuartz
  name: mobspawner silvercrab
  categories: [ HideSpawnMenu, Spawner ]
  components:
  - type: Sprite
    sprite: /Textures/Effects/mobspawn.rsi
    state: crab_silver
  - type: SpawnOnDespawn
    prototype: MobSilverCrab

- type: entity
  id: MobSpawnCrabGold
  parent: MobSpawnCrabQuartz
  name: mobspawner goldcrab
  categories: [ HideSpawnMenu, Spawner ]
  components:
  - type: Sprite
    sprite: /Textures/Effects/mobspawn.rsi
    state: crab_gold
  - type: SpawnOnDespawn
    prototype: MobGoldCrab

- type: entity
  id: MobSpawnCrabUranium
  parent: MobSpawnCrabQuartz
  name: mobspawner uraniumcrab
  categories: [ HideSpawnMenu, Spawner ]
  components:
  - type: Sprite
    sprite: /Textures/Effects/mobspawn.rsi
    state: crab_uranium
  - type: SpawnOnDespawn
    prototype: MobUraniumCrab

- type: entity
  id: MobSpawnCrabBananium
  parent: MobSpawnCrabQuartz
  name: mobspawner bananiumcrab
  categories: [ HideSpawnMenu, Spawner ]
  components:
  - type: Sprite
    sprite: /Textures/Effects/mobspawn.rsi
    state: crab_bananium
  - type: SpawnOnDespawn
    prototype: MobBananiumCrab

- type: entity
  id: EffectAnomalyFloraBulb
  categories: [ HideSpawnMenu ]
  components:
  - type: TimedDespawn
    lifetime: 0.4
  - type: Sprite
    drawdepth: Effects
    noRot: true
    layers:
      - shader: unshaded
        map: ["enum.EffectLayers.Unshaded"]
        sprite: Effects/emp.rsi
        state: emp_disable
  - type: EffectVisuals
  - type: Tag
    tags:
      - HideContextMenu
  - type: AnimationPlayer
  - type: EntityTableSpawner
    deleteSpawnerAfterSpawn: false
    table: !type:NestedSelector
      tableId: AnomalyFloraLootTable

- type: entityTable
  id: AnomalyFloraLootTable
  table: !type:GroupSelector
    children:
    - id: FoodAmbrosiaVulgaris
    - id: FoodAloe
    - id: FoodCabbage
    - id: FoodGalaxythistle
    - id: FoodLemon
    - id: FoodLime
    - id: FoodPeaPod
    - id: FoodPineapple
    - id: FoodOnionRed
    - id: FoodWatermelon
    - id: FoodCherry
    - id: MobTomatoKiller
    - id: MobLuminousEntity
    - id: MobLuminousObject
    - id: FoodGatfruit # 0.007% spawn chance. 1 / 141
      weight: 0.10
