mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 12:04:06 +09:00
simplified crafting recipe definition
This commit is contained in:
@@ -1,39 +1,42 @@
|
|||||||
Multiple JSON files can exist under this directory.
|
Multiple JSON files can exist under this directory.
|
||||||
|
|
||||||
### Ingredient Querying Language
|
### Workbenches
|
||||||
|
|
||||||
An ingredient can refer one exact item or items that matches the conditions.
|
Some items can only be manufactured on certain workbenches. Every workbench has tags assigned and checked against
|
||||||
|
this property.
|
||||||
|
|
||||||
To specify single exact item:
|
Multiple workbenches are separated by commas, and alternative workbenches are separated by semicolons.
|
||||||
|
|
||||||
ID IS item@basegame:1
|
### Ingredient Querying
|
||||||
|
|
||||||
To specify using tags:
|
Ingredients are defined as list of records. Multiple records denotes multiple alternative recipes, whereas
|
||||||
|
entries in a record denote multiple ingredients the recipe requires.
|
||||||
|
|
||||||
TAG HASALLOF a_tag,b_tag,c_tag OR TAG IS s_tag
|
Example:
|
||||||
TAG IS one_tag
|
|
||||||
TAG HASALLOF a_tag,b_tag
|
|
||||||
|
|
||||||
The query can have one or more terms. The terms are always either one of:
|
```
|
||||||
|
"ingredients": [
|
||||||
|
[2, 1, "$WOOD", 1, "$ROCK"],
|
||||||
|
[20, 1, "ITEM_PLATFORM_BUILDING_KIT"]
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
TERM OPERATOR TERM
|
Each entry is interpreted as:
|
||||||
TAG_LITERAL
|
|
||||||
|
|
||||||
Since "TAG" is a valid term to operate against, said word can frequently appear for complex queries.
|
```[moq, count 1, ingredient 1, count 2, ingredient 2, ...]```
|
||||||
|
|
||||||
#### List of Operators
|
- moq: this item combination creates this amount of items.
|
||||||
|
|
||||||
- IS : Exactly this
|
For example:
|
||||||
- HASALLOF : Has all of these
|
|
||||||
- HASSOMEOF : Has one or more of these
|
|
||||||
- HASNONEOF : Has none of these
|
|
||||||
- ISNOT : Exactly not this
|
|
||||||
- AND : Both left and right terms are truthy
|
|
||||||
- OR : One or more hands are truthy
|
|
||||||
- , : Creates an array containing two or more words separated by this operator
|
|
||||||
|
|
||||||
#### List of Predefined Operands
|
```[2, 1, "$WOOD", 1, "$ROCK"]```
|
||||||
|
|
||||||
- TAG : Tags assigned to the blocks or items
|
This line is interpreted as: this item requires 1 tagged-as-wood ingredient and 1 tagged-as-rock ingredient,
|
||||||
- ID : Item ID
|
and returns 2 of manufactured items.
|
||||||
|
|
||||||
|
```[20, 1, "ITEM_PLATFORM_BUILDING_KIT"]```
|
||||||
|
|
||||||
|
This line is interpreted as: this item requires 1 verbatim item "ITEM_PLATFORM_BUILDING_KIT" and returns
|
||||||
|
20 of manufactured items.
|
||||||
|
|
||||||
|
Therefore, the single record has at least three items and always has odd number of items.
|
||||||
@@ -2,8 +2,7 @@
|
|||||||
"basegame:176": { /* A recipe for Wooden Platform */
|
"basegame:176": { /* A recipe for Wooden Platform */
|
||||||
"workbench": "", /* Optional workbench TAGS separated by commas (e.g. smelter, saw) */
|
"workbench": "", /* Optional workbench TAGS separated by commas (e.g. smelter, saw) */
|
||||||
"ingredients": [ /* Multiple ingredients denotes alternative recipes */
|
"ingredients": [ /* Multiple ingredients denotes alternative recipes */
|
||||||
[1, "tag is WOOD"] /* This recipe only requires one Wooden Plank */
|
[2, 1, "$WOOD", 1, "$ROCK"] /* This recipe only requires one Wooden Plank */
|
||||||
],
|
]
|
||||||
"moq": 2 /* Number of products per unit ingredients */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user