[gd_scene load_steps=32 format=3 uid="uid://bdtfounpnyaoo"]

[ext_resource type="Script" path="res://twitch/jengacommands.gd" id="1_so2ke"]
[ext_resource type="Script" path="res://scripts/JengaManager.gd" id="1_xtpjd"]
[ext_resource type="Shader" path="res://addons/water_shader/shaders/water.gdshader" id="2_rliwp"]
[ext_resource type="Material" uid="uid://bwrsgjub33pd4" path="res://materials/BaseMaterial.tres" id="2_txp0l"]
[ext_resource type="Script" path="res://scripts/PivotMover.gd" id="3_7e1m6"]
[ext_resource type="Script" path="res://scripts/PlayerHand.gd" id="4_kq4yo"]
[ext_resource type="PackedScene" uid="uid://b2fnlbcm3p6f" path="res://prefabs/block.tscn" id="5_mn8hr"]
[ext_resource type="Material" uid="uid://dd5vcwp8smlnt" path="res://materials/Green.tres" id="8_2httq"]
[ext_resource type="Material" uid="uid://doxtu8jdlr3tp" path="res://materials/Red.tres" id="9_swpv7"]
[ext_resource type="Material" uid="uid://bipwt04wjyv6v" path="res://materials/Blue.tres" id="10_5k7a5"]
[ext_resource type="Material" uid="uid://cndp0uelk5w8u" path="res://materials/Blue2.tres" id="10_faljs"]

[sub_resource type="Environment" id="Environment_h6sx5"]
ambient_light_color = Color(1, 1, 1, 1)
fog_light_color = Color(1, 1, 0.972549, 1)
volumetric_fog_enabled = true
volumetric_fog_density = 0.0581
volumetric_fog_emission = Color(0.65098, 1, 0.909804, 1)

