kinda working options menu, but needs work

also audio lags on my pc, probably the cpu cant keep up with the audio
This commit is contained in:
Hellie-xd 2026-08-12 01:47:15 +02:00
parent 8b8f1d87c8
commit 900f5eb6c3
44 changed files with 1652 additions and 202 deletions

View file

@ -0,0 +1,24 @@
class_name AudioOptions extends Options
#TODO: add audio related settings here, each have their own property
var master_audio_level: float = 100.0:
set(value):
master_audio_level = clamp(value, 0.0, 100.0)
var sound_effects_audio_level: float = 100.0:
set(value):
sound_effects_audio_level = clamp(value, 0.0, 100.0)
var current_audio_type: AudioTypes = AudioTypes.RAYTRACED_AUDIO
enum AudioTypes {
RAYTRACED_AUDIO,
SIMPLE_VERB,
DELAY_VERB,
CONSTANT_VERB
}
func _init() -> void:
cur_type = Options.type.AUDIO

View file

@ -0,0 +1 @@
uid://b1r5ycpisn6gs

View file

@ -0,0 +1,11 @@
class_name ControlOptions extends Options
#TODO: add gameplay related settings here, each have their own property
var move_forward: Key = Key.KEY_W
var move_left: Key = Key.KEY_A
var move_right: Key = Key.KEY_D
var move_backward: Key = Key.KEY_S
func _init() -> void:
cur_type = Options.type.CONTROLS

View file

@ -0,0 +1 @@
uid://bpe7t7xsjgvlo

View file

@ -0,0 +1,77 @@
class_name DisplayOptions extends Options
#TODO: add gameplay related settings here, each have their own property
var current_resolution: Vector2 = Vector2(1920, 1080):
set(value):
current_resolution = value
# 1. Grab the SceneTree directly from the Engine
var tree := Engine.get_main_loop() as SceneTree
# 2. SAFETY CHECK: If the game is still booting up, ignore this
if not tree or not tree.root:
return
var window_size = Vector2i(value.x, value.y)
if tree.root.mode == Window.MODE_WINDOWED:
tree.root.size = window_size
var screen_size = DisplayServer.screen_get_size()
tree.root.position = (screen_size / 2) - (window_size / 2)
var max_framerate: float = 0:
set(value):
Engine.max_fps = int(value)
func _apply_windowed_size() -> void:
var tree := Engine.get_main_loop() as SceneTree
if not tree or not tree.root:
return
var window_size = Vector2i(current_resolution.x, current_resolution.y)
# Apply size to the root window (Forces UI to scale properly)
tree.root.size = window_size
var screen_size = DisplayServer.screen_get_size()
tree.root.position = (screen_size / 2) - (window_size / 2)
@export var current_window_mode: WindowMode = WindowMode.WINDOWED:
set(value):
current_window_mode = value
var tree := Engine.get_main_loop() as SceneTree
if not tree or not tree.root:
return
match value:
WindowMode.WINDOWED:
tree.root.mode = Window.MODE_WINDOWED
_apply_windowed_size.call_deferred()
WindowMode.FULLSCREEN:
tree.root.mode = Window.MODE_EXCLUSIVE_FULLSCREEN
WindowMode.BORDERLESS:
tree.root.mode = Window.MODE_FULLSCREEN
var vsync: bool = false:
set(value):
if value:
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED)
else:
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)
static var available_resolutions: Array[Vector2] = [Vector2(1920,1080), Vector2(1280, 720), Vector2(1080, 1920)]
enum WindowMode {
FULLSCREEN,
WINDOWED,
BORDERLESS
}
func _init() -> void:
cur_type = Options.type.GRAPHICS
func _ready() -> void:
current_resolution = current_resolution
current_window_mode = current_window_mode

View file

@ -0,0 +1 @@
uid://cunt1fb5vx5ot

View file

@ -0,0 +1,11 @@
class_name GameplayOptions extends Options
#TODO: add gameplay related settings here, each have their own property
var ui_movement_sensitivity: float = PlayerConsts.UI_MOVEMENT_SENSITIVITY
var ui_movement_speed: float = PlayerConsts.UI_MOVEMENT_SPEED
var ui_movement_velocity_multiplier: float = PlayerConsts.UI_MOVEMENT_VELOCITY_MULTIPLIER
var sensitivity: float
func _init() -> void:
cur_type = Options.type.GAMEPLAY

View file

@ -0,0 +1 @@
uid://b55csw1we7tav

View file

@ -0,0 +1,3 @@
[gd_resource type="ButtonGroup" format=3 uid="uid://bm4hwoio7vovb"]
[resource]

View file

@ -0,0 +1,11 @@
class_name Options extends Node
enum type {
GAMEPLAY,
AUDIO,
GRAPHICS,
CONTROLS,
NONE
}
var cur_type: type = type.NONE

View file

@ -0,0 +1 @@
uid://bvyqwjqx8gy1e

View file

@ -15,8 +15,8 @@ general/updates_per_second=100
[application] [application]
config/name="breadwinner" config/name="breadwinner"
run/main_scene="uid://chykk2a3opu0d"
config/features=PackedStringArray("4.7", "Forward Plus") config/features=PackedStringArray("4.7", "Forward Plus")
run/max_fps=90
config/icon="res://icon.svg" config/icon="res://icon.svg"
[audio] [audio]
@ -40,6 +40,7 @@ GlobalSignals="*uid://cky5rk5obojex"
window/size/viewport_width=1920 window/size/viewport_width=1920
window/size/viewport_height=1080 window/size/viewport_height=1080
window/size/resizable=false
window/stretch/mode="canvas_items" window/stretch/mode="canvas_items"
window/stretch/aspect="expand" window/stretch/aspect="expand"
window/vsync/vsync_mode=0 window/vsync/vsync_mode=0
@ -258,6 +259,11 @@ flashlight={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null)
] ]
} }
charge_flashlight={
"deadzone": 0.2,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(265, 26),"global_position":Vector2(284, 122),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
grab={ grab={
"deadzone": 0.2, "deadzone": 0.2,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(316, 15),"global_position":Vector2(325, 63),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(316, 15),"global_position":Vector2(325, 63),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)

View file

@ -3,15 +3,32 @@ class_name FlashlightComponent extends Node
@export var flashlight: SpotLight3D @export var flashlight: SpotLight3D
var flashlight_on: bool = true var flashlight_on: bool = true
var flashlight_charge: float = 100.0 var flashlight_charge: float = 100.0:
set(new_value):
flashlight_charge = new_value
flashlight_charge_changed.emit(new_value)
signal flashlight_charge_changed(cur_flashlight_percent:float)
signal flashlight_toggled(successfully:bool)
func charge_flashlight(amount:float = 10):
flashlight_charge += amount
func toggle_flashlight(): func toggle_flashlight():
if flashlight_charge == 0:
flashlight_toggled.emit(false)
return
flashlight_on = !flashlight_on flashlight_on = !flashlight_on
flashlight.visible = flashlight_on flashlight.visible = flashlight_on
print("flashlight ", flashlight_on)
flashlight_toggled.emit(true)
func _process(delta: float) -> void: func _process(delta: float) -> void:
if flashlight_on and flashlight_charge > 0: if flashlight_charge == 0:
flashlight_charge = move_toward(flashlight_charge, 0, .2 * delta) flashlight.visible = false
return
if flashlight_on and flashlight_charge > 0:
flashlight_charge = move_toward(flashlight_charge, 0, 3 * delta)
func _ready() -> void:
GlobalSignals.toggle_flashlight.connect(toggle_flashlight)

View file

@ -1,39 +0,0 @@
[gd_scene format=3 uid="uid://y5f3db7clptv"]
[ext_resource type="Script" uid="uid://d0g3mdq54p7oh" path="res://scenes/player/in_game_menu_manager.gd" id="1_s4bu6"]
[ext_resource type="PackedScene" uid="uid://bfg4q1t8s06vv" path="res://scenes/ui/optimized_blur_panel.tscn" id="2_s4bu6"]
[node name="InGameMenu" type="Control" unique_id=1952418949]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_s4bu6")
[node name="OptimizedBlurPanel" parent="." unique_id=1779763293 instance=ExtResource("2_s4bu6")]
layout_mode = 1
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="." unique_id=1893717599]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.3
anchor_top = 0.2
anchor_right = 0.7
anchor_bottom = 0.6
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="AspectRatioContainer" unique_id=1878750362]
layout_mode = 2
[node name="Options" type="Button" parent="AspectRatioContainer/VBoxContainer" unique_id=1588767106]
layout_mode = 2
text = "Options"
[node name="Exit" type="Button" parent="AspectRatioContainer/VBoxContainer" unique_id=1958391122]
layout_mode = 2
text = "Exit"
[connection signal="pressed" from="AspectRatioContainer/VBoxContainer/Exit" to="." method="_on_exit_pressed"]

View file

@ -1,14 +0,0 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_exit_pressed() -> void:
get_tree().quit()

View file

@ -8,10 +8,10 @@ class_name InputController extends Node
var held_object: RigidBody3D = null var held_object: RigidBody3D = null
signal toggle_flashlight signal toggle_flashlight
signal stamina_reset signal charge_flashlight
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:
if not Console.toggled or not UiManager.in_game_menu.visible: if not Console.toggled and not UiManager.in_game_menu.visible:
#handle grabbed object #handle grabbed object
if held_object != null: if held_object != null:
var target_pos = hold_position.global_position var target_pos = hold_position.global_position
@ -43,8 +43,8 @@ func _process(_delta: float) -> void:
if Input.is_action_just_pressed("flashlight"): if Input.is_action_just_pressed("flashlight"):
toggle_flashlight.emit() toggle_flashlight.emit()
if Input.is_action_just_released("jump") or Input.is_action_just_released("sprint"): if Input.is_action_just_pressed("charge_flashlight"):
stamina_reset.emit() charge_flashlight.emit()
if Input.is_action_just_pressed("grab"): if Input.is_action_just_pressed("grab"):
if cursor_raycast.is_colliding(): if cursor_raycast.is_colliding():

View file

@ -9,12 +9,30 @@ var inventory: Array[EquippableItem] = [null,null]
@export var hold_position: Marker3D @export var hold_position: Marker3D
@export var cursor_raycast: RayCast3D @export var cursor_raycast: RayCast3D
signal added_inventory_slot(successful:bool)
signal removed_inventory_slot(successful:bool)
signal select_item(index: int) signal select_item(index: int)
#for ui elements #for ui elements
signal add_item(index: int, item: EquippableItem) signal add_item(index: int, item: EquippableItem)
signal remove_item(index: int) signal remove_item(index: int)
func add_inventory_slot() -> bool:
if len(inventory) < 5:
inventory.append(null)
added_inventory_slot.emit(true)
return true
added_inventory_slot.emit(false)
return false
func remove_inventory_slot() -> bool:
if len(inventory) > 2:
inventory.remove_at(len(inventory) - 1)
removed_inventory_slot.emit(true)
return true
added_inventory_slot.emit(false)
return false
func next_item(): func next_item():
prev_selected_item = selected_item prev_selected_item = selected_item
if selected_item + 1 > len(inventory) - 1: if selected_item + 1 > len(inventory) - 1:

View file

@ -22,7 +22,7 @@ func handle_joypad_movement():
if controller_look_vector.length() > 0: if controller_look_vector.length() > 0:
mouse_motion += controller_look_vector mouse_motion += controller_look_vector
mouse_motion_delta = controller_look_vector mouse_motion_delta += controller_look_vector
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if not UiManager.in_game_menu.visible: if not UiManager.in_game_menu.visible:
@ -68,18 +68,18 @@ func _physics_process(delta: float) -> void:
if Input.is_action_pressed("crouch"): if Input.is_action_pressed("crouch"):
target_speed *= PlayerConsts.CROUCH_SPEED_MULTIPLIER target_speed *= PlayerConsts.CROUCH_SPEED_MULTIPLIER
new_state = "crouch" new_state = "crouching"
player_hit_box.shape.height = lerpf(player_hit_box.shape.height, 0.5, delta * 10) player_hit_box.shape.height = lerpf(player_hit_box.shape.height, 0.5, delta * 3)
else: else:
player_hit_box.shape.height = lerpf(player_hit_box.shape.height, 2, delta * 10) player_hit_box.shape.height = lerpf(player_hit_box.shape.height, 2, delta * 3)
if is_moving: if is_moving:
if Input.is_action_pressed("sprint") and player.stamina_component.stamina > 0: if Input.is_action_pressed("sprint") and player.stamina_component.stamina > 0:
target_speed *= PlayerConsts.SPRINT_MULTIPLIER target_speed *= PlayerConsts.SPRINT_MULTIPLIER
new_state = "run" new_state = "running"
else: else:
new_state = "walk" new_state = "walking"
if new_state != _current_state: if new_state != _current_state:
_current_state = new_state _current_state = new_state

View file

@ -14,27 +14,46 @@ class_name Player extends CharacterBody3D
@export var sound_controller: SoundController @export var sound_controller: SoundController
@export var player_state: PlayerState @export var player_state: PlayerState
static var player: Player
func _ready() -> void: func _ready() -> void:
Console.context["player"] = self Console.context["player"] = self
GameState.player = self GameState.player = self
#if player is the instance in server
# add logic for multiplayer
player = self
#signal connections #signal connections
inventory_component.select_item.connect(ui.select_item) inventory_component.select_item.connect(ui.select_item)
inventory_component.add_item.connect(ui.add_item) inventory_component.add_item.connect(ui.add_item)
inventory_component.remove_item.connect(ui.remove_item) inventory_component.remove_item.connect(ui.remove_item)
inventory_component.added_inventory_slot.connect(ui.add_inventory_slot)
inventory_component.removed_inventory_slot.connect(ui.remove_inventory_slot)
procedural_animator.breath.connect(sound_controller.play_breath_sound) procedural_animator.breath.connect(sound_controller.play_breath_sound)
procedural_animator.footstep.connect(sound_controller.play_footstep_sound) procedural_animator.footstep.connect(sound_controller.play_footstep_sound)
input_controller.stamina_reset.connect(stamina_component.restart_timer)
input_controller.toggle_flashlight.connect(flashlight_component.toggle_flashlight) input_controller.toggle_flashlight.connect(flashlight_component.toggle_flashlight)
input_controller.toggle_flashlight.connect(sound_controller.play_flashlight_sound) input_controller.charge_flashlight.connect(flashlight_component.charge_flashlight)
stamina_component.stamina_changed.connect(ui.set_stamina) stamina_component.stamina_changed.connect(ui.set_stamina)
flashlight_component.flashlight_charge_changed.connect(ui.set_flashlight)
flashlight_component.flashlight_toggled.connect(\
func (success):\
if success: \
sound_controller.play_flashlight_sound())
movement_component.jumped.connect(stamina_component.jump) movement_component.jumped.connect(stamina_component.jump)
movement_component.jumped.connect(sound_controller.play_jump_sound) movement_component.jumped.connect(sound_controller.play_jump_sound)
movement_component.jumped.connect(player_state.jump) movement_component.jumped.connect(player_state.jump)
movement_component.landed.connect(sound_controller.play_land_sound) movement_component.landed.connect(sound_controller.play_land_sound)
movement_component.state_changed.connect(\
SignalSniffer.watch(movement_component) func (state): \
if state == "running": \
stamina_component.run(true) \
else: \
stamina_component.run(false))
movement_component.state_changed.connect(player_state.handle_state_change)

