[gd_scene load_steps=36 format=3 uid="uid://ehf5sg3ahvbf"]

[ext_resource type="Script" uid="uid://bukihqt1lybnx" path="res://src/util/frame_skipper.gd" id="2_lak6w"]
[ext_resource type="Script" uid="uid://gwwmqwixqqr5" path="res://src/world/grunk_beast/grunk_beast.gd" id="2_qqnhb"]
[ext_resource type="PackedScene" uid="uid://cvq81xegbwv87" path="res://src/world/grunk_beast/slutch_beast/slutch_beast.tscn" id="2_xs4mp"]
[ext_resource type="Script" uid="uid://fpfcg6s7b1nj" path="res://src/world/grunk_beast/navigation.gd" id="4_csisu"]
[ext_resource type="Script" uid="uid://cfsiyhhrcua6o" path="res://src/world/game_sound/game_sound_listener.gd" id="5_3gbao"]
[ext_resource type="Script" uid="uid://bb0t2ovl7wifo" path="res://addons/beehave/nodes/beehave_tree.gd" id="6_d4ex2"]
[ext_resource type="Script" uid="uid://dme5f24l0edsf" path="res://addons/beehave/blackboard.gd" id="7_cn3ok"]
[ext_resource type="Script" uid="uid://cw22yurt5l74k" path="res://addons/beehave/nodes/composites/selector_reactive.gd" id="7_vvw1q"]
[ext_resource type="Script" uid="uid://cg016dbe7gs1x" path="res://addons/beehave/nodes/composites/sequence.gd" id="8_0gxpq"]
[ext_resource type="Script" uid="uid://7k5hor1omsxc" path="res://src/world/grunk_beast/behaviors/conditions/body_in_area.gd" id="9_xuag8"]
[ext_resource type="Script" uid="uid://u1ntpwjwjqhj" path="res://src/world/grunk_beast/behaviors/actions/set_nav_target.gd" id="10_kjykp"]
[ext_resource type="Script" uid="uid://2qri6rrfv8ui" path="res://addons/beehave/nodes/decorators/cooldown.gd" id="10_ntlom"]
[ext_resource type="Script" uid="uid://beyk2xtbjrsg4" path="res://src/world/grunk_beast/behaviors/decorators/random_delay.gd" id="11_mbqcc"]
[ext_resource type="Script" uid="uid://b0xue7ao0gjqo" path="res://src/world/grunk_beast/behaviors/actions/grab_target.gd" id="11_nq7ke"]
[ext_resource type="Script" uid="uid://8hn4kne15ac5" path="res://addons/beehave/nodes/composites/selector.gd" id="12_dkcdj"]
[ext_resource type="Script" uid="uid://cg55nu4y0a5ud" path="res://src/world/grunk_beast/behaviors/actions/pick_random_from_group.gd" id="12_ml8dd"]
[ext_resource type="Script" uid="uid://dcojdhvj8qcw0" path="res://addons/beehave/nodes/composites/sequence_reactive.gd" id="12_xde72"]
[ext_resource type="Script" uid="uid://b34l3v4sr8rmq" path="res://src/world/grunk_beast/behaviors/actions/set_target_from_area.gd" id="13_x8l6r"]
[ext_resource type="Script" uid="uid://om57w2acvgb7" path="res://src/world/grunk_beast/behaviors/actions/travel_to_destination.gd" id="14_4y64f"]
[ext_resource type="Script" uid="uid://c5cikaa68tsto" path="res://src/world/grunk_beast/behaviors/actions/set_player_priority_target.gd" id="14_csisu"]
[ext_resource type="Script" uid="uid://bkdwuqv4tudka" path="res://src/world/grunk_beast/behaviors/actions/pursue_target.gd" id="14_x8l6r"]
[ext_resource type="Script" uid="uid://demv7xh27ouvr" path="res://src/world/grunk_beast/behaviors/actions/blackboard_erase_safe.gd" id="15_4b27i"]
[ext_resource type="Script" uid="uid://dwfdg523bk776" path="res://addons/beehave/nodes/decorators/failer.gd" id="15_oons1"]
[ext_resource type="Script" uid="uid://wfd5nbethyw6" path="res://src/world/grunk_beast/behaviors/actions/blackboard_copy.gd" id="15_umoec"]
[ext_resource type="Script" uid="uid://ykfqlqp7e8og" path="res://src/world/grunk_beast/behaviors/actions/start_timer.gd" id="16_asd50"]
[ext_resource type="Script" uid="uid://h0cp58nswpml" path="res://src/world/grunk_beast/behaviors/conditions/timer_running.gd" id="16_oons1"]
[ext_resource type="Script" uid="uid://ubcelage67hs" path="res://src/world/grunk_beast/behaviors/actions/get_random_target.gd" id="24_asd50"]
[ext_resource type="Script" uid="uid://dvnmhlldp23hg" path="res://addons/beehave/nodes/composites/selector_random.gd" id="24_xs4mp"]
[ext_resource type="Script" uid="uid://bksvlal4gjhfr" path="res://src/world/grunk_beast/behaviors/actions/sniff.gd" id="26_lak6w"]

