CraftingRecipeDefinition ​
Inherits: DatabaseResource < Resource
Definition for a crafting recipe that can be executed multiple times Uses ItemDefinition references and integrates with the database system
Properties ​
int | item_id | 0 |
int | output_quantity | 1 |
float | craft_duration | 5.0 |
Dictionary | craft_materials | {} |
int | craft_school_id | -1 |
String | recipe_category | "" |
int | required_skill_level | 1 |
int | skill_points_per_craft | 1 |
int | skill_up_until | 0 |
CalculationFormula | skill_up_curve | |
Array[Requirement] | requirements | [] |
bool | requires_learning | false |
Methods ​
Dictionary | can_craft( crafter: Entity, craft_school_instance: CraftSchoolInstance ) |
ItemDefinition | get_craft_item() |
Texture2D | get_display_icon() |
String | get_display_name() |
Array | get_materials_display() |
float | get_skill_up_factor( skill_level: int ) |
float | skill_up_factor( from_level: int, until_level: int, curve: CalculationFormula, skill_level: int ) static |
SkillBand | get_skill_band( skill_level: int ) |
float | calculate_craft_duration( crafter: Entity, craft_school_instance: CraftSchoolInstance ) |
Enumerations ​
enum SkillBand ​
The colour band of the recipe for a crafter of this skill level, for the interface: NONE for a recipe with no range, else ORANGE (teaches well), YELLOW, GREEN (teaches little), GREY (teaches nothing)
- NONE =
0 - ORANGE =
1 - YELLOW =
2 - GREEN =
3 - GREY =
4
Property descriptions ​
int item_id = 0 ​
The item definition that will be created when this recipe is executed
int output_quantity = 1 ​
How many of the item will be created per craft
float craft_duration = 5.0 ​
Base time in seconds to complete this craft
Dictionary craft_materials = ​
Dictionary mapping ItemDefinition -> required quantity Use ItemDefinition directly for better type safety and editor integration
int craft_school_id = -1 ​
Which craft school this recipe belongs to
String recipe_category = "" ​
Sub-category within the school (e.g., "Weapons", "Armor", "Tools")
int required_skill_level = 1 ​
Minimum skill level required in the craft school
int skill_points_per_craft = 1 ​
Skill points awarded when this recipe is successfully crafted
int skill_up_until = 0 ​
The level at which the recipe stops teaching anything (the "grey" level): from there a craft gives no skill. 0 = it never stops, as before
CalculationFormula skill_up_curve ​
How much the recipe teaches inside its range: a formula that gets the position in the range (0 at the level the recipe needs, 1 at the level where it stops teaching) and gives a factor from 0 to 1. Empty = 1 at the start, falling in a straight line to 0 at the end. A step curve makes the coloured bands
Array[Requirement] requirements = [] ​
Additional requirements (could be quest completion, reputation, etc.)
bool requires_learning = false ​
Whether this recipe is known from the start or must be learned
Method descriptions ​
Dictionary can_craft( crafter: Entity, craft_school_instance: CraftSchoolInstance ) ​
Check if an entity can craft this recipe
ItemDefinition get_craft_item() ​
Get the craftable item
Texture2D get_display_icon() ​
Get icon to display for this recipe
String get_display_name() ​
Get display name, falling back to item name if empty
Array get_materials_display() ​
Get formatted materials list for UI display
float get_skill_up_factor( skill_level: int ) ​
How well the recipe teaches a crafter of this skill level: 0 (nothing: it is too easy) to 1 (everything). 1 for a recipe with no range
float skill_up_factor( from_level: int, until_level: int, curve: CalculationFormula, skill_level: int ) ​
The same for any activity that teaches a profession (a recipe, a gathering node): it starts at from_level, teaches nothing from until_level on (0 = never stops) and follows curve in between (empty = a straight line down)
SkillBand get_skill_band( skill_level: int ) ​
The band of difficulty of the recipe for a skill level (it may give skill up, or not).
float calculate_craft_duration( crafter: Entity, craft_school_instance: CraftSchoolInstance ) ​
Calculate actual craft duration(could be modified by skill level, buffs, etc.)