feat: first functioning state of GOAP implementation

This commit is contained in:
Sara 2024-03-27 01:22:31 +01:00
parent dfe6349c76
commit fdfde706e0
9 changed files with 218 additions and 44 deletions

6
godot/new_goal.tres Normal file
View file

@ -0,0 +1,6 @@
[gd_resource type="Goal" format=3 uid="uid://ogtaubr23l5x"]
[resource]
goal_state = {
"goal": true
}

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://dpda341t6ipiv"]
[gd_scene load_steps=10 format=3 uid="uid://dpda341t6ipiv"]
[sub_resource type="Curve" id="Curve_7rmf4"]
min_value = 0.2
@ -18,7 +18,42 @@ albedo_color = Color(0.94902, 0.909804, 0, 1)
[sub_resource type="BoxMesh" id="BoxMesh_f5yvh"]
size = Vector3(0.125, 0.14, 0.94)
[node name="PlayerCharacter" type="PlayerCharacter"]
[sub_resource type="Action" id="Action_ksl64"]
effects = {
"prereq": true
}
[sub_resource type="Action" id="Action_mdru6"]
effects = {
"not_goal": 1
}
[sub_resource type="Action" id="Action_7v1i5"]
prerequisites = {
"prereq": true
}
effects = {
"goal": true
}
[sub_resource type="GDScript" id="GDScript_ncqfl"]
script/source = "extends Planner
func get_goal() -> bool:
return false
func get_prereq() -> bool:
return false
func get_not_goal() -> int:
return 0
func _ready():
var goal : Goal = ResourceLoader.load(\"res://new_goal.tres\")
var plan : Array = self.gdscript_make_plan(goal)
"
[node name="PlayerCharacter" type="CharacterActor"]
rotation_speed_curve = SubResource("Curve_7rmf4")
collision_layer = 7
@ -47,3 +82,7 @@ surface_material_override/0 = SubResource("StandardMaterial3D_scmx3")
[node name="WeaponMuzzle" type="WeaponMuzzle" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.53551, 0.931313, 0)
[node name="Planner" type="Planner" parent="."]
actions = [SubResource("Action_ksl64"), SubResource("Action_mdru6"), SubResource("Action_7v1i5")]
script = SubResource("GDScript_ncqfl")