[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_faau1"]
radius = 0.4

[sub_resource type="SphereShape3D" id="SphereShape3D_wffas"]
radius = 16.0

[sub_resource type="SphereShape3D" id="SphereShape3D_3gbao"]
radius = 1.4

[sub_resource type="SphereShape3D" id="SphereShape3D_d4ex2"]
radius = 20.0

[sub_resource type="SphereShape3D" id="SphereShape3D_oons1"]
radius = 3.0

[sub_resource type="SphereShape3D" id="SphereShape3D_lak6w"]
radius = 10.0

[node name="GrunkBeast" type="CharacterBody3D" groups=["GrunkBeast"]]
collision_layer = 36
wall_min_slide_angle = 0.174533
floor_max_angle = 1.0472
script = ExtResource("2_qqnhb")

[node name="FrameSkipper" type="Node3D" parent="."]
script = ExtResource("2_lak6w")
frame_skip = 4

[node name="SlutchBeast" parent="FrameSkipper" instance=ExtResource("2_xs4mp")]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_faau1")

[node name="Navigation" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
script = ExtResource("4_csisu")

[node name="NavAgent" type="NavigationAgent3D" parent="Navigation"]
unique_name_in_owner = true
path_height_offset = 0.25
path_postprocessing = 1
avoidance_enabled = true
debug_enabled = true

[node name="NavProbe" type="NavigationAgent3D" parent="Navigation"]
unique_name_in_owner = true
debug_enabled = true
debug_use_custom = true
debug_path_custom_color = Color(0, 1, 0, 1)
debug_path_custom_point_size = 8.0

[node name="GameSoundListener" type="StaticBody3D" parent="."]
collision_layer = 16
collision_mask = 0
script = ExtResource("5_3gbao")
metadata/_custom_type_script = "uid://cfsiyhhrcua6o"

[node name="CollisionShape3D" type="CollisionShape3D" parent="GameSoundListener"]
shape = SubResource("SphereShape3D_wffas")

[node name="GrabbingRange" type="Area3D" parent="."]
collision_layer = 0
collision_mask = 8

[node name="CollisionShape3D" type="CollisionShape3D" parent="GrabbingRange"]
shape = SubResource("SphereShape3D_3gbao")

[node name="PursuitRange" type="Area3D" parent="."]
collision_layer = 0
collision_mask = 8

[node name="CollisionShape3D" type="CollisionShape3D" parent="PursuitRange"]
shape = SubResource("SphereShape3D_d4ex2")

[node name="AggroRange" type="Area3D" parent="."]
collision_layer = 0
collision_mask = 8

[node name="CollisionShape3D" type="CollisionShape3D" parent="AggroRange"]
shape = SubResource("SphereShape3D_oons1")

[node name="SniffRange" type="Area3D" parent="."]
collision_layer = 0
collision_mask = 8

[node name="CollisionShape3D" type="CollisionShape3D" parent="SniffRange"]
shape = SubResource("SphereShape3D_lak6w")

[node name="StalkingTimer" type="Timer" parent="."]
unique_name_in_owner = true
wait_time = 40.0
one_shot = true

[node name="GrunkBeastBehavior" type="Node" parent="." node_paths=PackedStringArray("blackboard", "actor")]
script = ExtResource("6_d4ex2")
blackboard = NodePath("../Blackboard")
actor = NodePath("..")
metadata/_custom_type_script = "uid://bb0t2ovl7wifo"

[node name="StateSelector" type="Node" parent="GrunkBeastBehavior"]
script = ExtResource("7_vvw1q")
metadata/_custom_type_script = "uid://cw22yurt5l74k"

[node name="GrabSequence" type="Node" parent="GrunkBeastBehavior/StateSelector"]
script = ExtResource("8_0gxpq")
metadata/_custom_type_script = "uid://cg016dbe7gs1x"

[node name="IsTargetInGrabbingRange" type="Node" parent="GrunkBeastBehavior/StateSelector/GrabSequence" node_paths=PackedStringArray("area")]
script = ExtResource("9_xuag8")
blackboard_key = "pursuit_target"
area = NodePath("../../../../GrabbingRange")
metadata/_custom_type_script = "uid://7k5hor1omsxc"

[node name="GrabCooldown" type="Node" parent="GrunkBeastBehavior/StateSelector/GrabSequence"]
script = ExtResource("10_ntlom")
wait_time = 2.0
metadata/_custom_type_script = "uid://2qri6rrfv8ui"

[node name="GrabTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/GrabSequence/GrabCooldown"]
script = ExtResource("11_nq7ke")
blackboard_key = "pursuit_target"
metadata/_custom_type_script = "uid://b0xue7ao0gjqo"

[node name="PursuitSequence" type="Node" parent="GrunkBeastBehavior/StateSelector"]
script = ExtResource("12_xde72")
metadata/_custom_type_script = "uid://dcojdhvj8qcw0"

[node name="TargetSelector" type="Node" parent="GrunkBeastBehavior/StateSelector/PursuitSequence"]
script = ExtResource("12_dkcdj")
metadata/_custom_type_script = "uid://8hn4kne15ac5"

[node name="SetPlayerPriorityTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/PursuitSequence/TargetSelector"]
script = ExtResource("14_csisu")
metadata/_custom_type_script = "uid://c5cikaa68tsto"

[node name="TargetInPursuitRange" type="Node" parent="GrunkBeastBehavior/StateSelector/PursuitSequence/TargetSelector" node_paths=PackedStringArray("area")]
script = ExtResource("9_xuag8")
blackboard_key = "pursuit_target"
area = NodePath("../../../../../PursuitRange")
metadata/_custom_type_script = "uid://7k5hor1omsxc"

[node name="GetTargetFromAggroRange" type="Node" parent="GrunkBeastBehavior/StateSelector/PursuitSequence/TargetSelector" node_paths=PackedStringArray("area")]
script = ExtResource("13_x8l6r")
blackboard_key = "pursuit_target"
area = NodePath("../../../../../AggroRange")
metadata/_custom_type_script = "uid://b34l3v4sr8rmq"

[node name="UpdateStalkingTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/PursuitSequence"]
script = ExtResource("15_umoec")
source_key = "pursuit_target"
destination_key = "stalking_target"
metadata/_custom_type_script = "uid://wfd5nbethyw6"

[node name="RestartStalkingTimer" type="Node" parent="GrunkBeastBehavior/StateSelector/PursuitSequence" node_paths=PackedStringArray("timer")]
script = ExtResource("16_asd50")
timer = NodePath("../../../../StalkingTimer")
metadata/_custom_type_script = "uid://ykfqlqp7e8og"

[node name="PursueTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/PursuitSequence"]
script = ExtResource("14_x8l6r")
blackboard_key = "pursuit_target"
metadata/_custom_type_script = "uid://bkdwuqv4tudka"

[node name="AlwaysFailDecorator" type="Node" parent="GrunkBeastBehavior/StateSelector"]
script = ExtResource("15_oons1")
metadata/_custom_type_script = "uid://dwfdg523bk776"

[node name="ErasePursuitTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/AlwaysFailDecorator"]
script = ExtResource("15_4b27i")
key = "pursuit_target"
metadata/_custom_type_script = "uid://demv7xh27ouvr"

[node name="StalkingSequence" type="Node" parent="GrunkBeastBehavior/StateSelector"]
script = ExtResource("12_xde72")
metadata/_custom_type_script = "uid://dcojdhvj8qcw0"

[node name="StalkingTimerRunning" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence" node_paths=PackedStringArray("timer")]
script = ExtResource("16_oons1")
timer = NodePath("../../../../StalkingTimer")
metadata/_custom_type_script = "uid://h0cp58nswpml"

[node name="SetNavTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence"]
script = ExtResource("10_kjykp")
blackboard_key = "stalking_target"
metadata/_custom_type_script = "uid://u1ntpwjwjqhj"

[node name="TravelToDestination" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence"]
script = ExtResource("14_4y64f")
metadata/_custom_type_script = "uid://om57w2acvgb7"

[node name="RandomDelay" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence"]
script = ExtResource("11_mbqcc")
mean_time = 4.0
st_dev_time = 0.6
wait_time = 3.41713
metadata/_custom_type_script = "uid://beyk2xtbjrsg4"

[node name="RandomStalkingBehavior" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence/RandomDelay"]
script = ExtResource("24_xs4mp")
use_weights = true
Weights/PickRandomStalkTarget = 10
Weights/SniffSequence = 1
metadata/_custom_type_script = "uid://dvnmhlldp23hg"

[node name="PickRandomStalkTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence/RandomDelay/RandomStalkingBehavior"]
script = ExtResource("24_asd50")
blackboard_key = "stalking_target"
metadata/_custom_type_script = "uid://ubcelage67hs"

[node name="SniffSequence" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence/RandomDelay/RandomStalkingBehavior"]
script = ExtResource("8_0gxpq")
metadata/_custom_type_script = "uid://cg016dbe7gs1x"

[node name="Sniff" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence/RandomDelay/RandomStalkingBehavior/SniffSequence"]
script = ExtResource("26_lak6w")
metadata/_custom_type_script = "uid://bksvlal4gjhfr"

[node name="SetTargetFromArea" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence/RandomDelay/RandomStalkingBehavior/SniffSequence" node_paths=PackedStringArray("area")]
script = ExtResource("13_x8l6r")
blackboard_key = "stalking_target"
area = NodePath("../../../../../../../SniffRange")
metadata/_custom_type_script = "uid://b34l3v4sr8rmq"

[node name="AlwaysFailDecorator2" type="Node" parent="GrunkBeastBehavior/StateSelector"]
script = ExtResource("15_oons1")
metadata/_custom_type_script = "uid://dwfdg523bk776"

[node name="EraseStalkingTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/AlwaysFailDecorator2"]
script = ExtResource("15_4b27i")
key = "stalking_target"
metadata/_custom_type_script = "uid://demv7xh27ouvr"

[node name="LurkSequence" type="Node" parent="GrunkBeastBehavior/StateSelector"]
script = ExtResource("8_0gxpq")
metadata/_custom_type_script = "uid://cg016dbe7gs1x"

[node name="RandomDelay" type="Node" parent="GrunkBeastBehavior/StateSelector/LurkSequence"]
script = ExtResource("11_mbqcc")
mean_time = 5.0
st_dev_time = 1.0
wait_time = 4.96224
metadata/_custom_type_script = "uid://beyk2xtbjrsg4"

[node name="PickRandomLurkTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/LurkSequence/RandomDelay"]
script = ExtResource("12_ml8dd")
blackboard_key = "lurk_target"
group = "LurkPoint"
metadata/_custom_type_script = "uid://cg55nu4y0a5ud"

[node name="SetNavTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/LurkSequence"]
script = ExtResource("10_kjykp")
blackboard_key = "lurk_target"
metadata/_custom_type_script = "uid://u1ntpwjwjqhj"

[node name="TravelToDestination" type="Node" parent="GrunkBeastBehavior/StateSelector/LurkSequence"]
script = ExtResource("14_4y64f")
metadata/_custom_type_script = "uid://om57w2acvgb7"

[node name="Blackboard" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("7_cn3ok")
metadata/_custom_type_script = "uid://dme5f24l0edsf"

[connection signal="link_reached" from="Navigation/NavAgent" to="." method="_on_link_reached"]
[connection signal="waypoint_reached" from="Navigation/NavAgent" to="." method="_on_waypoint_reached"]
[connection signal="sound_detected" from="GameSoundListener" to="." method="on_sound_detected"]