View file

@ -18,6 +18,8 @@
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g4v7s"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g4v7s"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_b5l5s"]
[sub_resource type="PlaceholderMesh" id="PlaceholderMesh_b5l5s"] [sub_resource type="PlaceholderMesh" id="PlaceholderMesh_b5l5s"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_g4v7s"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_g4v7s"]
@ -103,6 +105,9 @@ script = ExtResource("12_kvlxm")
[node name="PlayerHitBox" type="CollisionShape3D" parent="." unique_id=1513955228] [node name="PlayerHitBox" type="CollisionShape3D" parent="." unique_id=1513955228]
shape = SubResource("CapsuleShape3D_g4v7s") shape = SubResource("CapsuleShape3D_g4v7s")
[node name="MeshInstance3D" type="MeshInstance3D" parent="PlayerHitBox" unique_id=539906244]
mesh = SubResource("CapsuleMesh_b5l5s")
[node name="CameraPivot" type="Node3D" parent="." unique_id=963377832] [node name="CameraPivot" type="Node3D" parent="." unique_id=963377832]
unique_name_in_owner = true unique_name_in_owner = true
@ -175,6 +180,41 @@ cursor = NodePath("../AspectRatioContainer2")
[node name="AspectRatioContainer2" parent="." unique_id=677513489 instance=ExtResource("14_fcs02")] [node name="AspectRatioContainer2" parent="." unique_id=677513489 instance=ExtResource("14_fcs02")]
[node name="Control" type="Control" parent="." unique_id=1197479340]
layout_mode = 3
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -40.0
offset_right = 40.0
grow_vertical = 0
[node name="Label" type="Label" parent="Control" unique_id=342556924]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -283.0
offset_right = 132.0
grow_vertical = 0
text = "wasd: move
e/q: lean
ctrl: crouch
shift: sprint
space: jump
f: flash
r: use/equip
g: drop
lmb: hold
rmb: charge light
f2: debug menu
f3: report menu
-: open console
esc: in game menu"
[node name="StaminaReset" type="Timer" parent="." unique_id=1815815085] [node name="StaminaReset" type="Timer" parent="." unique_id=1815815085]
unique_name_in_owner = true unique_name_in_owner = true
wait_time = 3.0 wait_time = 3.0

View file

@ -10,30 +10,17 @@ class_name PlayerUI extends Control
var inventory_size: int = 2 var inventory_size: int = 2
## returns true if successful ## returns true if successful
func add_inventory_slot() -> bool: func add_inventory_slot(success:bool):
if inventory_size < 4: if success:
inventory_slots_panels[inventory_size - 1].get_parent().visible = true
inventory_slots_panels[inventory_size - 1].texture = null
inventory_size += 1 inventory_size += 1
return true inventory_slots_panels[inventory_size - 1].get_parent().get_parent().visible = true
inventory_slots_panels[inventory_size - 1].texture = null
return false
func add_inventory_slot_console():
Console.print_to_console(false, "Success" if add_inventory_slot() else "Failed")
## returns true if successful ## returns true if successful
func remove_inventory_slot() -> bool: func remove_inventory_slot(success:bool):
if inventory_size > 2: if success:
inventory_slots_panels[inventory_size - 1].get_parent().visible = false inventory_slots_panels[inventory_size - 1].get_parent().get_parent().visible = false
inventory_size -= 1 inventory_size -= 1
return true
return false
func remove_inventory_slot_console():
Console.print_to_console(false, "Success " if remove_inventory_slot() else "Failed ")
const SELECTED_COLOR = 0xcfcfcf78 const SELECTED_COLOR = 0xcfcfcf78
const UNSELECTED_COLOR = 0x3d3d3d78 const UNSELECTED_COLOR = 0x3d3d3d78
@ -47,10 +34,9 @@ func toggle_cursor():
func _ready(): func _ready():
selected_stylebox.bg_color = SELECTED_COLOR selected_stylebox.bg_color = SELECTED_COLOR
unselected_stylebox.bg_color = UNSELECTED_COLOR unselected_stylebox.bg_color = UNSELECTED_COLOR
Console.add_inventory.connect(add_inventory_slot_console)
Console.remove_inventory.connect(remove_inventory_slot_console)
pivot_offset = get_viewport_rect().size / 2 pivot_offset = get_viewport_rect().size / 2
visibility_changed.connect(toggle_cursor) visibility_changed.connect(toggle_cursor)
UiManager.in_game_menu.visibility_changed.connect(func():visible = !visible)
func select_item(index): func select_item(index):
if index >= 0 and index < inventory_size: if index >= 0 and index < inventory_size:

View file

@ -10,9 +10,8 @@ bg_color = Color(0.6, 0.6, 0.6, 0)
[node name="PlayerUi" type="Control" unique_id=454848358] [node name="PlayerUi" type="Control" unique_id=454848358]
layout_mode = 3 layout_mode = 3
anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 0.98
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
offset_transform_enabled = true offset_transform_enabled = true

View file

@ -14,8 +14,9 @@ var last_breath_y: float = 0.0
var target_rotation: Vector3 = Vector3.ZERO var target_rotation: Vector3 = Vector3.ZERO
var _smoothed_velocity: Vector3 = Vector3.ZERO var _smoothed_velocity: Vector3 = Vector3.ZERO
var _smoothed_mouse_offset: Vector2 = Vector2.ZERO
var _breathing: bool = true var _breathing: bool = true
var _last_camera_global_position: Vector3 = Vector3.ZERO var _last_camera_position: Vector3 = Vector3.ZERO
signal footstep signal footstep
signal breath(breathe_in: bool) signal breath(breathe_in: bool)
@ -57,30 +58,40 @@ func do(delta: float):
camera.rotation = Vector3(final_pitch, 0, final_roll) camera.rotation = Vector3(final_pitch, 0, final_roll)
func ui_movement_handling(delta: float, cam_local_vel: Vector3): func ui_movement_handling(delta: float, cam_local_vel: Vector3):
if Console.toggled:
return
var mouse_offset = -movement.mouse_motion_delta * PlayerConsts.UI_MOVEMENT_SENSITIVITY var mouse_offset = -movement.mouse_motion_delta * PlayerConsts.UI_MOVEMENT_SENSITIVITY
_smoothed_mouse_offset = _smoothed_mouse_offset.lerp(mouse_offset, 1.0 - exp(-15.0 * delta))
movement.mouse_motion_delta = Vector2.ZERO
# We use the safe velocity calculated in do() instead of manual positions # We use the safe velocity calculated in do() instead of manual positions
var inertia_offset = Vector2( var inertia_offset = Vector2(
-cam_local_vel.x, -cam_local_vel.x,
cam_local_vel.y - (cam_local_vel.z * 0.25) cam_local_vel.y
) * PlayerConsts.CAMERA_VELOCITY_MULTIPLIER ) * PlayerConsts.CAMERA_VELOCITY_MULTIPLIER
var camera_global_velocity = (camera.global_position - _last_camera_global_position) / delta var camera_velocity = (camera.position - _last_camera_position) / delta
var bob_offset: Vector2 = Vector2(-camera_global_velocity.x, camera_global_velocity.y) var bob_offset: Vector2 = Vector2(-camera_velocity.x, camera_velocity.y)
var target_offset = mouse_offset + inertia_offset + bob_offset * 5 var target_offset = mouse_offset + inertia_offset + bob_offset * 5
var weighted_lerp = 1.0 - exp(-PlayerConsts.UI_MOVEMENT_SPEED * delta) var weighted_lerp = 1.0 - exp(-PlayerConsts.UI_MOVEMENT_SPEED * delta)
ui.position = ui.position.lerp(ui_base_position + target_offset, weighted_lerp) ui.position = ui.position.lerp(ui_base_position + target_offset, weighted_lerp)
var ui_scaling_target = Vector2(-cam_local_vel.z * PlayerConsts.UI_MOVEMENT_SENSITIVITY * .002 + 1.0, -cam_local_vel.z * PlayerConsts.UI_MOVEMENT_SENSITIVITY * .002 + 1.0) var target_scale = -cam_local_vel.z * PlayerConsts.UI_MOVEMENT_SENSITIVITY * .01 + 1
ui.offset_transform_scale = ui.offset_transform_scale.lerp(ui_scaling_target, weighted_lerp)
var ui_scaling_target = Vector2(target_scale, target_scale)
ui.offset_transform_scale = ui.offset_transform_scale.lerp(Vector2.ONE * ui_scaling_target, weighted_lerp)
var lean_dir = -Input.get_axis("lean_left", "lean_right") * .1
var ui_rotation_target = -inertia_offset.x - mouse_offset.x * 0.25 var ui_rotation_target = -inertia_offset.x - mouse_offset.x * 0.25
ui.offset_transform_rotation = lerpf(ui.offset_transform_rotation, ui_rotation_target * PlayerConsts.UI_MOVEMENT_SENSITIVITY * 0.003, weighted_lerp) ui.offset_transform_rotation = lerpf(ui.offset_transform_rotation, ui_rotation_target * PlayerConsts.UI_MOVEMENT_SENSITIVITY * 0.003 + lean_dir, weighted_lerp)
_last_camera_global_position = camera.global_position _last_camera_position = camera.position
func footstep_sound(): func footstep_sound():
var current_sin_pos = sin(t_bob * PlayerConsts.CAMERA_BOB_FREQUENCY) var current_sin_pos = sin(t_bob * PlayerConsts.CAMERA_BOB_FREQUENCY)

