3d-dice / dice-box-threejs

3D Dice implemented with ThreeJS and Cannon ES
MIT License
32 stars 10 forks source link

It does not return results. #1

Closed GENESISBM closed 2 years ago

GENESISBM commented 2 years ago

If you don't specify the given result values previously, the callback returns an empty result.

Box.roll("2d6@4,4");

The callback is correct. ["4","4"]

Box.roll("2d6");

The callback is wrong. []

It would also be nice if the result came within the object of each die.

frankieali commented 2 years ago

That was a total miss on my part. I've updated the code to create a better result object. It will look like the object below.

{
  "notation": "1d6+1d8+2",
  "sets": [
    {
      "num": 1,
      "type": "d6",
      "sides": 6,
      "rolls": [
        {
          "type": "d6",
          "sides": 6,
          "id": 0,
          "value": 3,
          "label": "3",
          "reason": "natural"
        }
      ],
      "total": 3
    },
    {
      "num": 1,
      "type": "d8",
      "sides": 8,
      "rolls": [
        {
          "type": "d8",
          "sides": 8,
          "id": 1,
          "value": 7,
          "label": "7",
          "reason": "natural"
        }
      ],
      "total": 7
    }
  ],
  "modifier": 2,
  "total": 12
}

npm package updated to version 0.0.6

GENESISBM commented 2 years ago

Thx!!! all fine!