unpushed changes
This commit is contained in:
parent
d9e676b9c5
commit
44e39ded34
10 changed files with 18 additions and 7 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -83,7 +83,7 @@ _subresources={
|
|||
"generate/shadow_meshes": 0,
|
||||
"lods/normal_merge_angle": 20.0,
|
||||
"save_to_file/enabled": true,
|
||||
"save_to_file/fallback_path": "res://assets/meshes/Chemistry_Sphere_003.res",
|
||||
"save_to_file/fallback_path": "res://assets/meshes/big_flask_fill.res",
|
||||
"save_to_file/path": "uid://q71x8vx4dkis"
|
||||
},
|
||||
"Chemistry_Sphere_004": {
|
||||
|
|
@ -92,7 +92,7 @@ _subresources={
|
|||
"generate/shadow_meshes": 0,
|
||||
"lods/normal_merge_angle": 20.0,
|
||||
"save_to_file/enabled": true,
|
||||
"save_to_file/fallback_path": "res://assets/meshes/Chemistry_Sphere_004.res",
|
||||
"save_to_file/fallback_path": "res://assets/meshes/big_flask.res",
|
||||
"save_to_file/path": "uid://bsigmbc20m6pn"
|
||||
},
|
||||
"Chemistry_Sphere_005": {
|
||||
|
|
@ -101,7 +101,7 @@ _subresources={
|
|||
"generate/shadow_meshes": 0,
|
||||
"lods/normal_merge_angle": 20.0,
|
||||
"save_to_file/enabled": true,
|
||||
"save_to_file/fallback_path": "res://assets/meshes/Chemistry_Sphere_005.res",
|
||||
"save_to_file/fallback_path": "res://assets/meshes/spoon_fill.res",
|
||||
"save_to_file/path": "uid://n4ibk6y8t7h3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,4 +108,7 @@ func recalculate_temperature() -> void:
|
|||
mean_temperature = temperature_sum / len(inventory)
|
||||
|
||||
func check_for_reactions() -> void:
|
||||
pass
|
||||
print(ReactionRegistry.find_appropriate_reaction(inventory.values().map(runtime_to_substance),mean_temperature))
|
||||
|
||||
func runtime_to_substance(sub: RuntimeSubstanceData) -> Substance:
|
||||
return sub.substance
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ func _ready() -> void:
|
|||
for file in ResourceLoader.list_directory(REACTIONS_DIRECTORY):
|
||||
reactions.append(load(REACTIONS_DIRECTORY + file))
|
||||
|
||||
func react(input_substances: Array[Substance], temperature: float) -> Array[Substance]:
|
||||
func find_appropriate_reaction(input_substances: Array[Substance], temperature: float) -> Reaction:
|
||||
var filter_func: Callable = func(reaction: Reaction) -> bool:
|
||||
if reaction.reaction_temperature != -1:
|
||||
return (reaction.input_substances == input_substances) and temperature >= reaction.reaction_temperature
|
||||
|
|
@ -18,6 +18,6 @@ func react(input_substances: Array[Substance], temperature: float) -> Array[Subs
|
|||
var filtered: Array[Reaction] = reactions.filter(filter_func)
|
||||
|
||||
if len(filtered) > 0:
|
||||
return filtered[0].output_substances.duplicate()
|
||||
return filtered[0]
|
||||
else:
|
||||
return []
|
||||
return null
|
||||
|
|
|
|||
|
|
@ -5,3 +5,11 @@ class_name Reaction
|
|||
@export var input_substances: Array[ReactionSubstance]
|
||||
@export var output_substances: Array[ReactionSubstance]
|
||||
@export var reaction_temperature: float = -1
|
||||
|
||||
func input_substances_dict() -> Dictionary[StringName, ReactionSubstance]:
|
||||
var result = {}
|
||||
|
||||
for el in input_substances:
|
||||
result[el.substance.scientific_name] = el
|
||||
|
||||
return result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue