CraftMaterialIconUI ​
Inherits: HBoxContainer
Enhanced material icon UI with visual feedback for material availability
Variables ​
bool | has_sufficient_materials | true |
int | required_quantity | 1 |
int | available_quantity | 0 |
ItemDefinition | item_definition | null |
Color | normal_modulate | Color.WHITE |
Color | insufficient_modulate | Color(0.5, 0.5, 0.5, 0.8) |
Color | normal_label_color | Color.WHITE |
Color | insufficient_label_color | Color.RED |
Color | sufficient_label_color | Color.GREEN |
Methods ​
void | setup_material_icon( item_def: ItemDefinition, required_qty: int, available_qty: int ) |
void | update_availability( new_available_qty: int ) |
String | get_availability_text() |
bool | is_sufficient() |
int | get_shortage() |
void | apply_hover_effect() |
void | remove_hover_effect() |
Variable descriptions ​
bool has_sufficient_materials = true ​
Material availability state
int required_quantity = 1 ​
How many the recipe needs.
int available_quantity = 0 ​
How many the player has.
ItemDefinition item_definition = null ​
The material.
Color normal_modulate = Color.WHITE ​
Visual states
Color insufficient_modulate = Color(0.5, 0.5, 0.5, 0.8) ​
Greyed out
Color normal_label_color = Color.WHITE ​
The color of the label before it is checked.
Color insufficient_label_color = Color.RED ​
The color of the label when the player has too few.
Color sufficient_label_color = Color.GREEN ​
The color of the label when the player has enough.
Method descriptions ​
void setup_material_icon( item_def: ItemDefinition, required_qty: int, available_qty: int ) ​
Setup the material icon with item data and availability info
void update_availability( new_available_qty: int ) ​
Update availability without changing the item
String get_availability_text() ​
Get formatted display text for tooltips or other UI elements
bool is_sufficient() ​
Check if this material icon represents sufficient materials
int get_shortage() ​
Get the shortage amount if insufficient
void apply_hover_effect() ​
Apply hover effects (optional - can be used with mouse events)
void remove_hover_effect() ​
Remove hover effects