WIP: merge recipies
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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 {}
|
||||
Reference in New Issue
Block a user