# SPDX-FileCopyrightText: 2019 Swept <49448379+SweptWasTaken@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 ALMv1 <70581577+ALMv1@users.noreply.github.com>
# SPDX-FileCopyrightText: 2020 Hugo Laloge <hugo.laloge@gmail.com>
# SPDX-FileCopyrightText: 2020 Paul Ritter <ritter.paul1@googlemail.com>
# SPDX-FileCopyrightText: 2020 Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Swept <sweptwastaken@protonmail.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
# SPDX-FileCopyrightText: 2021 Vera Aguilera Puerto <gradientvera@outlook.com>
# SPDX-FileCopyrightText: 2022 Fishfish458 <47410468+Fishfish458@users.noreply.github.com>
# SPDX-FileCopyrightText: 2022 Kara <lunarautomaton6@gmail.com>
# SPDX-FileCopyrightText: 2022 fishfish458 <fishfish458>
# SPDX-FileCopyrightText: 2023 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
# SPDX-FileCopyrightText: 2023 Tayrtahn <tayrtahn@gmail.com>
# SPDX-FileCopyrightText: 2023 lzk <124214523+lzk228@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 AJCM-git <60196617+AJCM-git@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Adeinitas <147965189+adeinitas@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 Plykiya <plykiya@protonmail.com>
# SPDX-FileCopyrightText: 2024 Timemaster99 <57200767+Timemaster99@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 VMSolidus <evilexecutive@gmail.com>
# SPDX-FileCopyrightText: 2024 Verm <32827189+Vermidia@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 degradka <69397649+degradka@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
# SPDX-FileCopyrightText: 2024 metalgearsloth <comedian_vs_clown@hotmail.com>
# SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- type: entity
  abstract: true
  parent: BaseItem
  id: BaseDice
  components:
  - type: Dice
  - type: UseDelay
  - type: Sprite
    sprite: Objects/Fun/dice.rsi
    noRot: true # If their sprites rotate, the number becomes even more illegible than usual.
  - type: Tag
    tags:
    - Dice
  - type: Item
    size: Tiny

- type: entity
  parent: BaseDice
  id: PercentileDie
  name: percentile die
  description: A die with ten sides. Works better for d100 rolls than a golf ball.
  components:
  - type: Dice
    sides: 10
    multiplier: 10
    offset: 1 # first side is a 0
    currentValue: 0
  - type: Sprite
    state: percentile_0

- type: entity
  parent: BaseDice
  id: d20Dice
  name: d20
  description: A die with twenty sides. The preferred die to throw at the GM.
  components:
  - type: Dice
    sides: 20
    currentValue: 20
  - type: Sprite
    state: d20_20

- type: entity
  parent: BaseDice
  id: d12Dice
  name: d12
  description: A die with twelve sides. There's an air of neglect about it.
  components:
  - type: Dice
    sides: 12
    currentValue: 12
  - type: Sprite
    state: d12_12

- type: entity
  parent: BaseDice
  id: d10Dice
  name: d10
  description: A die with ten sides. Useful for percentages.
  components:
  - type: Dice
    sides: 10
    offset: 1
    currentValue: 0
  - type: Sprite
    state: d10_0

- type: entity
  parent: BaseDice
  id: d8Dice
  name: d8
  description: A die with eight sides. It feels... lucky.
  components:
  - type: Dice
    sides: 8
    currentValue: 8
  - type: Sprite
    state: d8_8

- type: entity
  parent: BaseDice
  id: d6Dice
  name: d6
  description: A die with six sides. Basic and serviceable.
  components:
  - type: Dice
    sides: 6
    currentValue: 6
  - type: Sprite
    state: d6_6

- type: entity
  parent: BaseDice
  id: d4Dice
  name: d4
  description: A die with four sides. The nerd's caltrop.
  components:
  - type: Dice
    sides: 4
    currentValue: 4
  - type: Sprite
    state: d4_4
  - type: CollisionWake
    enabled: false
  - type: Fixtures
    fixtures:
      slips:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.2,-0.2,0.2,0.2"
        hard: false
        layer:
        - LowImpassable
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-0.2,-0.2,0.2,0.2"
        density: 30
        mask:
        - ItemMask
  - type: StepTrigger
    intersectRatio: 0.2
    triggerGroups: # Goobstation
      types:
      - Shard
  - type: TriggerOnStepTrigger
  - type: PreventableStepTrigger
  - type: Slippery
    slipSound:
      path: /Audio/Effects/glass_step.ogg
    slipData:
      launchForwardsMultiplier: 0
  - type: DamageUserOnTrigger
    damage:
      types:
        Piercing: 5
    # I love this