Added new settings

This commit is contained in:
Eduard Urbach 2024-02-06 12:03:32 +01:00
parent 81670e7df5
commit 651b353340
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
18 changed files with 221 additions and 66 deletions

View File

@ -8,3 +8,5 @@ var auth_token: String
var interacting_with_ui: bool
var instance_id: int
var username: String
var environment: Environment
var camera_attributes: CameraAttributesPractical

View File

@ -1,12 +1,17 @@
extends Node
@export var world_environment: WorldEnvironment
func _enter_tree():
Global.environment = world_environment.environment
Global.camera_attributes = world_environment.camera_attributes
Global.instance_id = OS.get_process_id() % 4
Global.username = "user%d" % Global.instance_id
func _ready():
%Logout.success.emit()
pause(true)
Global.instance_id = OS.get_process_id() % 4
Global.username = "user%d" % Global.instance_id
%Login.success.connect(on_login)
%Logout.success.connect(on_logout)
%Login.send_login()
@ -43,5 +48,12 @@ func toggle_fullscreen():
match mode:
DisplayServer.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
center_window()
_:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
func center_window():
var screen_center := DisplayServer.screen_get_position() + DisplayServer.screen_get_size() / 2
var window := get_window()
var window_size = window.get_size_with_decorations()
window.set_position(screen_center - window_size / 2)

View File