View file

@ -4,3 +4,10 @@ extends Control
func change_text(text:String): func change_text(text:String):
label.text = text label.text = text
func hide_fo_sho():
if visible == true:
visible = false
func _ready() -> void:
UiManager.in_game_menu.visibility_changed.connect(hide_fo_sho)

View file

@ -40,7 +40,7 @@ var _current_breath_in_sound = null
var _current_breath_out_sound = null var _current_breath_out_sound = null
var _current_leg_is_right = false var _current_leg_is_right = false
@export var player: CharacterBody3D @export var player: Player
@export var left_foot: SpatialAudio3D @export var left_foot: SpatialAudio3D
@export var right_foot: SpatialAudio3D @export var right_foot: SpatialAudio3D
@ -82,7 +82,6 @@ func _ready() -> void:
get_tree().create_timer(1).timeout.connect(init_wind) get_tree().create_timer(1).timeout.connect(init_wind)
GlobalSignals.toggle_flashlight.connect(play_flashlight_sound)
func _process(delta: float) -> void: func _process(delta: float) -> void:
if audio_cooldowns != null: if audio_cooldowns != null:

View file

@ -1,7 +1,12 @@
class_name StaminaComponent extends Node class_name StaminaComponent extends Node
var stamina_recharge: bool = true var stamina_recharge: bool = true
var stamina: float = 100.0
var stamina: float = 100.0:
set(new_value):
stamina = new_value
stamina_changed.emit(new_value)
var running: bool = false var running: bool = false
## how many seconds to wait for stamina recharge ## how many seconds to wait for stamina recharge
@ -13,31 +18,30 @@ signal stamina_changed(cur_stamina:float)
var _timer: Timer = Timer.new() var _timer: Timer = Timer.new()
func restart_timer(): func restart_timer():
print("restart timer")
stamina_recharge = false stamina_recharge = false
_timer.start() _timer.start()
func _process(delta: float) -> void: func _process(delta: float) -> void:
if stamina_recharge: if stamina_recharge and stamina <= 100:
if stamina <= 100:
add_stamina(10 * delta) add_stamina(10 * delta)
if running: if running and stamina > 0:
if stamina > 0:
remove_stamina(PlayerConsts.SPRINT_STAMINA_COST * delta) remove_stamina(PlayerConsts.SPRINT_STAMINA_COST * delta)
func remove_stamina(by:float) -> void: func remove_stamina(by:float) -> void:
stamina = move_toward(stamina, 0, by) stamina = move_toward(stamina, 0, by)
stamina_changed.emit(stamina)
func add_stamina(by:float) -> void: func add_stamina(by:float) -> void:
stamina = move_toward(stamina, 100, by) stamina = move_toward(stamina, 100, by)
stamina_changed.emit(stamina)
func jump() -> void: func jump() -> void:
remove_stamina(PlayerConsts.JUMP_STAMINA_COST) remove_stamina(PlayerConsts.JUMP_STAMINA_COST)
restart_timer()
func run(is_running:bool) -> void: func run(is_running:bool) -> void:
if not is_running and running:
restart_timer()
running = is_running running = is_running
stamina_recharge = false stamina_recharge = false
@ -46,5 +50,3 @@ func _ready() -> void:
_timer.autostart = false _timer.autostart = false
_timer.timeout.connect(func (): stamina_recharge = true) _timer.timeout.connect(func (): stamina_recharge = true)
add_child(_timer) add_child(_timer)
GlobalSignals.stamina_recharge_off.connect(restart_timer)

View file

@ -27,6 +27,19 @@ var _breath_change_points: Array[float] = [10, 20, 50, 80]
var flying: bool = false var flying: bool = false
func handle_state_change(new_state:String):
match new_state:
"idle":
is_idle()
"walking":
is_walking()
"running":
is_running()
"crouching":
is_crouching()
_:
print("invalid state")
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
var stamina = player.stamina_component.stamina var stamina = player.stamina_component.stamina
if stamina == 0: if stamina == 0:
@ -56,26 +69,22 @@ func jump():
func land(): func land():
flying = false flying = false
func is_crouched(yes:bool): func is_crouching():
if yes: crouching = true
crouching = true walking = false
walking = false running = false
running = false
else:
crouching = false
func is_walking(yes:bool): func is_walking():
if yes: crouching = false
crouching = false walking = true
walking = true running = false
running = false
else:
walking = false
func is_running(yes:bool): func is_running():
if yes: crouching = false
crouching = false walking = false
walking = false running = true
running = true
else: func is_idle():
running = false crouching = false
walking = false
running = false

View file