[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_10wpe"]

[sub_resource type="PlaneMesh" id="PlaneMesh_kyck2"]
size = Vector2(320, 320)
subdivide_width = 1000
subdivide_depth = 1000

[sub_resource type="FastNoiseLite" id="FastNoiseLite_bxq8s"]

[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_ptjyb"]
seamless = true
as_normal_map = true
noise = SubResource("FastNoiseLite_bxq8s")

[sub_resource type="FastNoiseLite" id="FastNoiseLite_rwake"]
noise_type = 0
seed = 1

[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_r4a3k"]
seamless = true
as_normal_map = true
noise = SubResource("FastNoiseLite_rwake")

[sub_resource type="FastNoiseLite" id="FastNoiseLite_e2hq3"]

[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_qdptp"]
seamless = true
noise = SubResource("FastNoiseLite_e2hq3")

[sub_resource type="FastNoiseLite" id="FastNoiseLite_elfch"]

[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_2unhc"]
seamless = true
bump_strength = 28.3
noise = SubResource("FastNoiseLite_elfch")

[sub_resource type="ShaderMaterial" id="ShaderMaterial_avbpb"]
render_priority = 0
shader = ExtResource("2_rliwp")
shader_parameter/albedo = Color(0, 0.717647, 0.803922, 1)
shader_parameter/transparency = 0.55
shader_parameter/metallic = 0.0
shader_parameter/roughness = 0.5
shader_parameter/surface_normals_move_direction_a = Vector2(-1, 0)
shader_parameter/surface_normals_move_direction_b = Vector2(0, 1)
shader_parameter/surface_texture_roughness = 0.6
shader_parameter/surface_texture_scale = 0.3
shader_parameter/surface_texture_time_scale = 0.06
shader_parameter/ssr_resolution = 2.0
shader_parameter/ssr_max_travel = 30.0
shader_parameter/ssr_max_diff = 4.0
shader_parameter/ssr_mix_strength = 0.7
shader_parameter/wave_noise_scale = 15.0
shader_parameter/wave_height_scale = 0.25
shader_parameter/wave_time_scale = 0.025
shader_parameter/wave_normal_flatness = 30.0
shader_parameter/border_color = Color(1, 1, 1, 1)
shader_parameter/border_scale = 0.78
shader_parameter/border_near = 0.5
shader_parameter/border_far = 300.0
shader_parameter/refraction_intensity = 0.4
shader_parameter/max_visible_depth = 10.0
shader_parameter/color_deep = Color(0, 0.709804, 0.776471, 1)
shader_parameter/wave_a = SubResource("NoiseTexture2D_qdptp")
shader_parameter/wave_b = SubResource("NoiseTexture2D_2unhc")
shader_parameter/surface_normals_a = SubResource("NoiseTexture2D_ptjyb")
shader_parameter/surface_normals_b = SubResource("NoiseTexture2D_r4a3k")

[sub_resource type="BoxShape3D" id="BoxShape3D_gmpx6"]
size = Vector3(1, 10, 3)

[sub_resource type="LabelSettings" id="LabelSettings_y2xp5"]
font_size = 10
font_color = Color(0, 0, 0, 1)

[sub_resource type="LabelSettings" id="LabelSettings_hb8hn"]
font_size = 36

[sub_resource type="Gradient" id="Gradient_ks4vx"]
offsets = PackedFloat32Array(0, 0.716578, 1)
colors = PackedColorArray(0.34, 0.34, 0.34, 1, 0.395775, 0.376751, 0.330867, 1, 0.190762, 0.190762, 0.190762, 1)

[sub_resource type="GradientTexture2D" id="GradientTexture2D_op5ae"]
gradient = SubResource("Gradient_ks4vx")
fill_to = Vector2(0, 1)

[sub_resource type="Gradient" id="Gradient_a2577"]
offsets = PackedFloat32Array(0, 0.759358, 1)
colors = PackedColorArray(1, 0.858176, 0.22651, 1, 1, 0.77489, 0.23193, 1, 1, 0.425552, 0.254665, 1)

[sub_resource type="GradientTexture2D" id="GradientTexture2D_xmewu"]
gradient = SubResource("Gradient_a2577")
fill_to = Vector2(0, 1)

[sub_resource type="LabelSettings" id="LabelSettings_4ta2f"]
font_color = Color(1, 0, 0, 1)

[node name="Jenga" type="Node3D" node_paths=PackedStringArray("debug_ui_label", "current_player_label", "next_up_label", "timer_bar", "turn_alert_label")]
script = ExtResource("1_xtpjd")
debug_ui_label = NodePath("UserInterface/DebugStuff")
current_player_label = NodePath("UserInterface/GameUI/CurrentPlayerLabel")
next_up_label = NodePath("UserInterface/GameUI/UpNextLabel")
timer_bar = NodePath("UserInterface/GameUI/TurnTimeLimit")
turn_alert_label = NodePath("UserInterface/GameUI/TurnTimeLimit/TurnAlert")

[node name="TwitchLink" type="Node" parent="." node_paths=PackedStringArray("jenga_manager")]
script = ExtResource("1_so2ke")
jenga_manager = NodePath("..")
scopes = Array[String](["chat:edit", "chat:read", "moderator:read:followers"])

[node name="CameraPivot" type="Node3D" parent="." node_paths=PackedStringArray("gizmo_pivot")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.445, 0)
script = ExtResource("3_7e1m6")
gizmo_pivot = NodePath("../UserInterface/SubViewportContainer/SubViewport/VCamPivot")

[node name="Camera3D" type="Camera3D" parent="CameraPivot"]
transform = Transform3D(1, 0, 0, 0, 0.819152, 0.573576, 0, -0.573576, 0.819152, 0, 0, 4.12)

[node name="Environment" type="Node3D" parent="."]

[node name="WorldEnvironment" type="WorldEnvironment" parent="Environment"]
environment = SubResource("Environment_h6sx5")
camera_attributes = SubResource("CameraAttributesPractical_10wpe")

[node name="DirectionalLight3D" type="DirectionalLight3D" parent="Environment"]
transform = Transform3D(0.903567, 0.24694, -0.350124, 0, 0.817195, 0.576361, 0.428446, -0.520781, 0.738391, 0, 0, 0)
light_energy = 1.252
light_indirect_energy = 1.63
light_volumetric_fog_energy = 2.512

[node name="WaterSurface" type="MeshInstance3D" parent="Environment"]
mesh = SubResource("PlaneMesh_kyck2")
skeleton = NodePath("../..")
surface_material_override/0 = SubResource("ShaderMaterial_avbpb")

[node name="PlayerHand" type="Node3D" parent="." node_paths=PackedStringArray("blocks_node", "gizmo_node")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.28028, 0)
script = ExtResource("4_kq4yo")
moveScale = 0.5
block_scene = ExtResource("5_mn8hr")
blocks_node = NodePath("../Blocks")
gizmo_node = NodePath("../UserInterface/SubViewportContainer/SubViewport/TransformGizmo")

[node name="Blocks" type="Node3D" parent="."]

[node name="StaticBody3D" type="StaticBody3D" parent="Blocks"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -4.25525, 0)

[node name="CollisionShape3D" type="CollisionShape3D" parent="Blocks/StaticBody3D"]
shape = SubResource("BoxShape3D_gmpx6")

[node name="BasePlatform" type="CSGBox3D" parent="Blocks/StaticBody3D"]
material_override = ExtResource("2_txp0l")
size = Vector3(1, 10, 3)

[node name="StaticBody3D3" type="StaticBody3D" parent="Blocks"]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 2, -4.25525, 0)

[node name="CollisionShape3D" type="CollisionShape3D" parent="Blocks/StaticBody3D3"]
shape = SubResource("BoxShape3D_gmpx6")

[node name="BasePlatform" type="CSGBox3D" parent="Blocks/StaticBody3D3"]
material_override = ExtResource("2_txp0l")
size = Vector3(1, 10, 3)

[node name="UserInterface" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3

[node name="DebugStuff" type="Label" parent="UserInterface"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 23.0
text = "Commands: !join_queue, !leave_queue
On your turn:
!start_turn - accept and begin your turn
!move [north/south/east/west/up/down] [amount] - move the block
!rotate [x/y/z] [degrees] - rotate the block
!camera [left,right,up,down] - rotate or move the camera 
!drop - drop your block and end your turn (happens automatically if you run out of time!)"
label_settings = SubResource("LabelSettings_y2xp5")

[node name="SubViewportContainer" type="SubViewportContainer" parent="UserInterface"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -128.0
offset_bottom = 128.0
grow_horizontal = 0
stretch = true

[node name="SubViewport" type="SubViewport" parent="UserInterface/SubViewportContainer"]
transparent_bg = true
handle_input_locally = false
size = Vector2i(128, 128)
size_2d_override = Vector2i(225, 190)
render_target_update_mode = 4

[node name="TransformGizmo" type="Node3D" parent="UserInterface/SubViewportContainer/SubViewport"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 50, 0)

[node name="YAxis" type="CSGTorus3D" parent="UserInterface/SubViewportContainer/SubViewport/TransformGizmo"]
layers = 524288
material_override = ExtResource("8_2httq")
inner_radius = 0.84
sides = 20
ring_sides = 10

[node name="XAxis" type="CSGTorus3D" parent="UserInterface/SubViewportContainer/SubViewport/TransformGizmo"]
transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0)
layers = 524288
material_override = ExtResource("9_swpv7")
inner_radius = 0.84
sides = 20
ring_sides = 10

[node name="ZAxis" type="CSGTorus3D" parent="UserInterface/SubViewportContainer/SubViewport/TransformGizmo"]
transform = Transform3D(1.91069e-15, -4.37114e-08, 1, -1, -4.37114e-08, 0, 4.37114e-08, -1, -4.37114e-08, 0, 0, 0)
layers = 524288
material_override = ExtResource("10_faljs")
inner_radius = 0.84
sides = 20
ring_sides = 10

[node name="Arrow" type="CSGPolygon3D" parent="UserInterface/SubViewportContainer/SubViewport/TransformGizmo"]
transform = Transform3D(1, 0, 0, 0, 0.740617, 0.671927, 0, -0.671927, 0.740617, 0, 0.528221, 0.857041)
layers = 524288
material_override = ExtResource("9_swpv7")
polygon = PackedVector2Array(0, 0, 0.2, 0.4, -0.2, 0.4)
depth = 0.2

[node name="Arrow5" type="CSGPolygon3D" parent="UserInterface/SubViewportContainer/SubViewport/TransformGizmo"]
transform = Transform3D(-4.37114e-08, 0.707107, -0.707107, 0, -0.707107, -0.707107, -1, -3.09086e-08, 3.09086e-08, 0.367916, 0.75111, 2.09664e-08)
layers = 524288
material_override = ExtResource("10_5k7a5")
polygon = PackedVector2Array(0, 0, 0.2, 0.4, -0.2, 0.4)
depth = 0.2

[node name="Arrow6" type="CSGPolygon3D" parent="UserInterface/SubViewportContainer/SubViewport/TransformGizmo"]
transform = Transform3D(-1.81058e-08, -0.707107, -0.707107, 6.18172e-08, 0.707107, -0.707107, 1, -5.65141e-08, 3.09086e-08, -0.577203, -0.807655, 1.00213e-07)
layers = 524288
material_override = ExtResource("10_5k7a5")
polygon = PackedVector2Array(0, 0, 0.2, 0.4, -0.2, 0.4)
depth = 0.2

[node name="Arrow2" type="CSGPolygon3D" parent="UserInterface/SubViewportContainer/SubViewport/TransformGizmo"]
transform = Transform3D(-1, -8.74228e-08, 0, 6.47468e-08, -0.740617, 0.671928, -5.87418e-08, 0.671927, 0.740617, 2.86072e-08, -0.438335, -0.695322)
layers = 524288
material_override = ExtResource("9_swpv7")
polygon = PackedVector2Array(0, 0, 0.2, 0.4, -0.2, 0.4)
depth = 0.2

[node name="Arrow3" type="CSGPolygon3D" parent="UserInterface/SubViewportContainer/SubViewport/TransformGizmo"]
transform = Transform3D(0.63384, -0.773464, -8.74228e-08, 2.16029e-08, -9.53244e-08, 1, -0.773464, -0.63384, -4.37114e-08, -0.454012, 0.102974, 0.816248)
layers = 524288
material_override = ExtResource("8_2httq")
polygon = PackedVector2Array(0, 0, 0.2, 0.4, -0.2, 0.4)
depth = 0.2

[node name="Arrow4" type="CSGPolygon3D" parent="UserInterface/SubViewportContainer/SubViewport/TransformGizmo"]
transform = Transform3D(-0.63384, 0.773464, -8.74228e-08, -2.16029e-08, 9.53244e-08, 1, 0.773464, 0.63384, -4.37114e-08, 0.450658, 0.102974, -0.783165)
layers = 524288
material_override = ExtResource("8_2httq")
polygon = PackedVector2Array(0, 0, 0.2, 0.4, -0.2, 0.4)
depth = 0.2

[node name="VCamPivot" type="Node3D" parent="UserInterface/SubViewportContainer/SubViewport"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 52.925, 0)

[node name="Camera3D" type="Camera3D" parent="UserInterface/SubViewportContainer/SubViewport/VCamPivot"]
transform = Transform3D(1, 0, 0, 0, 0.819152, 0.573576, 0, -0.573576, 0.819152, 0, 0, 4.12)
cull_mask = 524288
fov = 28.2

[node name="VBoxContainer" type="VBoxContainer" parent="UserInterface"]
layout_mode = 0
offset_left = 991.0
offset_top = 1.0
offset_right = 1023.0
offset_bottom = 125.0

[node name="Label" type="RichTextLabel" parent="UserInterface/VBoxContainer"]
layout_mode = 2
bbcode_enabled = true
text = "[b][font_size=30][color=red]X[/color]
[color=green]Y[/color]
[color=blue]Z[/color]
[/font_size][/b]"
fit_content = true

[node name="GameUI" type="VBoxContainer" parent="UserInterface"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0

[node name="CurrentPlayerLabel" type="Label" parent="UserInterface/GameUI"]
layout_mode = 2
text = "Current Player: Clevertop"
label_settings = SubResource("LabelSettings_hb8hn")

[node name="UpNextLabel" type="Label" parent="UserInterface/GameUI"]
layout_mode = 2
text = "Up next: Player1, Player2, Player3, Player 4"

[node name="TurnTimeLimit" type="TextureProgressBar" parent="UserInterface/GameUI"]
custom_minimum_size = Vector2(0, 30.815)
layout_mode = 2
max_value = 1.0
step = 0.0
value = 0.72
nine_patch_stretch = true
texture_under = SubResource("GradientTexture2D_op5ae")
texture_progress = SubResource("GradientTexture2D_xmewu")

[node name="TurnAlert" type="Label" parent="UserInterface/GameUI/TurnTimeLimit"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "Type !start_turn || !move !rotate !camera !drop"
label_settings = SubResource("LabelSettings_4ta2f")
horizontal_alignment = 1
vertical_alignment = 1

[connection signal="panic_drop" from="." to="PlayerHand" method="_on_jenga_panic_drop"]
[connection signal="dropBlock" from="TwitchLink" to="." method="_on_twitch_link_drop_block"]
[connection signal="dropBlock" from="TwitchLink" to="PlayerHand" method="_on_twitch_link_drop_block"]
[connection signal="moveBlock" from="TwitchLink" to="PlayerHand" method="_on_twitch_link_move_block"]
[connection signal="rotateBlock" from="TwitchLink" to="PlayerHand" method="_on_twitch_link_rotate_block"]
[connection signal="rotateCamera" from="TwitchLink" to="CameraPivot" method="_on_twitch_link_rotate_camera"]
[connection signal="startTurn" from="TwitchLink" to="PlayerHand" method="_on_twitch_link_start_turn"]
