RustHacker/crafting/recipe book/recipe_card.gd

34 lines
1.1 KiB
GDScript3
Raw Normal View History

2026-01-12 19:32:35 +11:00
extends PanelContainer
class_name RecipeCard
@export var grid_container : GridContainer
var ingredient_slots : Array[ItemSlot]
@export var output_slot : ItemSlot
2026-01-12 19:55:40 +11:00
@export var output_label : Label
2026-01-12 19:32:35 +11:00
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
ingredient_slots.assign(grid_container.get_children())
#slots.assign(grid.get_children())
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func show_recipe(recipe : CraftRecipe):
ingredient_slots.assign(grid_container.get_children())
for x in range(9):
#if recipe.ingredients[x]:
ingredient_slots[x].item = recipe.ingredients[x]
ingredient_slots[x].update_ui()
ingredient_slots[x].block_taking = true
output_slot.item = recipe.output
2026-01-17 17:07:53 +11:00
#if (PlayerInventory.power_values.has(recipe.output)):
#output_slot.extra_data = "Botnet Power: " + str(PlayerInventory.power_values.get(recipe.output))
2026-01-15 23:10:10 +11:00
2026-01-12 19:32:35 +11:00
output_slot.update_ui()
output_slot.block_taking = true
2026-01-12 19:55:40 +11:00
output_label.text = recipe.output.item_name