@ -8,13 +8,17 @@ extends Control
var context = {} var context = {}
var spaces: Dictionary = {"player" : "everything that is to do with the player", "level" : "everything that is to do with the level", "server" : "everything that is to do with the server"} var spaces: Dictionary = {"player" : "everything that is to do with the player", "level" : "everything that is to do with the level", "server" : "everything that is to do with the server"}
var player_commands: Dictionary = {"add_inventory_slot" : "add a slot to your inventory. max inv slots = 5", "remove_inventory_slot" : "remove a slot from your inventory. min inv slots = 2"} var player_commands: Dictionary = {
"add_inventory_slot" : "add a slot to your inventory. max inv slots = 5",
"remove_inventory_slot" : "remove a slot from your inventory. min inv slots = 2",
"speed": "Change the base speed of the player"}
var level_commands: Dictionary = {"reset": "resets the current level"} var level_commands: Dictionary = {"reset": "resets the current level"}
var avaliable_commands: Dictionary = { var avaliable_commands: Dictionary = {
"help" : "print the available commands. \"help player\" prints the available commands for the player", "help" : "print the available commands. \"help player\" prints the available commands for the player",
"clear" : "clear the console", "clear" : "clear the console",
"whoami" : "returns the player node as text", "whoami" : "returns the player node as text",
"exit" : "currently just exits the game fully"} "exit" : "currently just exits the game fully"}
var toggled: bool = false var toggled: bool = false
## print to the console from the console line and empty it, like a submit ## print to the console from the console line and empty it, like a submit
@ -122,17 +126,19 @@ func parsed_command(command:String):
if command == "": if command == "":
return return
var space = command.split(".") var args = command.split(" ", false)
var parts = command.split(" ", false) var space = args[0].split(".")
if space.size() < 2: if space.size() < 2:
match parts[0]: match args[0]:
"help": "help":
print_help(parts[1] if (parts.size() > 1) else "") print_help(args[1] if (args.size() > 1) else "")
"whoami": "whoami":
print_to_console_from_console(context["player"] if context.has("player") else "bruh") print_to_console_from_console(context["player"] if context.has("player") else "bruh")
"clear": "clear":
clear_console() clear_console()
"exit":
get_tree().quit()
_: _:
print_command_not_found(command) print_command_not_found(command)
@ -141,11 +147,24 @@ func parsed_command(command:String):
"player": "player":
match space[1]: match space[1]:
"add_inventory_slot": "add_inventory_slot":
emit_signal("add_inventory") var success = Player.player.inventory_component.add_inventory_slot()
print_to_console_from_console("Added inventory slot.") if success:
print_to_console_from_console("Added inventory slot.")
else:
print_to_console_from_console("Failed to add inventory slot.")
"remove_inventory_slot": "remove_inventory_slot":
emit_signal("remove_inventory") var success = Player.player.inventory_component.remove_inventory_slot()
print_to_console_from_console("Removed inventory slot.") if success:
print_to_console_from_console("Removed inventory slot.")
else:
print_to_console_from_console("Failed to remove inventory slot.")
"speed":
var new_speed = args.get(1)
if new_speed == "":
print_to_console_from_console("Usage: player.speed <speed>. <speed>: set the speed of the player.")
else:
print_to_console_from_console("Player speed set to ", str(new_speed), " from ", str(PlayerConsts.SPEED))
PlayerConsts.SPEED = float(args[1])
_: _:
print_command_not_found(command) print_command_not_found(command)
"level": "level":
@ -159,24 +178,29 @@ func parsed_command(command:String):
console_input.text = "" console_input.text = ""
signal add_inventory
signal remove_inventory
func _ready() -> void: func _ready() -> void:
console_input.caret_blink = true console_input.caret_blink = true
console_input.text_submitted.connect(parsed_command) console_input.text_submitted.connect(parsed_command)
console_input.text_changed.connect(show_suggestions) console_input.text_changed.connect(show_suggestions)
suggestions_list.item_selected.connect(fill_from_suggestion) suggestions_list.item_selected.connect(fill_from_suggestion)
func toggle():
toggled = !toggled
if toggled:
console_input.grab_focus()
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else:
console_input.release_focus()
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if Input.is_action_just_pressed("toggle_console") and not Input.is_key_pressed(KEY_SHIFT) or (toggled and Input.is_action_just_pressed("open_menu")): if (\
toggled = !toggled Input.is_action_just_pressed("toggle_console") \
if toggled: and not Input.is_key_pressed(KEY_SHIFT) \
console_input.grab_focus() or (toggled and Input.is_action_just_pressed("open_menu"))\
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE ) and not UiManager.in_game_menu.visible:
else: get_tree().create_timer(0.01).timeout.connect(toggle)
console_input.release_focus()
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
get_tree().create_timer(.1).timeout.connect(console_input.clear) get_tree().create_timer(.1).timeout.connect(console_input.clear)
if toggled and (Input.is_action_just_pressed("ui_text_completion_accept") or Input.is_key_pressed(KEY_ENTER)) and suggestions_list.item_count > 0: if toggled and (Input.is_action_just_pressed("ui_text_completion_accept") or Input.is_key_pressed(KEY_ENTER)) and suggestions_list.item_count > 0:

View file

@ -0,0 +1,57 @@
[gd_scene format=3 uid="uid://y5f3db7clptv"]
[ext_resource type="Script" uid="uid://d0g3mdq54p7oh" path="res://scenes/ui/in_game_menu/in_game_menu_manager.gd" id="1_7ec4o"]
[ext_resource type="PackedScene" uid="uid://bfg4q1t8s06vv" path="res://scenes/ui/optimized_blur_panel.tscn" id="2_cltva"]
[ext_resource type="PackedScene" uid="uid://bsxojyyayxo1m" path="res://scenes/ui/options_menu/options.tscn" id="3_cltva"]
[sub_resource type="ButtonGroup" id="ButtonGroup_cltva"]
[node name="InGameMenu" type="Control" unique_id=1952418949]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_7ec4o")
[node name="OptimizedBlurPanel" parent="." unique_id=1779763293 instance=ExtResource("2_cltva")]
layout_mode = 1
[node name="Selections" type="AspectRatioContainer" parent="." unique_id=1893717599]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.3
anchor_top = 0.2
anchor_right = 0.7
anchor_bottom = 0.6
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="Selections" unique_id=1878750362]
layout_mode = 2
[node name="ResumeButton" type="Button" parent="Selections/VBoxContainer" unique_id=1513125674]
layout_mode = 2
text = "Resume"
[node name="OptionsButton" type="Button" parent="Selections/VBoxContainer" unique_id=1588767106]
unique_name_in_owner = true
layout_mode = 2
text = "Options"
[node name="Exit" type="Button" parent="Selections/VBoxContainer" unique_id=1958391122]
layout_mode = 2
text = "Exit"
[node name="Options" parent="." unique_id=855035058 instance=ExtResource("3_cltva")]
unique_name_in_owner = true
visible = false
layout_mode = 1
categories = SubResource("ButtonGroup_cltva")
[connection signal="pressed" from="Selections/VBoxContainer/ResumeButton" to="." method="_on_resume_button_pressed"]
[connection signal="pressed" from="Selections/VBoxContainer/OptionsButton" to="." method="_on_options_pressed"]
[connection signal="pressed" from="Selections/VBoxContainer/Exit" to="." method="_on_exit_pressed"]
[connection signal="visibility_changed" from="Options" to="." method="_on_options_visibility_changed"]

View file

@ -0,0 +1,20 @@
extends Control
func toggle_menu():
if Console.toggled:
visible = !visible
func _on_exit_pressed() -> void:
get_tree().quit()
func _on_options_pressed() -> void:
%Selections.visible = false
%Options.visible = true
func _on_options_visibility_changed() -> void:
if not %Options.visible:
%Selections.visible = true
func _on_resume_button_pressed() -> void:
self.visible = false
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED

View file

@ -1,21 +1,26 @@
extends CanvasLayer extends PanelContainer
var done: bool = false
func sound_loading(): func sound_loading():
print("loading screen shown") print("loading screen shown")
show() show()
func sound_loading_done(): func sound_loading_done():
print("loading screen hidden") print("loading screen hidden")
hide() #hide()
%Label.text = "Done!"
done = true
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
Sounds.loading_sounds.connect(sound_loading) Sounds.loading.connect(sound_loading)
Sounds.loading_sounds_done.connect(sound_loading_done) Sounds.loading_done.connect(sound_loading_done)
pass # Replace with function body. pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _process(delta: float) -> void:
pass if done and %ColorRect.color != Color(0,0,0,0):
%ColorRect.color = lerp(%ColorRect.color, Color(0,0,0,0), delta)

View file

