Compare commits

...

5 Commits

9 changed files with 168 additions and 54 deletions

View File

@ -0,0 +1,7 @@
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cma1dv10wxujx"]
[ext_resource type="FontFile" uid="uid://c6cka2yptj3qq" path="res://Assets/Resources/vcr-jp.ttf" id="1_ucrwf"]
[resource]
default_font = ExtResource("1_ucrwf")
default_font_size = 25

View File

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

View File

@ -1,6 +1,9 @@
[gd_scene load_steps=2 format=3 uid="uid://bwo6gvmi3jcqt"]
[gd_scene load_steps=5 format=3 uid="uid://bwo6gvmi3jcqt"]
[ext_resource type="Script" path="res://Assets/scripts/Pause Screen.gd" id="1_tqif2"]
[ext_resource type="Theme" uid="uid://bm7gkjfqwmc3i" path="res://Assets/Resources/main_menu_theme.tres" id="1_yky8a"]
[ext_resource type="Theme" uid="uid://cma1dv10wxujx" path="res://Assets/Resources/Themes/Settings_UI_Theme.tres" id="3_3n0hv"]
[ext_resource type="PackedScene" uid="uid://dmut5abf8v8c1" path="res://Assets/components/Settings_Option.tscn" id="4_6nahw"]
[node name="Menus" type="Control"]
layout_mode = 3
@ -9,6 +12,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_yky8a")
script = ExtResource("1_tqif2")
[node name="Pause Menu" type="Control" parent="."]
@ -64,74 +68,74 @@ layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -23.0
offset_top = 42.0
offset_right = -23.0
offset_bottom = 42.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("3_3n0hv")
[node name="Label" type="Label" parent="Settings"]
[node name="ColorRect" type="ColorRect" parent="Settings"]
clip_contents = true
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -20.0
offset_right = 20.0
offset_bottom = 23.0
anchors_preset = -1
anchor_left = 0.253
anchor_top = 0.128
anchor_right = 0.747
anchor_bottom = 0.872
offset_left = 0.23996
offset_top = -0.240005
offset_right = -0.240112
offset_bottom = 0.239929
grow_horizontal = 2
grow_vertical = 2
color = Color(0.164706, 0.172549, 0.215686, 0.662745)
[node name="Label" type="Label" parent="Settings/ColorRect"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 0.063
offset_left = 398.0
offset_top = 25.0
offset_right = -398.0
offset_bottom = 0.348
grow_horizontal = 2
text = "Settings"
[node name="VBoxContainer" type="VBoxContainer" parent="Settings"]
[node name="VBoxContainer" type="VBoxContainer" parent="Settings/ColorRect"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -223.0
offset_top = -430.5
offset_right = 223.0
offset_bottom = 430.5
anchors_preset = -1
anchor_top = 0.088
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 146.0
offset_top = 44.248
offset_right = -151.0
offset_bottom = -16.0
grow_horizontal = 2
grow_vertical = 2
[node name="ColorRect" type="ColorRect" parent="Settings/VBoxContainer"]
custom_minimum_size = Vector2(0, 35)
[node name="Setting Option" parent="Settings/ColorRect/VBoxContainer" instance=ExtResource("4_6nahw")]
layout_mode = 2
color = Color(0.184314, 0.184314, 0.184314, 1)
Setting = 0
[node name="HSplitContainer" type="HSplitContainer" parent="Settings/VBoxContainer/ColorRect"]
[node name="Setting Option2" parent="Settings/ColorRect/VBoxContainer" instance=ExtResource("4_6nahw")]
layout_mode = 2
offset_top = 4.0
offset_right = 446.0
offset_bottom = 27.0
Setting = 1
[node name="Label" type="Label" parent="Settings/VBoxContainer/ColorRect/HSplitContainer"]
[node name="Setting Option3" parent="Settings/ColorRect/VBoxContainer" instance=ExtResource("4_6nahw")]
layout_mode = 2
text = "Mouse Sensitity"
Setting = 2
[node name="HSlider" type="HSlider" parent="Settings/VBoxContainer/ColorRect/HSplitContainer"]
[node name="Setting Option4" parent="Settings/ColorRect/VBoxContainer" instance=ExtResource("4_6nahw")]
layout_mode = 2
Setting = 3
[node name="ColorRect2" type="ColorRect" parent="Settings/VBoxContainer"]
custom_minimum_size = Vector2(0, 35)
[node name="Setting Option5" parent="Settings/ColorRect/VBoxContainer" instance=ExtResource("4_6nahw")]
layout_mode = 2
color = Color(0.184314, 0.184314, 0.184314, 1)
Setting = 4
[node name="HSplitContainer" type="HSplitContainer" parent="Settings/VBoxContainer/ColorRect2"]
[node name="Setting Option6" parent="Settings/ColorRect/VBoxContainer" instance=ExtResource("4_6nahw")]
layout_mode = 2
offset_top = 4.0
offset_right = 446.0
offset_bottom = 27.0
[node name="Label" type="Label" parent="Settings/VBoxContainer/ColorRect2/HSplitContainer"]
layout_mode = 2
text = "Joystick Sensativity"
[node name="HSlider" type="HSlider" parent="Settings/VBoxContainer/ColorRect2/HSplitContainer"]
layout_mode = 2
size_flags_horizontal = 4
Setting = 5
[connection signal="pressed" from="Pause Menu/Menu/Resume" to="." method="_on_resume_pressed"]
[connection signal="pressed" from="Pause Menu/Menu/Settings" to="." method="_on_settings_pressed"]

View File

@ -0,0 +1,24 @@
[gd_scene load_steps=2 format=3 uid="uid://dmut5abf8v8c1"]
[ext_resource type="Script" path="res://Assets/scripts/Component Scripts/Settings_Option.gd" id="1_aieqa"]
[node name="Setting Option" type="HBoxContainer"]
custom_minimum_size = Vector2(0, 40)
alignment = 1
script = ExtResource("1_aieqa")
[node name="Label" type="Label" parent="."]
custom_minimum_size = Vector2(400, 0)
layout_mode = 2
text = "Temp String"
horizontal_alignment = 1
vertical_alignment = 1
[node name="HSlider" type="HSlider" parent="."]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
value = 40.0
[connection signal="value_changed" from="HSlider" to="." method="_on_setting_slider_value_changed"]

View File

@ -0,0 +1,11 @@
extends HBoxContainer
@export var Setting:GlobalSettings.Setting = GlobalSettings.Setting.Test_Value
# Called when the node enters the scene tree for the first time.
func _ready():
$Label.text = GlobalSettings.GetSettingName(Setting)
$HSlider.value = GlobalSettings.GetSetting(Setting)
func _on_setting_slider_value_changed(value:float):
GlobalSettings.SetSetting(Setting, value)

View File

@ -7,14 +7,14 @@ var max_angle_radians = 1.5
func _process(delta):
var look_velocity = Input.get_vector("look_left", "look_right", "look_up", "look_down")
var rotate_degree = -look_velocity.y * GlobalSettings.Joystick_Sensitivity
var rotate_degree = -look_velocity.y * GlobalSettings.GetSetting(GlobalSettings.Setting.Joystick_Speed)
rotate_x(rotate_degree)
func _unhandled_input(event):
if event is InputEventMouseMotion:
var mouse_movement = -event.relative.y
var rotate_amount = mouse_movement * GlobalSettings.Mouse_Sensitivity
var rotate_amount = mouse_movement * GlobalSettings.GetSetting(GlobalSettings.Setting.Mouse_Speed)
var rotation_after = rotate_amount + rotation.x
if rotation_after <= max_angle_radians and rotate_amount > 0:
rotate_x(rotate_amount)

View File

@ -1,17 +1,78 @@
extends Node
enum Setting{Mouse_Speed, Joystick_Speed, SFX_Volume, Music_Volume, Voice_Volume, FOV, Test_Value}
var DEVMODE = true
var is_paused = false
var Joystick_Sensitivity = 2
var Mouse_Sensitivity = 0.02
var current_map = ""
var SpawnPoint:Vector3
var Player_Last_Location = Vector3(0,0,0)
var HasGeneratorKey = false
var Settings:Dictionary = {
Setting.Mouse_Speed: {
"value": 0.02,
"text": "Mouse Speed",
"range": Vector2(0.0001, 0.09)
},
Setting.Joystick_Speed: {
"value": 2,
"text": "Mouse Speed",
"range": Vector2(0.5, 4)
},
Setting.SFX_Volume: {
"value": 100,
"text": "SFX Volume",
"range": Vector2(0,100)
},
Setting.Music_Volume: {
"value": 100,
"text": "Music Volume",
"range": Vector2(0,100)
},
Setting.Voice_Volume: {
"value": 100,
"text": "Voice Volume",
"range": Vector2(0,100)
},
Setting.FOV: {
"value": 95,
"text": "FOV",
"range": Vector2(75,115)
},
Setting.Test_Value: {
"value": 69,
"text": "Test Value",
"range": Vector2(0,100)
}
}
var GlobalData:Dictionary = {
"SpawnPoint": Vector3(),
"Player_Last_Location": Vector3()
}
func GetSetting(SettingName):
return Settings.get(SettingName).get("value")
func GetSettingName(SettingName):
return Settings.get(SettingName).get("text")
func GetSettingRange(SettingName):
return Settings.get(SettingName).get("range")
func SetSetting(SettingName, value):
Settings[SettingName]["value"] = value
func PrintSettings():
for setting in Settings.keys():
print(setting, ":", Settings.get(setting))
func SetCurrentMap(selected_map):
current_map = selected_map

View File

@ -50,7 +50,7 @@ func _physics_process(delta):
move_and_slide()
var look_velocity = Input.get_vector("look_left", "look_right", "look_up", "look_down")
rotate_y(-look_velocity.x * GlobalSettings.Joystick_Sensitivity * delta)
rotate_y(-look_velocity.x * GlobalSettings.GetSetting(GlobalSettings.Setting.Joystick_Speed) * delta)
func _process(delta):
#Calculations for seeing if you vaped too many times within a short span
@ -72,7 +72,7 @@ func _input(event):
respawn()
if not is_paused:
if event is InputEventMouseMotion:
rotate_y(-event.relative.x * GlobalSettings.Mouse_Sensitivity)
rotate_y(-event.relative.x * GlobalSettings.GetSetting(GlobalSettings.Setting.Mouse_Speed))
if event.is_action_pressed("vape"):
if current_condition == CONDITION.NORMAL:

View File

@ -104,6 +104,10 @@ interact={
]
}
[internationalization]
locale/translations=PackedStringArray("res://Assets/Translations/English/English.tres")
[layer_names]
3d_physics/layer_1="Terrain"