No description, website, or topics provided.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
areas/craft Move scriptless behaviors to metadata Feb 2, 2019
commands Move scriptless behaviors to metadata Feb 2, 2019
data Use json for crafting data Dec 31, 2018
help Initial commit Oct 21, 2018
lib Use json for crafting data Dec 31, 2018
.gitignore Use rando-js Jan 10, 2019
README.md Move scriptless behaviors to metadata Feb 2, 2019
package-lock.json Use rando-js Jan 10, 2019
package.json Use rando-js Jan 10, 2019

README.md

Demonstrative bundle showing how one might implement a crafting system.

Usage

Recipes are defined in 'data/recipes.json' like so:

[
  {
    // the item this recipe will generate
    "item": "limbo:potionhealth1",
    // recipe defines the resources needed and their amounts
    "recipe": {
      "plant_material": 3,
      "rose_petal": 1
    }
  }
]

Resources for recipes are defined next to recipes in data/resources.json

{
  "plant_material": {
    "title": "Plant Material",
    "quality": "common"
  },
  "rose_petal": {
    "title": "Rose Petal",
    "quality": "uncommon"
  }
}

For a player to get resources you create an item for them to use the gather command on:

- id: greenplant
  name: "Green Plant"
  type: RESOURCE
  roomDesc: "Green Plant"
  keywords: [ "green", "plant", "resource" ]
  metadata:
    noPickup: true
    # configures if and what happens when this resource is gathered
    resource:
      # flavor message displayed to the user after gathering
      depletedMessage: "withers, having been stripped of usable materials."
      # which materials you get and their rannge. `gather` will pick a random
      # amount from this range
      materials:
        plant_material:
          min: 1
          max: 3