@ -2,18 +2,19 @@
[ext_resource type="Script" uid="uid://br8pa51piwxuy" path="res://scenes/ui/loading_screen/loading_screen.gd" id="1_rqdcv"] [ext_resource type="Script" uid="uid://br8pa51piwxuy" path="res://scenes/ui/loading_screen/loading_screen.gd" id="1_rqdcv"]
[node name="LoadingScreen" type="CanvasLayer" unique_id=721141233] [node name="LoadingScreen" type="PanelContainer" unique_id=1023721034]
script = ExtResource("1_rqdcv")
[node name="Control" type="Control" parent="." unique_id=2009868353]
layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_rqdcv")
[node name="Control" type="Control" parent="." unique_id=2009868353]
layout_mode = 2
[node name="ColorRect" type="ColorRect" parent="Control" unique_id=1237635531] [node name="ColorRect" type="ColorRect" parent="Control" unique_id=1237635531]
unique_name_in_owner = true
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -22,7 +23,19 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
color = Color(0, 0, 0, 1) color = Color(0, 0, 0, 1)
[node name="Label" type="Label" parent="Control/ColorRect" unique_id=1444927305] [node name="ProgressBar" type="ProgressBar" parent="Control" unique_id=1865933389]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_top = 0.96
anchor_right = 1.0
anchor_bottom = 0.98
offset_top = -27.0
grow_horizontal = 2
grow_vertical = 0
show_percentage = false
[node name="Label" type="Label" parent="Control" unique_id=1444927305]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
@ -36,15 +49,3 @@ grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
theme_override_font_sizes/font_size = 50 theme_override_font_sizes/font_size = 50
text = "loading..." text = "loading..."
[node name="ProgressBar" type="ProgressBar" parent="Control/ColorRect" unique_id=1865933389]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_top = 0.96
anchor_right = 1.0
anchor_bottom = 0.98
offset_top = -27.0
grow_horizontal = 2
grow_vertical = 0
show_percentage = false

View file

@ -0,0 +1,120 @@
extends VBoxContainer
class_name DynamicOptionsMenu
# 1. We store the current options class and a dictionary of unsaved changes
var _current_target: Object
var pending_changes: Dictionary = {}
func build_menu(options_node: Options) -> void:
_current_target = options_node
pending_changes.clear() # Wipe any old unsaved changes when loading a new menu
for child in get_children():
child.queue_free()
var properties = options_node.get_property_list()
for prop in properties:
if prop["usage"] & PROPERTY_USAGE_SCRIPT_VARIABLE:
var prop_name = prop["name"]
if prop_name.ends_with("_options"):
continue
var current_value = options_node.get(prop_name)
var ui_row = _create_ui_row(prop, current_value)
if ui_row:
add_child(ui_row)
# Add a spacer to push the button down a bit
add_child(HSeparator.new())
# 2. When pressed, push all staged changes to the actual target class
func on_accept_pressed() -> void:
for prop_name in pending_changes:
var value = pending_changes[prop_name]
_current_target.set(prop_name, value)
# Clear the dictionary so we don't re-apply old changes later
pending_changes.clear()
print("Changes Applied!")
func _create_ui_row(prop: Dictionary, value: Variant) -> Control:
var row = HBoxContainer.new()
var prop_name = prop["name"]
var label = Label.new()
label.text = prop_name.capitalize()
label.custom_minimum_size = Vector2(250, 0)
row.add_child(label)
# --- ENUMS (Dropdowns) ---
if prop["hint"] == PROPERTY_HINT_ENUM:
var dropdown = OptionButton.new()
dropdown.size_flags_horizontal = Control.SIZE_EXPAND_FILL
var enum_names = prop["hint_string"].split(",")
for i in range(enum_names.size()):
dropdown.add_item(enum_names[i], i)
dropdown.selected = value
# THE FIX: Save to dictionary instead of setting directly!
dropdown.item_selected.connect(func(index: int): pending_changes[prop_name] = index)
row.add_child(dropdown)
return row
# --- STANDARD TYPES ---
match typeof(value):
TYPE_BOOL:
var checkbox = CheckBox.new()
checkbox.button_pressed = value
checkbox.toggled.connect(func(toggled: bool): pending_changes[prop_name] = toggled)
row.add_child(checkbox)
TYPE_FLOAT, TYPE_INT:
var slider = HSlider.new()
slider.size_flags_horizontal = Control.SIZE_EXPAND_FILL
slider.min_value = 0.0
slider.max_value = 100.0
slider.step = 0.1 if typeof(value) == TYPE_FLOAT else 1.0
slider.value = float(value)
slider.value_changed.connect(func(new_val: float):
var final_val = new_val if typeof(value) == TYPE_FLOAT else int(new_val)
pending_changes[prop_name] = final_val
)
row.add_child(slider)
TYPE_VECTOR2:
if prop_name == "current_resolution" and "available_resolutions" in _current_target:
var dropdown = OptionButton.new()
dropdown.size_flags_horizontal = Control.SIZE_EXPAND_FILL
var resolutions: Array = _current_target.get("available_resolutions")
var current_res_index = 0
for i in range(resolutions.size()):
var res: Vector2 = resolutions[i]
var res_string = str(res.x) + " x " + str(res.y)
dropdown.add_item(res_string, i)
if res == value:
current_res_index = i
dropdown.selected = current_res_index
dropdown.item_selected.connect(func(index: int):
pending_changes[prop_name] = resolutions[index]
)
row.add_child(dropdown)
else:
var generic_label = Label.new()
generic_label.text = str(value)
row.add_child(generic_label)
_:
row.queue_free()
return null
return row

View file

@ -0,0 +1 @@
uid://k30jbtdr3xd3

View file

@ -0,0 +1,36 @@
extends Control
@export var categories: ButtonGroup
@onready var options_container: OptionsContainer = %OptionsContainer
var gameplay_options: GameplayOptions = GameplayOptions.new()
var audio_options: AudioOptions = AudioOptions.new()
var display_options: DisplayOptions = DisplayOptions.new()
var control_options: ControlOptions = ControlOptions.new()
func change_options():
var button: Button = categories.get_pressed_button()
match button.text:
" Gameplay ":
print("gaming")
options_container.build(gameplay_options)
" Display ":
print("grafix")
options_container.build(display_options)
" Audio ":
print("whoaaa sound")
options_container.build(audio_options)
" Controls ":
print("control deez nuts")
options_container.build(control_options)
_:
print("bruh xd")
func _ready() -> void:
for button in categories.get_buttons():
button.pressed.connect(change_options)
%AcceptButton.pressed.connect(options_container.accept)
func _on_cancel_button_pressed() -> void:
self.visible = false

View file

@ -0,0 +1 @@
uid://3k85lw33r4j2

View file

