diff --git a/project.godot b/project.godot index 56af3e3..6c95e9b 100644 --- a/project.godot +++ b/project.godot @@ -107,7 +107,7 @@ gameplay/beast/anger_min=0.0 gameplay/beast/anger_max=150.0 gameplay/beast/anger_decay_rate=1.0 gameplay/beast/anger_noise=10.0 -gameplay/beast/anger_noise_near=30.0 +gameplay/beast/anger_noise_near=10.0 gameplay/beast/provocation_range=5.5 gameplay/beast/anger_alarm=60.0 gameplay/beast/anger_alarm_extra=60.0 @@ -123,6 +123,8 @@ gameplay/beast/anger_threshold_pursuit=80.0 gameplay/beast/anger_start_tracking=4.0 gameplay/beast/anger_extra_alert_level=4 gameplay/beast/anger_threshold_pounce=140.0 +debug/show_beast_info=false +debug/show_beast_info.editor_runtime=true [global_group] diff --git a/src/ui/menus/debug_menu/debug_menu.gd b/src/ui/menus/debug_menu/debug_menu.gd index b4f3d31..5365df5 100644 --- a/src/ui/menus/debug_menu/debug_menu.gd +++ b/src/ui/menus/debug_menu/debug_menu.gd @@ -13,6 +13,8 @@ var _track_list_dirty := false @onready var alert_level_label: Label = %AlertLevelLabel +@onready var show_beast_info: CheckButton = %ShowBeastInfo + @onready var tracks_collected_list: VBoxContainer = %TracksCollectedList @onready var append_target: Panel = %AppendTarget @@ -30,6 +32,11 @@ func _ready() -> void: _build_track_list() _update_alert_level() + @warning_ignore("unsafe_cast") + show_beast_info.set_pressed_no_signal( + ProjectSettings.get_setting_with_override("game/debug/show_beast_info") as bool + ) + func _build_track_list() -> void: tracks_collected_list.remove_child(append_target) @@ -138,3 +145,7 @@ func spawn_beast() -> void: func kill_beasts() -> void: for c: Node in get_tree().get_nodes_in_group(GrunkBeast.GROUP): c.queue_free() + + +func set_show_beast_info(toggled_on: bool) -> void: + ProjectSettings.set_setting("game/debug/show_beast_info", toggled_on) diff --git a/src/ui/menus/debug_menu/debug_menu.tscn b/src/ui/menus/debug_menu/debug_menu.tscn index 025ca1b..5434602 100644 --- a/src/ui/menus/debug_menu/debug_menu.tscn +++ b/src/ui/menus/debug_menu/debug_menu.tscn @@ -205,6 +205,12 @@ text = "Spawn grunkbeast" layout_mode = 2 text = "Despawn all grunkbeasts" +[node name="ShowBeastInfo" type="CheckButton" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer8"] +unique_name_in_owner = true +layout_mode = 2 +text = "Show beast info" +alignment = 2 + [node name="HBoxContainer6" type="HBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"] layout_mode = 2 theme_override_constants/separation = 16 @@ -379,6 +385,7 @@ preserve_on_drag = true [connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer7/ResetAlertLevel" to="." method="reset_alert_level"] [connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer8/SpawnBeast" to="." method="spawn_beast"] [connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer8/KillBeasts" to="." method="kill_beasts"] +[connection signal="toggled" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer8/ShowBeastInfo" to="." method="set_show_beast_info"] [connection signal="child_entered_tree" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer6/TracksCollectedColumn/TracksCollected/MarginContainer/ScrollContainer/MarginContainer/TracksCollectedList" to="." method="_on_track_list_changed" unbinds=1] [connection signal="child_exiting_tree" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer6/TracksCollectedColumn/TracksCollected/MarginContainer/ScrollContainer/MarginContainer/TracksCollectedList" to="." method="_on_track_list_changed" unbinds=1] [connection signal="child_order_changed" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer6/TracksCollectedColumn/TracksCollected/MarginContainer/ScrollContainer/MarginContainer/TracksCollectedList" to="." method="_on_track_list_changed"] diff --git a/src/world/grunk_beast/beast_spawner/floor_spawner.gd b/src/world/grunk_beast/beast_spawner/floor_spawner.gd index bfb6d98..8a078a3 100644 --- a/src/world/grunk_beast/beast_spawner/floor_spawner.gd +++ b/src/world/grunk_beast/beast_spawner/floor_spawner.gd @@ -1,10 +1,13 @@ class_name FloorSpawner extends BeastSpawner ## Beast spawner on the floor +@export var y_offset: float = 1.0 + func do_spawn() -> void: var instance: GrunkBeast = instantiate() add_sibling(instance) instance.global_transform = global_transform + instance.global_position.y += y_offset instance.start_spawn() diff --git a/src/world/grunk_beast/behaviors/actions/increment_beast_anger.gd b/src/world/grunk_beast/behaviors/actions/increment_beast_anger.gd index e5dde6d..634667e 100644 --- a/src/world/grunk_beast/behaviors/actions/increment_beast_anger.gd +++ b/src/world/grunk_beast/behaviors/actions/increment_beast_anger.gd @@ -14,4 +14,5 @@ func tick(_actor: Node, blackboard: Blackboard) -> int: blackboard.set_value( GrunkBeast.ANGER_KEY, clampf(value + d, GrunkBeast.anger_min, GrunkBeast.anger_max) ) + print_debug("Beast anger increased by ", d, " by action ", name) return SUCCESS diff --git a/src/world/grunk_beast/debug_canvas_layer.gd b/src/world/grunk_beast/debug_canvas_layer.gd new file mode 100644 index 0000000..245cd15 --- /dev/null +++ b/src/world/grunk_beast/debug_canvas_layer.gd @@ -0,0 +1,11 @@ +extends CanvasLayer + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + ProjectSettings.settings_changed.connect(_check_setting) + _check_setting() + + +func _check_setting() -> void: + visible = ProjectSettings.get_setting_with_override("game/debug/show_beast_info") diff --git a/src/world/grunk_beast/debug_canvas_layer.gd.uid b/src/world/grunk_beast/debug_canvas_layer.gd.uid new file mode 100644 index 0000000..abf992e --- /dev/null +++ b/src/world/grunk_beast/debug_canvas_layer.gd.uid @@ -0,0 +1 @@ +uid://dw3t84dfacj2a diff --git a/src/world/grunk_beast/grunk_beast.gd b/src/world/grunk_beast/grunk_beast.gd index 6adf27e..47a3ac6 100644 --- a/src/world/grunk_beast/grunk_beast.gd +++ b/src/world/grunk_beast/grunk_beast.gd @@ -109,6 +109,7 @@ func _ready() -> void: func start_spawn() -> void: + apply_floor_snap() model.play_spawn_animation() root_block.await_signal(model.spawn_animation_finished) # Set point of interest to spawn point @@ -195,10 +196,10 @@ func on_sound_detected(source: Vector3) -> void: point_of_interest = source if sound_detection_cooldown.is_stopped(): - print_debug("Beast heard something from ", source) + print_debug("Beast heard something from ", source, "(+", GrunkBeast.anger_noise, ")") anger_level += GrunkBeast.anger_noise if source.distance_to(self.global_position) <= GrunkBeast.provocation_range: - print_debug("... And it was close, too!") + print_debug("... And it was close, too! (+", GrunkBeast.anger_noise_near, ")") anger_level += GrunkBeast.anger_noise_near sound_detection_cooldown.start() # TODO animation? @@ -224,11 +225,11 @@ func _on_alarm_triggered(source: GunkAlarm) -> void: if root_block.is_blocked(): return - print_debug("The beast was angered by the alarm!") + print_debug("The beast was angered by the alarm! (+", GrunkBeast.anger_alarm, ")") point_of_interest = source.global_position anger_level += GrunkBeast.anger_alarm if World.instance.manager.alert_level >= GrunkBeast.anger_extra_alert_level: - print_debug("The beast got extra-angry!") + print_debug("The beast got extra-angry! (+", GrunkBeast.anger_alarm_extra, ")") anger_level += GrunkBeast.anger_alarm_extra @@ -237,6 +238,6 @@ func _on_touch(_body: Node3D) -> void: return if touch_cooldown.is_stopped(): - print_debug("Touched the beast!") + print_debug("Touched the beast! (+", GrunkBeast.anger_touch, ")") anger_level += GrunkBeast.anger_touch touch_cooldown.start() diff --git a/src/world/grunk_beast/grunk_beast.tscn b/src/world/grunk_beast/grunk_beast.tscn index cba312a..ab869d2 100644 --- a/src/world/grunk_beast/grunk_beast.tscn +++ b/src/world/grunk_beast/grunk_beast.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=45 format=3 uid="uid://ehf5sg3ahvbf"] +[gd_scene load_steps=46 format=3 uid="uid://ehf5sg3ahvbf"] [ext_resource type="Script" uid="uid://b5loa2u6s5l5c" path="res://src/player/rigid_body_physics.gd" id="2_4alar"] [ext_resource type="PackedScene" uid="uid://brrd33217oplv" path="res://src/world/grunk_beast/shambler/shambler.tscn" id="2_csisu"] @@ -36,6 +36,7 @@ [ext_resource type="Script" uid="uid://o625e667ig2e" path="res://src/world/grunk_beast/behaviors/conditions/point_in_range.gd" id="34_vbkm0"] [ext_resource type="Script" uid="uid://dsf3a8vlolhx8" path="res://addons/beehave/nodes/decorators/succeeder.gd" id="35_4alar"] [ext_resource type="Script" uid="uid://c7n3lak5yhrpv" path="res://src/world/grunk_beast/behaviors/decorators/random_chance.gd" id="36_uy7at"] +[ext_resource type="Script" uid="uid://dw3t84dfacj2a" path="res://src/world/grunk_beast/debug_canvas_layer.gd" id="37_uy7at"] [sub_resource type="Curve" id="Curve_sm756"] _limits = [0.0, 10.0, 0.0, 150.0] @@ -49,7 +50,7 @@ radius = 0.4 radius = 9.0 [sub_resource type="SphereShape3D" id="SphereShape3D_1cnlk"] -radius = 2.0 +radius = 1.7 [sub_resource type="SphereShape3D" id="SphereShape3D_3gbao"] radius = 1.4 @@ -158,7 +159,7 @@ one_shot = true [node name="TouchCooldown" type="Timer" parent="."] unique_name_in_owner = true -wait_time = 0.5 +wait_time = 0.8 one_shot = true [node name="AngerDecay" type="Timer" parent="."] @@ -389,7 +390,7 @@ metadata/_custom_type_script = "uid://cg016dbe7gs1x" script = ExtResource("11_mbqcc") mean_time = 4.0 st_dev_time = 0.6 -wait_time = 4.75634 +wait_time = 4.22028 metadata/_custom_type_script = "uid://beyk2xtbjrsg4" [node name="PickRandomInvestigationTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/TrackingMode/ActionSelector/InvestigateAction/AlwaysSucceedDecorator/InvestigateSequence/RandomDelay"] @@ -483,7 +484,7 @@ metadata/_custom_type_script = "uid://bogt3htgqe12s" script = ExtResource("11_mbqcc") mean_time = 9.0 st_dev_time = 1.0 -wait_time = 9.92344 +wait_time = 9.39944 metadata/_custom_type_script = "uid://beyk2xtbjrsg4" [node name="PickRandomLurkTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/LurkingMode/RandomDelay"] @@ -509,6 +510,7 @@ metadata/_custom_type_script = "uid://dme5f24l0edsf" [node name="DebugCanvasLayer" type="CanvasLayer" parent="."] unique_name_in_owner = true layer = 10 +script = ExtResource("37_uy7at") [node name="MarginContainer" type="MarginContainer" parent="DebugCanvasLayer"] offset_right = 40.0 diff --git a/src/world/grunk_beast/shambler/shambler.tscn b/src/world/grunk_beast/shambler/shambler.tscn index 20dad75..42a60b4 100644 --- a/src/world/grunk_beast/shambler/shambler.tscn +++ b/src/world/grunk_beast/shambler/shambler.tscn @@ -59,6 +59,7 @@ animation = &"walk_front" animation = &"walk_rear" [sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_nayyt"] +graph_offset = Vector2(-1297.66, 69.5868) nodes/anim_scale/node = SubResource("AnimationNodeTimeScale_s7rwx") nodes/anim_scale/position = Vector2(280, 140) nodes/emerge_floor/node = SubResource("AnimationNodeAnimation_vmxrd")