Skip to content

Crafting

ManApart edited this page Jan 4, 2023 · 4 revisions

Crafting

Recipes

Recipes take in a set of skills, properties for the required tool, and a set of ingredients. They can be triggered by explicitly crafting a recipe or by using an ingredient on a tool etc. Sliced Apple can be created by craft sliced apple, by use dagger on apple or by slash apple if the ingredients, tools, and skills are all present.

In the case of an Apple Pie, an Apple, Pie Tin and Dough are required. The Apple must have the tag Sliced.

Recipes use a DSL to be dynamic. Using the DSL, we create a recipe, specify that when crafted the verb that will be used to display to the player is "bake", list an ingredient that requires a name and a tag, and two other ingredients that match by name. We specify the required skills and properties needed on the required tool. Finally we give the name of the result item.

recipe("Apple Pie") {
    verb("bake")
    ingredient {
        name("Apple")
        tag("Sliced")
    }
    ingredientNamed("Pie Tin")
    ingredientNamed("Dough")
    skill(COOKING to 2)
    toolProps {
        tag("Range", "Burning")
    }
    result("Apple Pie")
}

In the case of roasted food, we don't know exactly what food we'll be given, because the ingredient doesn't have a name, but we do know it must have the Raw tag.

recipe("Roasted Food") {
    verb("roast")
    skill(COOKING, 1)
    ingredient("Base") {
        tag("Raw")
    }
    toolProps {
        tag("Burning")
    }
    result {
        reference("Base")
        addTag("Roasted")
        removeTag("Raw")
    }
}

In the case of roasted fruit, result is a reference to one of the ingredients (base) and is given the roasted tag and loses the raw tag.

Recipes generally yield a single result, but they can also yield multiple items, like in the case of Dough:

recipe("Dough") {
    verb("mix")
    ingredientNamed("Wheat Flour")
    ingredientNamed("Bucket of Water")
    result("Bucket")
    result("Dough")
}

A couple things to note:

  • All conditions for recipes are AND; all conditions must be met for a recipe to be used.
  • In the above Baked Fruit example you could not re-bake the fruit because Fruit must be Raw and that tag is removed from the result.
  • A recipe without any tool properties can be made without a specific tool.

Clone this wiki locally