@ -14,7 +14,7 @@
[ext_resource type="Script" path="res://world/Sun.gd" id="11_4jb08"]
[ext_resource type="Environment" uid="uid://dixa0yso2s1u3" path="res://world/Environment.tres" id="12_cscto"]
[ext_resource type="PackedScene" uid="uid://hnn0n1xc2qt7" path="res://assets/tree/Tree.blend" id="14_7jtdl"]
[ext_resource type="CameraAttributesPractical" uid="uid://b835orxyqq6w5" path="res://world/CameraPractical.tres" id="14_e2m00"]
[ext_resource type="CameraAttributesPractical" uid="uid://b835orxyqq6w5" path="res://world/CameraPractical.tres" id="15_6h2nx"]
[ext_resource type="PackedScene" uid="uid://cb2t7bvvf3gwh" path="res://enemy/slime/Slime.tscn" id="15_hgl78"]
[ext_resource type="Script" path="res://world/PlayerManager.gd" id="16_dp6bj"]
[ext_resource type="PackedScene" uid="uid://dagn5bf7ou3sd" path="res://ui/UI.tscn" id="17_43qhq"]
@ -32,8 +32,9 @@ size = Vector2(25, 25)
[sub_resource type="BoxShape3D" id="BoxShape3D_yg2lt"]
size = Vector3(100, 1, 100)
[node name="Main" type="Node"]
[node name="Main" type="Node" node_paths=PackedStringArray("world_environment")]
script = ExtResource("1_cw3ws")
world_environment = NodePath("World/Environment")
[node name="Client" type="Node" parent="."]
unique_name_in_owner = true
@ -90,6 +91,21 @@ autostart = true
[node name="World" type="Node3D" parent="."]
[node name="Follow" type="Node3D" parent="World"]
[node name="Pivot" type="Node3D" parent="World/Follow"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
[node name="Camera" type="Camera3D" parent="World/Follow/Pivot" node_paths=PackedStringArray("follow_node", "pivot_node")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.5, 7.5)
current = true
fov = 30.0
size = 10.0
far = 1000.0
script = ExtResource("18_wogcj")
follow_node = NodePath("../..")
pivot_node = NodePath("..")
[node name="Sun" type="DirectionalLight3D" parent="World"]
transform = Transform3D(0.984808, 0.122788, -0.122788, 0, 0.707107, 0.707107, 0.173648, -0.696364, 0.696364, 0, 3, 0)
light_energy = 0.1
@ -98,7 +114,7 @@ script = ExtResource("11_4jb08")
[node name="Environment" type="WorldEnvironment" parent="World"]
environment = ExtResource("12_cscto")
camera_attributes = ExtResource("14_e2m00")
camera_attributes = ExtResource("15_6h2nx")
[node name="Trees" type="Node3D" parent="World"]
@ -133,21 +149,6 @@ material_override = ExtResource("18_tja64")
cast_shadow = 0
multimesh = ExtResource("19_ae26a")
[node name="Follow" type="Node3D" parent="World"]
[node name="Pivot" type="Node3D" parent="World/Follow"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
[node name="Camera" type="Camera3D" parent="World/Follow/Pivot" node_paths=PackedStringArray("follow_node", "pivot_node")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.5, 7.5)
current = true
fov = 30.0
size = 10.0
far = 1000.0
script = ExtResource("18_wogcj")
follow_node = NodePath("../..")
pivot_node = NodePath("..")
[node name="Players" type="Node3D" parent="."]
unique_name_in_owner = true
script = ExtResource("16_dp6bj")

View File

@ -16,7 +16,7 @@ func _process(_delta):
elif character.velocity.y < 0:
play("human/fall")
elif character.direction != Vector3.ZERO:
play("human/run")
play("human/run-fast")
else:
play("human/idle")

View File

@ -80,12 +80,11 @@ bones/59/rotation = Quaternion(-1.8142e-07, 0.710844, -0.70335, 2.42513e-07)
bones/60/rotation = Quaternion(-1.28748e-14, 1, 0, 1.16815e-13)
[node name="Hoodie" type="MeshInstance3D" parent="Model/Female/Armature/GeneralSkeleton" index="2"]
transform = Transform3D(1, -2.12458e-09, 7.45058e-09, 1.71713e-09, 1, 4.65661e-10, -1.49012e-08, 2.32831e-10, 1, 0, 0, 0)
mesh = ExtResource("5_mkrgn")
skin = ExtResource("4_b1tg1")
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Model/Female/Armature/GeneralSkeleton" index="3"]
transform = Transform3D(1, 6.4651e-15, 4.77396e-15, -6.4651e-15, 1, -6.92683e-08, -4.77396e-15, 6.92683e-08, 1, 1.57652e-10, 1.37156, -0.0247111)
transform = Transform3D(1, 6.4651e-15, 4.77396e-15, -6.4651e-15, 1, -6.92683e-08, -4.77396e-15, 6.92683e-08, 1, 1.57651e-10, 1.37156, -0.0247111)
bone_name = "Head"
bone_idx = 12

View File

@ -25,8 +25,9 @@ gdscript/warnings/integer_division=0
[display]
window/size/viewport_width=960
window/size/viewport_height=540
window/size/mode=3
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
window/vsync/vsync_mode=0
[gui]
@ -66,7 +67,7 @@ move_backward={
jump={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
]
}
dash={
@ -83,7 +84,7 @@ toggle_fullscreen={
attack={
"deadzone": 0.5,
"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":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
}
aim={

12
client/ui/NameLabel.gd Normal file
View File

@ -0,0 +1,12 @@
@tool
extends Label
func _ready():
update_text()
func update_text():
text = name + ":"
func _get_configuration_warnings() -> PackedStringArray:
update_text()
return []

View File

@ -0,0 +1,12 @@
@tool
extends Label
func _ready():
update_text()
func update_text():
text = get_parent().name + ":"
func _get_configuration_warnings() -> PackedStringArray:
update_text()
return []

View File

@ -1,15 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://cch67vqpsmtej"]
[ext_resource type="Script" path="res://ui/debug/DebugLabel.gd" id="1_xfly0"]
[ext_resource type="Script" path="res://ui/debug/DebugLabelText.gd" id="2_i4ix0"]
[ext_resource type="Script" path="res://ui/ParentNameLabel.gd" id="2_l1apn"]
[node name="Container" type="HBoxContainer"]
script = ExtResource("1_xfly0")
[node name="Text" type="Label" parent="."]
layout_mode = 2
text = ":"
script = ExtResource("2_i4ix0")
text = "Container:"
script = ExtResource("2_l1apn")
[node name="Value" type="Label" parent="."]
layout_mode = 2

View File

@ -1,5 +0,0 @@
@tool
extends Label
func _ready():
text = get_parent().name + ":"

View File

@ -0,0 +1,7 @@
extends Range
func _ready():
set_value_no_signal(Global.environment.adjustment_brightness)
func on_value_changed(new_value: float):
Global.environment.adjustment_brightness = new_value

View File

@ -0,0 +1,7 @@
extends Range
func _ready():
set_value_no_signal(Global.environment.adjustment_contrast)
func on_value_changed(new_value: float):
Global.environment.adjustment_contrast = new_value

View File

@ -0,0 +1,8 @@
extends CheckButton
func _ready():
set_pressed_no_signal(Global.camera_attributes.dof_blur_far_enabled)
func on_toggled(toggled_on: bool):
Global.camera_attributes.dof_blur_far_enabled = toggled_on
Global.camera_attributes.dof_blur_near_enabled = toggled_on

View File

@ -1,11 +1,7 @@
extends CheckButton
var environment: Environment
func _ready():
var world_environment := get_node("/root/Main/World/Environment") as WorldEnvironment
environment = world_environment.environment
set_pressed_no_signal(environment.glow_enabled)
set_pressed_no_signal(Global.environment.glow_enabled)
func on_toggled(toggled_on: bool):
environment.glow_enabled = toggled_on
Global.environment.glow_enabled = toggled_on

View File

@ -0,0 +1,7 @@
extends Range
func _ready():
set_value_no_signal(Global.environment.adjustment_saturation)
func on_value_changed(new_value: float):
Global.environment.adjustment_saturation = new_value

View File

@ -1,9 +1,14 @@
[gd_scene load_steps=5 format=3 uid="uid://bqpbrju7mc7d5"]
[gd_scene load_steps=10 format=3 uid="uid://bqpbrju7mc7d5"]
[ext_resource type="Script" path="res://ui/settings/Settings.gd" id="1_gx3lf"]
[ext_resource type="Script" path="res://ui/settings/Glow.gd" id="1_vkhbt"]
[ext_resource type="Script" path="res://ui/settings/ScaleMode.gd" id="2_7a2hi"]
[ext_resource type="Script" path="res://ui/ParentNameLabel.gd" id="2_72a3s"]
[ext_resource type="Script" path="res://ui/settings/RenderScale.gd" id="3_o5ei3"]
[ext_resource type="Script" path="res://ui/settings/DepthOfField.gd" id="5_kjasn"]
[ext_resource type="Script" path="res://ui/settings/Brightness.gd" id="7_redsl"]
[ext_resource type="Script" path="res://ui/settings/Contrast.gd" id="8_q4hif"]
[ext_resource type="Script" path="res://ui/settings/Saturation.gd" id="9_wbvcu"]
[node name="Settings" type="Control"]
layout_mode = 3
@ -29,15 +34,17 @@ layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Video"]
layout_mode = 2
[node name="HBoxContainer3" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
[node name="Render Scale" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
custom_minimum_size = Vector2(0, 28)
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/HBoxContainer3"]
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/Render Scale"]
layout_mode = 2
size_flags_horizontal = 3
text = "Render Scale"
text = "Render Scale:"
script = ExtResource("2_72a3s")
[node name="RenderScale2" type="OptionButton" parent="TabContainer/Video/VBoxContainer/HBoxContainer3"]
[node name="OptionButton" type="OptionButton" parent="TabContainer/Video/VBoxContainer/Render Scale"]
layout_mode = 2
size_flags_horizontal = 3
item_count = 5
@ -53,15 +60,17 @@ popup/item_4/text = "Native"
popup/item_4/id = 4
script = ExtResource("3_o5ei3")
[node name="HBoxContainer2" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
[node name="Scale Mode" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
custom_minimum_size = Vector2(0, 28)
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/HBoxContainer2"]
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/Scale Mode"]
layout_mode = 2
size_flags_horizontal = 3
text = "Scale Mode"
text = "Scale Mode:"
script = ExtResource("2_72a3s")
[node name="ScaleMode" type="OptionButton" parent="TabContainer/Video/VBoxContainer/HBoxContainer2"]
[node name="OptionButton" type="OptionButton" parent="TabContainer/Video/VBoxContainer/Scale Mode"]
layout_mode = 2
size_flags_horizontal = 3
item_count = 3
@ -73,19 +82,90 @@ popup/item_2/text = "FSR 2.2"
popup/item_2/id = 2
script = ExtResource("2_7a2hi")
[node name="HBoxContainer" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
[node name="Glow" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
custom_minimum_size = Vector2(0, 28)
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/HBoxContainer"]
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/Glow"]
layout_mode = 2
size_flags_horizontal = 3
text = "Glow"
text = "Glow:"
script = ExtResource("2_72a3s")
[node name="Glow" type="CheckButton" parent="TabContainer/Video/VBoxContainer/HBoxContainer"]
[node name="CheckButton" type="CheckButton" parent="TabContainer/Video/VBoxContainer/Glow"]
layout_mode = 2
size_flags_horizontal = 3
script = ExtResource("1_vkhbt")
[node name="Depth of Field" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
custom_minimum_size = Vector2(0, 28)
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/Depth of Field"]
layout_mode = 2
size_flags_horizontal = 3
text = "Depth of Field:"
script = ExtResource("2_72a3s")
[node name="CheckButton" type="CheckButton" parent="TabContainer/Video/VBoxContainer/Depth of Field"]
layout_mode = 2
size_flags_horizontal = 3
script = ExtResource("5_kjasn")
[node name="Brightness" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
custom_minimum_size = Vector2(0, 28)
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/Brightness"]
layout_mode = 2
size_flags_horizontal = 3
text = "Brightness:"
script = ExtResource("2_72a3s")
[node name="HSlider" type="HSlider" parent="TabContainer/Video/VBoxContainer/Brightness"]
layout_mode = 2
size_flags_horizontal = 3
max_value = 2.0
step = 0.05
value = 0.5
script = ExtResource("7_redsl")
[node name="Contrast" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
custom_minimum_size = Vector2(0, 28)
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/Contrast"]
layout_mode = 2
size_flags_horizontal = 3
text = "Contrast:"
script = ExtResource("2_72a3s")
[node name="HSlider" type="HSlider" parent="TabContainer/Video/VBoxContainer/Contrast"]
layout_mode = 2
size_flags_horizontal = 3
max_value = 2.0
step = 0.05
value = 0.5
script = ExtResource("8_q4hif")
[node name="Saturation" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"]
custom_minimum_size = Vector2(0, 28)
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/Video/VBoxContainer/Saturation"]
layout_mode = 2
size_flags_horizontal = 3
text = "Saturation:"
script = ExtResource("2_72a3s")
[node name="HSlider" type="HSlider" parent="TabContainer/Video/VBoxContainer/Saturation"]
layout_mode = 2
size_flags_horizontal = 3
max_value = 2.0
step = 0.05
value = 0.5
script = ExtResource("9_wbvcu")
[node name="Audio" type="MarginContainer" parent="TabContainer"]
visible = false
layout_mode = 2
@ -93,6 +173,10 @@ layout_mode = 2
[node name="Volume" type="HSlider" parent="TabContainer/Audio"]
layout_mode = 2
[connection signal="item_selected" from="TabContainer/Video/VBoxContainer/HBoxContainer3/RenderScale2" to="TabContainer/Video/VBoxContainer/HBoxContainer3/RenderScale2" method="on_item_selected"]
[connection signal="item_selected" from="TabContainer/Video/VBoxContainer/HBoxContainer2/ScaleMode" to="TabContainer/Video/VBoxContainer/HBoxContainer2/ScaleMode" method="on_item_selected"]
[connection signal="toggled" from="TabContainer/Video/VBoxContainer/HBoxContainer/Glow" to="TabContainer/Video/VBoxContainer/HBoxContainer/Glow" method="on_toggled"]
[connection signal="item_selected" from="TabContainer/Video/VBoxContainer/Render Scale/OptionButton" to="TabContainer/Video/VBoxContainer/Render Scale/OptionButton" method="on_item_selected"]
[connection signal="item_selected" from="TabContainer/Video/VBoxContainer/Scale Mode/OptionButton" to="TabContainer/Video/VBoxContainer/Scale Mode/OptionButton" method="on_item_selected"]
[connection signal="toggled" from="TabContainer/Video/VBoxContainer/Glow/CheckButton" to="TabContainer/Video/VBoxContainer/Glow/CheckButton" method="on_toggled"]
[connection signal="toggled" from="TabContainer/Video/VBoxContainer/Depth of Field/CheckButton" to="TabContainer/Video/VBoxContainer/Depth of Field/CheckButton" method="on_toggled"]
[connection signal="value_changed" from="TabContainer/Video/VBoxContainer/Brightness/HSlider" to="TabContainer/Video/VBoxContainer/Brightness/HSlider" method="on_value_changed"]
[connection signal="value_changed" from="TabContainer/Video/VBoxContainer/Contrast/HSlider" to="TabContainer/Video/VBoxContainer/Contrast/HSlider" method="on_value_changed"]
[connection signal="value_changed" from="TabContainer/Video/VBoxContainer/Saturation/HSlider" to="TabContainer/Video/VBoxContainer/Saturation/HSlider" method="on_value_changed"]

View File

@ -1,19 +1,18 @@
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://dixa0yso2s1u3"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_4vcsp"]
sky_horizon_color = Color(0.647059, 0.654902, 0.670588, 1)
ground_bottom_color = Color(0.647059, 0.654902, 0.670588, 1)
[ext_resource type="Material" uid="uid://bki5jtbipsnfn" path="res://world/ProceduralSkyMaterial.tres" id="1_68jth"]
[sub_resource type="Sky" id="Sky_bq3yo"]
sky_material = SubResource("ProceduralSkyMaterial_4vcsp")
[sub_resource type="Sky" id="Sky_2vfia"]
sky_material = ExtResource("1_68jth")
[resource]
background_mode = 2
background_color = Color(0.317647, 0.541176, 0.713726, 1)
sky = SubResource("Sky_bq3yo")
sky = SubResource("Sky_2vfia")
ambient_light_source = 3
ambient_light_sky_contribution = 0.9
reflected_light_source = 2
tonemap_mode = 2
tonemap_mode = 3
glow_enabled = true
glow_bloom = 0.2
adjustment_enabled = true

View File

@ -0,0 +1,13 @@
[gd_resource type="ProceduralSkyMaterial" load_steps=3 format=3 uid="uid://bki5jtbipsnfn"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_v2kyf"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_aa80t"]
seamless = true
noise = SubResource("FastNoiseLite_v2kyf")
[resource]
sky_horizon_color = Color(0.647059, 0.654902, 0.670588, 1)
sky_cover = SubResource("NoiseTexture2D_aa80t")
sky_cover_modulate = Color(0.584314, 0.584314, 0.584314, 1)
ground_bottom_color = Color(0.647059, 0.654902, 0.670588, 1)