generated from krampus/template-godot4
Debug menu
Some checks failed
linting & formatting / build (push) Failing after 13s
itch.io publish action / build (linux64, x86_64) (push) Successful in 2m52s
itch.io publish action / build (osx, app) (push) Successful in 1m52s
itch.io publish action / build (win64, exe) (push) Successful in 1m58s
Some checks failed
linting & formatting / build (push) Failing after 13s
itch.io publish action / build (linux64, x86_64) (push) Successful in 2m52s
itch.io publish action / build (osx, app) (push) Successful in 1m52s
itch.io publish action / build (win64, exe) (push) Successful in 1m58s
This commit is contained in:
parent
c28c016dbd
commit
ca58dd65a6
@ -18,6 +18,7 @@ PAUSE_END,"Quit to Title"
|
||||
PAUSE_END_MSG,"End the game and return to the title screen?\nUnsaved progress will be lost."
|
||||
PAUSE_QUIT,"Quit to Desktop"
|
||||
PAUSE_QUIT_MSG,"Quit to desktop?\nUnsaved progress will be lost."
|
||||
PAUSE_DEBUG,"Debug Menu"
|
||||
,
|
||||
SETTINGS_GAME,Game
|
||||
SETTINGS_GAME_HEADING,"Game Configuration"
|
||||
|
|
@ -78,6 +78,8 @@ config/accessibility/enable_head_bob=true
|
||||
config/input/hold_to_sneak=true
|
||||
debug/enable_navigation_agent_debug=false
|
||||
debug/enable_navigation_agent_debug.editor_runtime=true
|
||||
debug/enable_debug_menu=false
|
||||
debug/enable_debug_menu.debug=true
|
||||
|
||||
[global_group]
|
||||
|
||||
|
@ -15,6 +15,8 @@ var hold_to_sneak: bool
|
||||
var enable_screen_shake: bool
|
||||
var enable_head_bob: bool
|
||||
|
||||
var enable_debug_menu: bool
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
ProjectSettings.settings_changed.connect(_read_settings)
|
||||
@ -39,6 +41,8 @@ func _read_settings() -> void:
|
||||
)
|
||||
enable_head_bob = ProjectSettings.get_setting("game/config/accessibility/enable_head_bob")
|
||||
|
||||
enable_debug_menu = ProjectSettings.get_setting_with_override("game/debug/enable_debug_menu")
|
||||
|
||||
|
||||
func _load_audio_bus_override() -> void:
|
||||
# Load override audio bus file
|
||||
|
@ -2,6 +2,9 @@ class_name Player extends CharacterBody3D
|
||||
|
||||
#region Exported Properties
|
||||
|
||||
@export_category("HAX!!")
|
||||
@export var godmode := false
|
||||
|
||||
@export_category("Status")
|
||||
@export var dead := false
|
||||
@export var movement_enabled := true
|
||||
@ -145,7 +148,7 @@ func toggle_crouch() -> void:
|
||||
## Get fuckign grabbed, idiot!
|
||||
## Begin grab death sequence animation.
|
||||
func get_grabbed() -> void:
|
||||
if dead: # No double-grabsies
|
||||
if dead or godmode: # No double-grabsies
|
||||
return
|
||||
|
||||
movement_enabled = false
|
||||
@ -183,12 +186,6 @@ func _signal_death() -> void:
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# REMOVEME
|
||||
if Input.is_action_just_pressed("ui_page_down"):
|
||||
get_grabbed()
|
||||
if Input.is_action_just_pressed("ui_page_up"):
|
||||
World.instance.save_progress()
|
||||
|
||||
# Will be null if no valid interactor is selected.
|
||||
var interactive: Interactive = interact_ray.get_collider() as Interactive
|
||||
hud.select_interactive(interactive)
|
||||
|
31
src/ui/menus/debug_menu/debug_menu.gd
Normal file
31
src/ui/menus/debug_menu/debug_menu.gd
Normal file
@ -0,0 +1,31 @@
|
||||
extends PanelContainer
|
||||
|
||||
@onready var god_mode: CheckButton = %GodMode
|
||||
@onready var collect_grunk_input: SpinBox = %CollectGrunkInput
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Initialize controls
|
||||
if Player.instance:
|
||||
god_mode.set_pressed_no_signal(Player.instance.godmode)
|
||||
|
||||
|
||||
func kill_player() -> void:
|
||||
Player.instance.get_grabbed()
|
||||
|
||||
|
||||
func save_game() -> void:
|
||||
World.instance.save_progress()
|
||||
|
||||
|
||||
func load_game() -> void:
|
||||
World.instance.on_game_over()
|
||||
|
||||
|
||||
func collect_grunk() -> void:
|
||||
World.instance.manager.collect_grunk(collect_grunk_input.value)
|
||||
collect_grunk_input.value = 0.0
|
||||
|
||||
|
||||
func empty_tank() -> void:
|
||||
World.instance.manager.empty_tank()
|
1
src/ui/menus/debug_menu/debug_menu.gd.uid
Normal file
1
src/ui/menus/debug_menu/debug_menu.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cekwr6enxknpn
|
97
src/ui/menus/debug_menu/debug_menu.tscn
Normal file
97
src/ui/menus/debug_menu/debug_menu.tscn
Normal file
@ -0,0 +1,97 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dofr2ebmvnwxf"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://doq7ay6f7dgfo" path="res://src/ui/menus/menu.theme" id="1_spfxq"]
|
||||
[ext_resource type="Script" uid="uid://cekwr6enxknpn" path="res://src/ui/menus/debug_menu/debug_menu.gd" id="2_p20ux"]
|
||||
[ext_resource type="FontFile" uid="uid://qadtckvw0t3l" path="res://assets/fonts/fontawesome-free-6.7.2-desktop/otfs/Font Awesome 6 Free-Solid-900.otf" id="3_rw5h6"]
|
||||
|
||||
[node name="DebugMenu" type="PanelContainer"]
|
||||
custom_minimum_size = Vector2(1000, 600)
|
||||
theme = ExtResource("1_spfxq")
|
||||
script = ExtResource("2_p20ux")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 16
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_right = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Header" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Heading" type="Label" parent="MarginContainer/VBoxContainer/Header"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "DEBUG MENU"
|
||||
|
||||
[node name="CloseButton" type="Button" parent="MarginContainer/VBoxContainer/Header"]
|
||||
layout_mode = 2
|
||||
theme_override_fonts/font = ExtResource("3_rw5h6")
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = ""
|
||||
flat = true
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer/ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/margin_right = 12
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="GodMode" type="CheckButton" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "God mode"
|
||||
alignment = 2
|
||||
|
||||
[node name="KillPlayer" type="Button" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Kill player"
|
||||
|
||||
[node name="SaveButton" type="Button" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Save game"
|
||||
|
||||
[node name="LoadButton" type="Button" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Load game"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="CollectGrunkInput" type="SpinBox" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
max_value = 6.4e+07
|
||||
alignment = 2
|
||||
suffix = "g"
|
||||
|
||||
[node name="CollectGrunkButton" type="Button" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Collect grunk"
|
||||
|
||||
[node name="EmptyTankButton" type="Button" parent="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Empty tank"
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Header/CloseButton" to="." method="queue_free"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer/KillPlayer" to="." method="kill_player"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer/SaveButton" to="." method="save_game"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer/LoadButton" to="." method="load_game"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer2/CollectGrunkButton" to="." method="collect_grunk"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer2/EmptyTankButton" to="." method="empty_tank"]
|
@ -1,7 +1,10 @@
|
||||
extends Control
|
||||
## Menu shown in-game when the user presses pause.
|
||||
|
||||
@export_category("Game Scenes")
|
||||
@export_file("*.tscn") var title_scene: String
|
||||
@export var settings_scene: PackedScene
|
||||
@export var debug_scene: PackedScene
|
||||
|
||||
var _freeze_input := false
|
||||
|
||||
@ -10,10 +13,15 @@ var _freeze_input := false
|
||||
@onready var end_game_confirm: Control = %EndGameConfirm
|
||||
@onready var settings_container: Container = %SettingsContainer
|
||||
|
||||
@onready var debug_button: Button = %DebugButton
|
||||
@onready var debug_container: MarginContainer = %DebugContainer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
Engine.time_scale = 1.0
|
||||
if Game.settings.enable_debug_menu:
|
||||
debug_button.show()
|
||||
|
||||
|
||||
func _unhandled_key_input(event: InputEvent) -> void:
|
||||
@ -63,5 +71,12 @@ func cancel_end_game() -> void:
|
||||
|
||||
|
||||
func confirm_end_game() -> void:
|
||||
print_debug("TODO")
|
||||
#world.fade_to_title()
|
||||
# TODO transition
|
||||
Game.instance.queue_scene(title_scene)
|
||||
|
||||
|
||||
func debug_menu() -> void:
|
||||
var instance: Control = debug_scene.instantiate()
|
||||
debug_container.add_child(instance)
|
||||
instance.tree_exited.connect(_unhide)
|
||||
_hide()
|
||||
|
@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://byvjsvavbg5xe"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://byvjsvavbg5xe"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://doq7ay6f7dgfo" path="res://src/ui/menus/menu.theme" id="1_b4t8b"]
|
||||
[ext_resource type="Script" uid="uid://cllx5glqld8wn" path="res://src/ui/menus/pause_menu/pause_menu.gd" id="1_rd0j2"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3eaqw2rdurct" path="res://src/ui/menus/settings_menu/settings_menu.tscn" id="3_dowgp"]
|
||||
[ext_resource type="PackedScene" uid="uid://dofr2ebmvnwxf" path="res://src/ui/menus/debug_menu/debug_menu.tscn" id="4_1bm4j"]
|
||||
|
||||
[node name="PauseMenu" type="Control"]
|
||||
process_mode = 3
|
||||
@ -14,7 +15,9 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_b4t8b")
|
||||
script = ExtResource("1_rd0j2")
|
||||
title_scene = "uid://bctwol681jdk0"
|
||||
settings_scene = ExtResource("3_dowgp")
|
||||
debug_scene = ExtResource("4_1bm4j")
|
||||
|
||||
[node name="Shade" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
@ -85,6 +88,13 @@ layout_mode = 2
|
||||
theme_type_variation = &"DangerButton"
|
||||
text = "PAUSE_QUIT"
|
||||
|
||||
[node name="DebugButton" type="Button" parent="MenuList/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.14, 1, 0.355, 1)
|
||||
text = "PAUSE_DEBUG"
|
||||
|
||||
[node name="SettingsContainer" type="MarginContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(1000, 600)
|
||||
@ -102,6 +112,23 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="DebugContainer" type="MarginContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(1000, 600)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -485.0
|
||||
offset_top = -300.0
|
||||
offset_right = 515.0
|
||||
offset_bottom = 300.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="QuitConfirm" type="CenterContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
@ -196,6 +223,7 @@ text = "UI_QUIT"
|
||||
[connection signal="pressed" from="MenuList/VBoxContainer/SettingsButton" to="." method="settings"]
|
||||
[connection signal="pressed" from="MenuList/VBoxContainer/EndGameButton" to="." method="end_game"]
|
||||
[connection signal="pressed" from="MenuList/VBoxContainer/QuitButton" to="." method="quit"]
|
||||
[connection signal="pressed" from="MenuList/VBoxContainer/DebugButton" to="." method="debug_menu"]
|
||||
[connection signal="pressed" from="QuitConfirm/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/CancelButton" to="." method="cancel_quit"]
|
||||
[connection signal="pressed" from="QuitConfirm/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/ConfirmQuitButton" to="." method="confirm_quit"]
|
||||
[connection signal="pressed" from="EndGameConfirm/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/CancelButton" to="." method="cancel_end_game"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user