@ -0,0 +1,116 @@
[gd_scene format=3 uid="uid://bsxojyyayxo1m"]
[ext_resource type="Script" uid="uid://3k85lw33r4j2" path="res://scenes/ui/options_menu/options.gd" id="1_c8rm1"]
[ext_resource type="PackedScene" uid="uid://b7kfwgahpib6l" path="res://scenes/ui/options_menu/options_menu.tscn" id="2_ts0bl"]
[ext_resource type="ButtonGroup" uid="uid://bm4hwoio7vovb" path="res://classes/options/options.tres" id="2_vwtc4"]
[node name="Options" type="Control" unique_id=855035058]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_c8rm1")
categories = ExtResource("2_vwtc4")
[node name="TopBarContainer" type="MarginContainer" parent="." unique_id=779856530]
layout_mode = 1
anchors_preset = -1
anchor_top = 0.05
anchor_right = 1.0
anchor_bottom = 0.12
grow_horizontal = 2
theme_override_constants/margin_left = 0
theme_override_constants/margin_top = 0
theme_override_constants/margin_right = 0
theme_override_constants/margin_bottom = 0
[node name="HBoxContainer" type="HBoxContainer" parent="TopBarContainer" unique_id=287094567]
layout_mode = 2
size_flags_horizontal = 4
[node name="GameplayButton" type="Button" parent="TopBarContainer/HBoxContainer" unique_id=1424084920]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 32
toggle_mode = true
button_pressed = true
button_group = ExtResource("2_vwtc4")
text = " Gameplay "
[node name="VSeparator" type="VSeparator" parent="TopBarContainer/HBoxContainer" unique_id=1644723778]
layout_mode = 2
theme_override_constants/separation = 125
[node name="DisplayButton" type="Button" parent="TopBarContainer/HBoxContainer" unique_id=600179838]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 32
toggle_mode = true
button_group = ExtResource("2_vwtc4")
text = " Display "
[node name="VSeparator2" type="VSeparator" parent="TopBarContainer/HBoxContainer" unique_id=666020065]
layout_mode = 2
theme_override_constants/separation = 125
[node name="AudioButton" type="Button" parent="TopBarContainer/HBoxContainer" unique_id=1083162184]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 32
toggle_mode = true
button_group = ExtResource("2_vwtc4")
text = " Audio "
[node name="VSeparator3" type="VSeparator" parent="TopBarContainer/HBoxContainer" unique_id=812392494]
layout_mode = 2
theme_override_constants/separation = 125
[node name="ControlsButton" type="Button" parent="TopBarContainer/HBoxContainer" unique_id=61824299]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 32
toggle_mode = true
button_group = ExtResource("2_vwtc4")
text = " Controls "
[node name="OptionsContainer" parent="." unique_id=1863015247 instance=ExtResource("2_ts0bl")]
unique_name_in_owner = true
layout_mode = 1
anchor_bottom = 0.88
grow_horizontal = 2
grow_vertical = 2
[node name="AcceptContainer" type="MarginContainer" parent="." unique_id=826679851]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.8
anchor_top = 0.9
anchor_right = 0.9
anchor_bottom = 0.95
grow_horizontal = 0
grow_vertical = 0
[node name="AcceptButton" type="Button" parent="AcceptContainer" unique_id=1423598466]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Accept"
[node name="CancelContainer" type="MarginContainer" parent="." unique_id=135907360]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.1
anchor_top = 0.9
anchor_right = 0.2
anchor_bottom = 0.95
grow_vertical = 0
[node name="CancelButton" type="Button" parent="CancelContainer" unique_id=1447048560]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Cancel"
[connection signal="pressed" from="CancelContainer/CancelButton" to="." method="_on_cancel_button_pressed"]

View file

@ -0,0 +1,140 @@
class_name OptionsContainer extends MarginContainer
@onready var option_v_box_container: VBoxContainer = %OptionVBoxContainer
var cur_options: Options = null
func build(options: Options):
option_v_box_container.build_menu(options)
func accept():
option_v_box_container.on_accept_pressed()
func clear_options():
for x in option_v_box_container.get_children():
x.queue_free()
func load_from_dictionary(list:Dictionary[String,Array]):
var options
if list is Dictionary:
for option_name in list.keys():
options = list.get(option_name)
if options is not Array and options is String:
match options:
"slider":
create_slider_option(option_name)
"toggle":
create_toggle_option(option_name)
_:
print("Error???????")
else:
create_dropdown_option(option_name, options)
var changed_settings: Dictionary = {}
func add_setting_change(setting:String, value:Variant):
print(setting)
print(value)
print()
## "toggle" --> bool [br]
## "slider" --> float [br]
## "menubar" --> int (enum) [br]
## "" --> fail
func eval_property(property:Variant) -> String:
match typeof(property):
TYPE_BOOL:
return "toggle"
TYPE_FLOAT:
return "slider"
TYPE_INT:
return "menubar"
_:
return ""
func load_gameplay_options():
clear_options()
var opt_dict: Dictionary = {}
for property in cur_options.get_property_list():
if property["usage"]:
opt_dict.get_or_add(property["name"], eval_property(property["type"]))
print(opt_dict)
func load_display_options():
clear_options()
func load_audio_options():
clear_options()
func load_control_options():
clear_options()
func create_dropdown_option(option_name:String, menu_items:Array[String]):
var option: HBoxContainer = HBoxContainer.new()
var name_label: Label = Label.new()
name_label.text = option_name
option.add_child(name_label)
var vsep: VSeparator = VSeparator.new()
option.add_child(vsep)
var items: MenuButton = MenuButton.new()
for item: String in menu_items:
items.get_popup().add_item(item)
option.add_child(items)
option_v_box_container.add_child(option)
func create_slider_option(option_name:String):
var option: HBoxContainer = HBoxContainer.new()
var name_label: Label = Label.new()
name_label.text = option_name
option.add_child(name_label)
var vsep: VSeparator = VSeparator.new()
option.add_child(vsep)
var slider: HSlider = HSlider.new()
slider.value_changed.connect(func(value): add_setting_change(name_label.text, value))
option.add_child(slider)
option_v_box_container.add_child(option)
func create_toggle_option(option_name:String):
var option: HBoxContainer = HBoxContainer.new()
var name_label: Label = Label.new()
name_label.text = option_name
option.add_child(name_label)
var vsep: VSeparator = VSeparator.new()
option.add_child(vsep)
var toggle: CheckButton = CheckButton.new()
option.add_child(toggle)
option.value_changed.connect(func(value): add_setting_change(name_label.text, value))
option_v_box_container.add_child(option)
func get_current_options(cur_type: Options.type) -> Options:
var cur_options: Options = Options.new()
match cur_type:
Options.type.GAMEPLAY:
pass
Options.type.GRAPHICS:
pass
Options.type.CONTROLS:
pass
Options.type.AUDIO:
pass
_:
print("what?")
return cur_options

View file

@ -0,0 +1 @@
uid://el28aecmghao

View file

