From ec676aad5df3c52addad5343fc6c1cfb1e44fb9e Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 14 Feb 2024 13:52:59 +0100 Subject: [PATCH] Added layer settings --- client/enemy/slime/Slime.tscn | 1 + client/item/soul/Soul.tscn | 5 + client/player/Player.tscn | 1 + client/project.godot | 1 + client/skill/slash/slash.gd | 2 +- client/ui/settings/Settings.tscn | 136 ++++++++++++++---- client/ui/settings/layer/CullMaskToggle.gd | 12 ++ client/ui/settings/{ => video}/Brightness.gd | 0 client/ui/settings/{ => video}/Contrast.gd | 0 .../ui/settings/{ => video}/DepthOfField.gd | 0 client/ui/settings/{ => video}/Glow.gd | 0 client/ui/settings/{ => video}/Preset.gd | 0 client/ui/settings/{ => video}/RenderScale.gd | 0 client/ui/settings/{ => video}/SSAO.gd | 0 client/ui/settings/{ => video}/SSIL.gd | 0 client/ui/settings/{ => video}/Saturation.gd | 0 client/ui/settings/{ => video}/ScaleMode.gd | 0 .../ui/settings/{ => video}/VolumetricFog.gd | 0 client/ui/theme/theme.tres | 1 + 19 files changed, 133 insertions(+), 26 deletions(-) create mode 100644 client/ui/settings/layer/CullMaskToggle.gd rename client/ui/settings/{ => video}/Brightness.gd (100%) rename client/ui/settings/{ => video}/Contrast.gd (100%) rename client/ui/settings/{ => video}/DepthOfField.gd (100%) rename client/ui/settings/{ => video}/Glow.gd (100%) rename client/ui/settings/{ => video}/Preset.gd (100%) rename client/ui/settings/{ => video}/RenderScale.gd (100%) rename client/ui/settings/{ => video}/SSAO.gd (100%) rename client/ui/settings/{ => video}/SSIL.gd (100%) rename client/ui/settings/{ => video}/Saturation.gd (100%) rename client/ui/settings/{ => video}/ScaleMode.gd (100%) rename client/ui/settings/{ => video}/VolumetricFog.gd (100%) diff --git a/client/enemy/slime/Slime.tscn b/client/enemy/slime/Slime.tscn index e6c49fd..5c49450 100644 --- a/client/enemy/slime/Slime.tscn +++ b/client/enemy/slime/Slime.tscn @@ -67,6 +67,7 @@ shape = SubResource("SphereShape3D_s5ct7") [node name="HUD" parent="." node_paths=PackedStringArray("health") instance=ExtResource("3_4jtio")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.986405, 0) visible = false +layers = 256 health = NodePath("../Health") [node name="Animation" type="AnimationPlayer" parent="."] diff --git a/client/item/soul/Soul.tscn b/client/item/soul/Soul.tscn index 2c16a53..603e77f 100644 --- a/client/item/soul/Soul.tscn +++ b/client/item/soul/Soul.tscn @@ -74,6 +74,7 @@ script = ExtResource("1_mm7cb") [node name="Particles" type="GPUParticles3D" parent="."] unique_name_in_owner = true +layers = 64 cast_shadow = 0 amount = 50 sub_emitter = NodePath("../Trail") @@ -85,6 +86,7 @@ draw_pass_1 = SubResource("QuadMesh_6nr8a") [node name="Trail" type="GPUParticles3D" parent="."] unique_name_in_owner = true +layers = 64 amount = 5000 lifetime = 0.5 visibility_aabb = AABB(-1, -0.5, -1, 2, 2, 2) @@ -94,16 +96,19 @@ draw_pass_1 = SubResource("QuadMesh_pthhm") [node name="Attractor" type="GPUParticlesAttractorSphere3D" parent="."] unique_name_in_owner = true +layers = 64 strength = 2.0 radius = 0.5 [node name="Light" type="OmniLight3D" parent="."] unique_name_in_owner = true +layers = 64 omni_range = 0.5 [node name="Sprite" type="Sprite3D" parent="."] unique_name_in_owner = true transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0) +layers = 64 material_override = SubResource("StandardMaterial3D_ociyh") billboard = 1 double_sided = false diff --git a/client/player/Player.tscn b/client/player/Player.tscn index 90f8976..df50b24 100644 --- a/client/player/Player.tscn +++ b/client/player/Player.tscn @@ -78,6 +78,7 @@ font_size = 256 outline_size = 32 [node name="HUD" parent="." node_paths=PackedStringArray("health") instance=ExtResource("7_fwgtd")] +layers = 512 health = NodePath("../Health") [node name="Attractor" type="GPUParticlesAttractorSphere3D" parent="."] diff --git a/client/project.godot b/client/project.godot index 3eb335b..8e420a5 100644 --- a/client/project.godot +++ b/client/project.godot @@ -150,6 +150,7 @@ skill_4={ 3d_render/layer_3="Trees" 3d_render/layer_4="Structures" 3d_render/layer_5="Water" +3d_render/layer_7="Loot" 3d_render/layer_9="Enemies" 3d_render/layer_10="Players" 3d_physics/layer_1="World" diff --git a/client/skill/slash/slash.gd b/client/skill/slash/slash.gd index 53efc5f..065e371 100644 --- a/client/skill/slash/slash.gd +++ b/client/skill/slash/slash.gd @@ -1,6 +1,6 @@ extends SkillInstance func _ready(): - play_animation("human/slash", 0.7, 1.4) + play_animation("human/slash", 0.8, 1.7) await melee_damage(0.5) queue_free() \ No newline at end of file diff --git a/client/ui/settings/Settings.tscn b/client/ui/settings/Settings.tscn index 63c11f4..8d9363d 100644 --- a/client/ui/settings/Settings.tscn +++ b/client/ui/settings/Settings.tscn @@ -1,18 +1,19 @@ -[gd_scene load_steps=14 format=3 uid="uid://bqpbrju7mc7d5"] +[gd_scene load_steps=15 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/label/ParentNameLabel.gd" id="2_72a3s"] -[ext_resource type="Script" path="res://ui/settings/Preset.gd" id="3_6lki0"] -[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/SSAO.gd" id="6_fu528"] -[ext_resource type="Script" path="res://ui/settings/Brightness.gd" id="7_redsl"] -[ext_resource type="Script" path="res://ui/settings/SSIL.gd" id="7_wt6tg"] -[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"] -[ext_resource type="Script" path="res://ui/settings/VolumetricFog.gd" id="10_enf67"] +[ext_resource type="Script" path="res://ui/settings/video/Preset.gd" id="3_il1yi"] +[ext_resource type="Script" path="res://ui/settings/video/RenderScale.gd" id="4_owrjf"] +[ext_resource type="Script" path="res://ui/settings/video/ScaleMode.gd" id="5_monk2"] +[ext_resource type="Script" path="res://ui/settings/video/Glow.gd" id="6_13yy3"] +[ext_resource type="Script" path="res://ui/settings/video/DepthOfField.gd" id="7_i0l7x"] +[ext_resource type="Script" path="res://ui/settings/video/SSAO.gd" id="8_je43v"] +[ext_resource type="Script" path="res://ui/settings/video/SSIL.gd" id="9_tngfj"] +[ext_resource type="Script" path="res://ui/settings/video/VolumetricFog.gd" id="10_1jm8r"] +[ext_resource type="Script" path="res://ui/settings/video/Brightness.gd" id="11_crore"] +[ext_resource type="Script" path="res://ui/settings/video/Contrast.gd" id="12_5kqj0"] +[ext_resource type="Script" path="res://ui/settings/video/Saturation.gd" id="13_ntyeq"] +[ext_resource type="Script" path="res://ui/settings/layer/CullMaskToggle.gd" id="14_npk11"] [node name="Settings" type="Control"] layout_mode = 3 @@ -68,7 +69,7 @@ size_flags_horizontal = 3 text = "High" [node name="Preset" type="Node" parent="TabContainer/Video/VBoxContainer/Preset/HBoxContainer"] -script = ExtResource("3_6lki0") +script = ExtResource("3_il1yi") [node name="Render Scale" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -94,7 +95,7 @@ popup/item_3/text = "Ultra Quality" popup/item_3/id = 3 popup/item_4/text = "Native" popup/item_4/id = 4 -script = ExtResource("3_o5ei3") +script = ExtResource("4_owrjf") [node name="Scale Mode" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -116,7 +117,7 @@ popup/item_1/text = "FSR 1.0" popup/item_1/id = 1 popup/item_2/text = "FSR 2.2" popup/item_2/id = 2 -script = ExtResource("2_7a2hi") +script = ExtResource("5_monk2") [node name="Glow" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -131,7 +132,7 @@ script = ExtResource("2_72a3s") [node name="CheckButton" type="CheckButton" parent="TabContainer/Video/VBoxContainer/Glow" groups=["video_preset_setting"]] layout_mode = 2 size_flags_horizontal = 3 -script = ExtResource("1_vkhbt") +script = ExtResource("6_13yy3") [node name="Depth of Field" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -146,7 +147,7 @@ script = ExtResource("2_72a3s") [node name="CheckButton" type="CheckButton" parent="TabContainer/Video/VBoxContainer/Depth of Field" groups=["video_preset_setting"]] layout_mode = 2 size_flags_horizontal = 3 -script = ExtResource("5_kjasn") +script = ExtResource("7_i0l7x") [node name="SSAO" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -161,7 +162,7 @@ script = ExtResource("2_72a3s") [node name="CheckButton" type="CheckButton" parent="TabContainer/Video/VBoxContainer/SSAO" groups=["video_preset_setting"]] layout_mode = 2 size_flags_horizontal = 3 -script = ExtResource("6_fu528") +script = ExtResource("8_je43v") [node name="SSIL" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -176,7 +177,7 @@ script = ExtResource("2_72a3s") [node name="CheckButton" type="CheckButton" parent="TabContainer/Video/VBoxContainer/SSIL" groups=["video_preset_setting"]] layout_mode = 2 size_flags_horizontal = 3 -script = ExtResource("7_wt6tg") +script = ExtResource("9_tngfj") [node name="Volumetric Fog" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -191,7 +192,7 @@ script = ExtResource("2_72a3s") [node name="CheckButton" type="CheckButton" parent="TabContainer/Video/VBoxContainer/Volumetric Fog" groups=["video_preset_setting"]] layout_mode = 2 size_flags_horizontal = 3 -script = ExtResource("10_enf67") +script = ExtResource("10_1jm8r") [node name="Brightness" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -209,7 +210,7 @@ size_flags_horizontal = 3 max_value = 2.0 step = 0.05 value = 0.5 -script = ExtResource("7_redsl") +script = ExtResource("11_crore") [node name="Contrast" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -227,7 +228,7 @@ size_flags_horizontal = 3 max_value = 2.0 step = 0.05 value = 0.5 -script = ExtResource("8_q4hif") +script = ExtResource("12_5kqj0") [node name="Saturation" type="HBoxContainer" parent="TabContainer/Video/VBoxContainer"] custom_minimum_size = Vector2(0, 32) @@ -245,15 +246,95 @@ size_flags_horizontal = 3 max_value = 2.0 step = 0.05 value = 0.5 -script = ExtResource("9_wbvcu") +script = ExtResource("13_ntyeq") -[node name="Audio" type="MarginContainer" parent="TabContainer"] +[node name="Layers" type="MarginContainer" parent="TabContainer"] visible = false layout_mode = 2 -[node name="Volume" type="HSlider" parent="TabContainer/Audio"] +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Layers"] layout_mode = 2 +[node name="Terrain" type="HBoxContainer" parent="TabContainer/Layers/VBoxContainer"] +custom_minimum_size = Vector2(0, 32) +layout_mode = 2 + +[node name="Label" type="Label" parent="TabContainer/Layers/VBoxContainer/Terrain"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Terrain:" +script = ExtResource("2_72a3s") + +[node name="CheckButton" type="CheckButton" parent="TabContainer/Layers/VBoxContainer/Terrain" groups=["video_preset_setting"]] +layout_mode = 2 +size_flags_horizontal = 3 +script = ExtResource("14_npk11") +layer_number = 1 + +[node name="Grass" type="HBoxContainer" parent="TabContainer/Layers/VBoxContainer"] +custom_minimum_size = Vector2(0, 32) +layout_mode = 2 + +[node name="Label" type="Label" parent="TabContainer/Layers/VBoxContainer/Grass"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Grass:" +script = ExtResource("2_72a3s") + +[node name="CheckButton" type="CheckButton" parent="TabContainer/Layers/VBoxContainer/Grass" groups=["video_preset_setting"]] +layout_mode = 2 +size_flags_horizontal = 3 +script = ExtResource("14_npk11") +layer_number = 2 + +[node name="Trees" type="HBoxContainer" parent="TabContainer/Layers/VBoxContainer"] +custom_minimum_size = Vector2(0, 32) +layout_mode = 2 + +[node name="Label" type="Label" parent="TabContainer/Layers/VBoxContainer/Trees"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Trees:" +script = ExtResource("2_72a3s") + +[node name="CheckButton" type="CheckButton" parent="TabContainer/Layers/VBoxContainer/Trees" groups=["video_preset_setting"]] +layout_mode = 2 +size_flags_horizontal = 3 +script = ExtResource("14_npk11") +layer_number = 3 + +[node name="Enemies" type="HBoxContainer" parent="TabContainer/Layers/VBoxContainer"] +custom_minimum_size = Vector2(0, 32) +layout_mode = 2 + +[node name="Label" type="Label" parent="TabContainer/Layers/VBoxContainer/Enemies"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Enemies:" +script = ExtResource("2_72a3s") + +[node name="CheckButton" type="CheckButton" parent="TabContainer/Layers/VBoxContainer/Enemies" groups=["video_preset_setting"]] +layout_mode = 2 +size_flags_horizontal = 3 +script = ExtResource("14_npk11") +layer_number = 9 + +[node name="Players" type="HBoxContainer" parent="TabContainer/Layers/VBoxContainer"] +custom_minimum_size = Vector2(0, 32) +layout_mode = 2 + +[node name="Label" type="Label" parent="TabContainer/Layers/VBoxContainer/Players"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Players:" +script = ExtResource("2_72a3s") + +[node name="CheckButton" type="CheckButton" parent="TabContainer/Layers/VBoxContainer/Players" groups=["video_preset_setting"]] +layout_mode = 2 +size_flags_horizontal = 3 +script = ExtResource("14_npk11") +layer_number = 10 + [connection signal="pressed" from="TabContainer/Video/VBoxContainer/Preset/HBoxContainer/Low" to="TabContainer/Video/VBoxContainer/Preset/HBoxContainer/Preset" method="preset_low"] [connection signal="pressed" from="TabContainer/Video/VBoxContainer/Preset/HBoxContainer/Medium" to="TabContainer/Video/VBoxContainer/Preset/HBoxContainer/Preset" method="preset_medium"] [connection signal="pressed" from="TabContainer/Video/VBoxContainer/Preset/HBoxContainer/High" to="TabContainer/Video/VBoxContainer/Preset/HBoxContainer/Preset" method="preset_high"] @@ -267,3 +348,8 @@ layout_mode = 2 [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"] +[connection signal="toggled" from="TabContainer/Layers/VBoxContainer/Terrain/CheckButton" to="TabContainer/Layers/VBoxContainer/Terrain/CheckButton" method="on_toggled"] +[connection signal="toggled" from="TabContainer/Layers/VBoxContainer/Grass/CheckButton" to="TabContainer/Layers/VBoxContainer/Grass/CheckButton" method="on_toggled"] +[connection signal="toggled" from="TabContainer/Layers/VBoxContainer/Trees/CheckButton" to="TabContainer/Layers/VBoxContainer/Trees/CheckButton" method="on_toggled"] +[connection signal="toggled" from="TabContainer/Layers/VBoxContainer/Enemies/CheckButton" to="TabContainer/Layers/VBoxContainer/Enemies/CheckButton" method="on_toggled"] +[connection signal="toggled" from="TabContainer/Layers/VBoxContainer/Players/CheckButton" to="TabContainer/Layers/VBoxContainer/Players/CheckButton" method="on_toggled"] diff --git a/client/ui/settings/layer/CullMaskToggle.gd b/client/ui/settings/layer/CullMaskToggle.gd new file mode 100644 index 0000000..dc752e7 --- /dev/null +++ b/client/ui/settings/layer/CullMaskToggle.gd @@ -0,0 +1,12 @@ +extends CheckButton + +@export var layer_number: int + +func _ready(): + set_pressed_no_signal(Global.camera.cull_mask & (1 << (layer_number - 1))) + +func on_toggled(toggled_on: bool): + if toggled_on: + Global.camera.cull_mask |= 1 << (layer_number - 1) + else: + Global.camera.cull_mask &= ~(1 << (layer_number - 1)) \ No newline at end of file diff --git a/client/ui/settings/Brightness.gd b/client/ui/settings/video/Brightness.gd similarity index 100% rename from client/ui/settings/Brightness.gd rename to client/ui/settings/video/Brightness.gd diff --git a/client/ui/settings/Contrast.gd b/client/ui/settings/video/Contrast.gd similarity index 100% rename from client/ui/settings/Contrast.gd rename to client/ui/settings/video/Contrast.gd diff --git a/client/ui/settings/DepthOfField.gd b/client/ui/settings/video/DepthOfField.gd similarity index 100% rename from client/ui/settings/DepthOfField.gd rename to client/ui/settings/video/DepthOfField.gd diff --git a/client/ui/settings/Glow.gd b/client/ui/settings/video/Glow.gd similarity index 100% rename from client/ui/settings/Glow.gd rename to client/ui/settings/video/Glow.gd diff --git a/client/ui/settings/Preset.gd b/client/ui/settings/video/Preset.gd similarity index 100% rename from client/ui/settings/Preset.gd rename to client/ui/settings/video/Preset.gd diff --git a/client/ui/settings/RenderScale.gd b/client/ui/settings/video/RenderScale.gd similarity index 100% rename from client/ui/settings/RenderScale.gd rename to client/ui/settings/video/RenderScale.gd diff --git a/client/ui/settings/SSAO.gd b/client/ui/settings/video/SSAO.gd similarity index 100% rename from client/ui/settings/SSAO.gd rename to client/ui/settings/video/SSAO.gd diff --git a/client/ui/settings/SSIL.gd b/client/ui/settings/video/SSIL.gd similarity index 100% rename from client/ui/settings/SSIL.gd rename to client/ui/settings/video/SSIL.gd diff --git a/client/ui/settings/Saturation.gd b/client/ui/settings/video/Saturation.gd similarity index 100% rename from client/ui/settings/Saturation.gd rename to client/ui/settings/video/Saturation.gd diff --git a/client/ui/settings/ScaleMode.gd b/client/ui/settings/video/ScaleMode.gd similarity index 100% rename from client/ui/settings/ScaleMode.gd rename to client/ui/settings/video/ScaleMode.gd diff --git a/client/ui/settings/VolumetricFog.gd b/client/ui/settings/video/VolumetricFog.gd similarity index 100% rename from client/ui/settings/VolumetricFog.gd rename to client/ui/settings/video/VolumetricFog.gd diff --git a/client/ui/theme/theme.tres b/client/ui/theme/theme.tres index 406289d..003fe43 100644 --- a/client/ui/theme/theme.tres +++ b/client/ui/theme/theme.tres @@ -5,6 +5,7 @@ [resource] default_font = ExtResource("1_1unma") default_font_size = 20 +Label/colors/font_shadow_color = Color(0, 0, 0, 0.25) MarginContainer/constants/margin_bottom = 12 MarginContainer/constants/margin_left = 12 MarginContainer/constants/margin_right = 12