Files
KickSurvivors/scripts/MergeRecipes.gd
T
2026-04-22 20:15:06 +03:00

26 lines
766 B
GDScript

class_name MergeRecipes
# Add new crafting recipes here.
# speed_threshold = minimum collision_speed to trigger the merge.
static var _list: Array[Dictionary] = [
{
"ingredients": ["leather", "stick"],
"result_scene": "res://scenes/LeatherBoots.tscn",
"speed_threshold": 0.5,
},
{
"ingredients": ["rock", "rock"],
"result_scene": "res://scenes/Boulder.tscn",
"speed_threshold": 5.0,
},
]
static func find(type_a: String, type_b: String, speed: float) -> Dictionary:
for r in _list:
var a: String = r["ingredients"][0]
var b: String = r["ingredients"][1]
var match_ab := (a == type_a and b == type_b) or (a == type_b and b == type_a)
if match_ab and speed >= float(r.get("speed_threshold", 3.0)):
return r
return {}