@ -0,0 +1,719 @@
[gd_scene format=3 uid="uid://b7kfwgahpib6l"]
[ext_resource type="Script" uid="uid://el28aecmghao" path="res://scenes/ui/options_menu/options_menu.gd" id="1_7iv5r"]
[ext_resource type="Script" uid="uid://k30jbtdr3xd3" path="res://scenes/ui/options_menu/option_v_box_container.gd" id="2_r4unu"]
[node name="OptionsContainer" type="MarginContainer" unique_id=1863015247]
anchors_preset = -1
anchor_left = 0.1
anchor_top = 0.15
anchor_right = 0.9
anchor_bottom = 0.9
script = ExtResource("1_7iv5r")
[node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=1207232963]
layout_mode = 2
[node name="OptionVBoxContainer" type="VBoxContainer" parent="ScrollContainer" unique_id=1263511396]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("2_r4unu")
[node name="HBoxContainer" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=2064884046]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer" unique_id=1470900557]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderToggle"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer" unique_id=1123645919]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="CheckButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer" unique_id=341929844]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme_override_font_sizes/font_size = 24
text = "Placeholder"
[node name="HSeparator" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=1403251296]
layout_mode = 2
[node name="HBoxContainer2" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=792932746]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer2" unique_id=1845897221]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderSlider"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer2" unique_id=234834841]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="HSlider" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer2" unique_id=565631092]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
tick_count = 10
ticks_on_borders = true
ticks_position = 3
[node name="HSeparator2" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=998097463]
layout_mode = 2
[node name="HBoxContainer3" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=535877983]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer3" unique_id=600791186]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer3" unique_id=308700372]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer3" unique_id=211770037]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator3" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=352360141]
layout_mode = 2
[node name="HBoxContainer4" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1572767988]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer4" unique_id=254345886]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer4" unique_id=168985391]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer4" unique_id=1776626556]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator4" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=1002587289]
layout_mode = 2
[node name="HBoxContainer5" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1696185096]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer5" unique_id=902394128]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer5" unique_id=352584674]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer5" unique_id=2059477888]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator5" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=762265794]
layout_mode = 2
[node name="HBoxContainer6" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1897210220]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer6" unique_id=516143864]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer6" unique_id=317664083]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer6" unique_id=568147442]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator6" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=836333848]
layout_mode = 2
[node name="HBoxContainer7" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=225734071]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer7" unique_id=2135551806]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer7" unique_id=1698435667]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer7" unique_id=207229310]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator7" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=1004318387]
layout_mode = 2
[node name="HBoxContainer8" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=142882125]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer8" unique_id=505876258]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer8" unique_id=208073860]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer8" unique_id=438734505]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator8" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=1515563444]
layout_mode = 2
[node name="HBoxContainer9" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1649607799]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer9" unique_id=1567354335]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer9" unique_id=409171357]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer9" unique_id=554976983]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator9" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=1213571848]
layout_mode = 2
[node name="HBoxContainer10" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=829747120]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer10" unique_id=1480665773]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer10" unique_id=82746545]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer10" unique_id=1158187677]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator10" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=1020254430]
layout_mode = 2
[node name="HBoxContainer11" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1115408400]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer11" unique_id=1814867734]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer11" unique_id=43870637]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer11" unique_id=2056559556]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator11" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=841172333]
layout_mode = 2
[node name="HBoxContainer12" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1520008506]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer12" unique_id=1159755317]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer12" unique_id=1899878929]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer12" unique_id=37958088]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator12" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=922644639]
layout_mode = 2
[node name="HBoxContainer13" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1559409107]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer13" unique_id=1414388714]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer13" unique_id=1849484609]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer13" unique_id=1417669644]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator13" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=658065751]
layout_mode = 2
[node name="HBoxContainer14" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1687854687]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer14" unique_id=164943382]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer14" unique_id=867754852]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer14" unique_id=155061973]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator14" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=1166812914]
layout_mode = 2
[node name="HBoxContainer15" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=677346915]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer15" unique_id=1131119490]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer15" unique_id=1375481550]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer15" unique_id=1712296380]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator15" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=2110821977]
layout_mode = 2
[node name="HBoxContainer16" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=706914632]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer16" unique_id=246258127]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer16" unique_id=159444398]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer16" unique_id=2009660801]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator16" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=56922745]
layout_mode = 2
[node name="HBoxContainer17" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1873255868]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer17" unique_id=1032028686]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer17" unique_id=282916478]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer17" unique_id=239394729]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator17" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=339168536]
layout_mode = 2
[node name="HBoxContainer18" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=317194434]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer18" unique_id=56479777]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer18" unique_id=806960288]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer18" unique_id=828304466]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator18" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=1115657811]
layout_mode = 2
[node name="HBoxContainer19" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1272570714]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer19" unique_id=2117757791]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer19" unique_id=2102063113]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer19" unique_id=557615590]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator19" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=413044252]
layout_mode = 2
[node name="HBoxContainer20" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=2088533973]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer20" unique_id=1917639774]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer20" unique_id=331540352]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer20" unique_id=1989040147]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator20" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=564902416]
layout_mode = 2
[node name="HBoxContainer21" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1723164632]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer21" unique_id=72435750]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer21" unique_id=1999349952]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer21" unique_id=576358987]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator21" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=778620254]
layout_mode = 2
[node name="HBoxContainer22" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=987325327]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer22" unique_id=1021879753]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer22" unique_id=1412463535]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer22" unique_id=1903411914]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2
[node name="HSeparator22" type="HSeparator" parent="ScrollContainer/OptionVBoxContainer" unique_id=1266096924]
layout_mode = 2
[node name="HBoxContainer23" type="HBoxContainer" parent="ScrollContainer/OptionVBoxContainer" unique_id=1120582388]
layout_mode = 2
[node name="Label" type="Label" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer23" unique_id=1595376496]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 24
text = "PlaceHolderMenu"
horizontal_alignment = 2
[node name="VSeparator" type="VSeparator" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer23" unique_id=623130886]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label2" type="MenuButton" parent="ScrollContainer/OptionVBoxContainer/HBoxContainer23" unique_id=1687009271]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Placeholder"
alignment = 2
item_count = 3
popup/item_0/text = "Placeholder1"
popup/item_0/id = 0
popup/item_1/text = "Placeholder2"
popup/item_1/id = 1
popup/item_2/text = "Placeholder3"
popup/item_2/id = 2

View file

@ -7,11 +7,11 @@ func toggle_debug_menu():
debug_menu.visible = !debug_menu.visible debug_menu.visible = !debug_menu.visible
func toggle_in_game_menu(): func toggle_in_game_menu():
in_game_menu.visible = !in_game_menu.visible if not Console.toggled:
in_game_menu.visible = !in_game_menu.visible
if in_game_menu.visible: if in_game_menu.visible:
GameState.player.ui.visible = false GameState.player.ui.visible = false
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else: else:
GameState.player.ui.visible = true GameState.player.ui.visible = true
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED Input.mouse_mode = Input.MOUSE_MODE_CAPTURED

View file

@ -1,7 +1,7 @@
[gd_scene format=3 uid="uid://dtrfb3xosj32r"] [gd_scene format=3 uid="uid://dtrfb3xosj32r"]
[ext_resource type="Script" uid="uid://33wtl3qa013n" path="res://scenes/ui/ui_manager.gd" id="1_b2463"] [ext_resource type="Script" uid="uid://33wtl3qa013n" path="res://scenes/ui/ui_manager.gd" id="1_b2463"]
[ext_resource type="PackedScene" uid="uid://y5f3db7clptv" path="res://scenes/player/in_game_menu.tscn" id="2_js4l8"] [ext_resource type="PackedScene" uid="uid://y5f3db7clptv" path="res://scenes/ui/in_game_menu/in_game_menu.tscn" id="2_js4l8"]
[ext_resource type="PackedScene" uid="uid://c57oxgn18vrdv" path="res://scenes/ui/debug_menu/debug_menu.tscn" id="3_61ox6"] [ext_resource type="PackedScene" uid="uid://c57oxgn18vrdv" path="res://scenes/ui/debug_menu/debug_menu.tscn" id="3_61ox6"]
[node name="UIManager" type="Control" unique_id=585290585] [node name="UIManager" type="Control" unique_id=585290585]

View file

@ -49,6 +49,9 @@ var _breath = [
"_exhausted" "_exhausted"
] ]
signal loading
signal loading_done
func get_random_sound(sound_array: Array) -> AudioStream: func get_random_sound(sound_array: Array) -> AudioStream:
if sound_array.is_empty(): if sound_array.is_empty():
return null return null
@ -217,10 +220,10 @@ func _process(delta: float) -> void:
if all_done: if all_done:
is_loading = false is_loading = false
emit_signal("loading_sounds_done") loading_done.emit()
func _ready() -> void: func load_sounds():
emit_signal("loading_sounds") loading.emit()
load_breath_sounds() load_breath_sounds()
load_flashlight_sounds() load_flashlight_sounds()
@ -229,5 +232,9 @@ func _ready() -> void:
# Because load() is synchronous, by the time the code reaches this line, # Because load() is synchronous, by the time the code reaches this line,
# every single audio file is guaranteed to be 100% loaded. # every single audio file is guaranteed to be 100% loaded.
emit_signal("loading_sounds_done") loading_done.emit()
func _ready() -> void:
#for now always call his ass
load_sounds()