diff --git a/project.godot b/project.godot
index 8477c68..fc5be74 100644
--- a/project.godot
+++ b/project.godot
@@ -11,7 +11,7 @@ config_version=5
[application]
config/name="Cs-os"
-run/main_scene="res://scenes/menu.tscn"
+run/main_scene="res://scenes/HUD/menu.tscn"
config/features=PackedStringArray("4.2", "Forward Plus")
boot_splash/bg_color=Color(0.282353, 0.00784314, 0.0745098, 1)
config/icon="res://icon.svg"
diff --git a/scenes/HUD/choose_team.tscn b/scenes/HUD/choose_team.tscn
new file mode 100644
index 0000000..d6a3ed9
--- /dev/null
+++ b/scenes/HUD/choose_team.tscn
@@ -0,0 +1,70 @@
+[gd_scene load_steps=2 format=3 uid="uid://b8ulqlywdvqba"]
+
+[ext_resource type="Script" path="res://scripts/Select.gd" id="1_nua8c"]
+
+[node name="ChooseTeam" type="Control"]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="CS" type="Control" parent="."]
+layout_mode = 1
+anchors_preset = 4
+anchor_top = 0.5
+anchor_bottom = 0.5
+offset_top = -20.0
+offset_right = 40.0
+offset_bottom = 20.0
+grow_vertical = 2
+
+[node name="Closed source" type="Label" parent="CS"]
+layout_mode = 0
+offset_left = 100.0
+offset_top = -100.0
+offset_right = 208.0
+offset_bottom = -77.0
+text = "Closed source
+"
+
+[node name="Select_CS" type="Button" parent="CS"]
+layout_mode = 0
+offset_left = 121.0
+offset_right = 175.0
+offset_bottom = 31.0
+text = "Select
+"
+script = ExtResource("1_nua8c")
+
+[node name="OS" type="Control" parent="."]
+layout_mode = 1
+anchors_preset = 6
+anchor_left = 1.0
+anchor_top = 0.5
+anchor_right = 1.0
+anchor_bottom = 0.5
+offset_left = -40.0
+offset_top = -20.0
+offset_bottom = 20.0
+grow_horizontal = 0
+grow_vertical = 2
+
+[node name="Open source" type="Label" parent="OS"]
+layout_mode = 0
+offset_left = -150.0
+offset_top = -100.0
+offset_right = -52.0
+offset_bottom = -77.0
+text = "Open source
+"
+
+[node name="Select_OS" type="Button" parent="OS"]
+layout_mode = 0
+offset_left = -129.0
+offset_right = -75.0
+offset_bottom = 31.0
+text = "Select
+"
+script = ExtResource("1_nua8c")
diff --git a/scenes/hud.tscn b/scenes/HUD/hud.tscn
similarity index 100%
rename from scenes/hud.tscn
rename to scenes/HUD/hud.tscn
diff --git a/scenes/menu.tscn b/scenes/HUD/menu.tscn
similarity index 91%
rename from scenes/menu.tscn
rename to scenes/HUD/menu.tscn
index 0b8ee8e..ee3e711 100644
--- a/scenes/menu.tscn
+++ b/scenes/HUD/menu.tscn
@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://cjlgs86ey1u1o"]
-[ext_resource type="Script" path="res://scripts/ConnectButton.gd" id="1_oqnod"]
-[ext_resource type="Script" path="res://scenes/Nickname.gd" id="2_c3c3b"]
+[ext_resource type="Script" path="res://scripts/ConnectButton.gd" id="1_nhpm2"]
+[ext_resource type="Script" path="res://scripts/Nickname.gd" id="2_5xejq"]
[node name="Menu" type="Control"]
layout_mode = 3
@@ -41,7 +41,7 @@ offset_right = 172.0
offset_bottom = 138.0
pivot_offset = Vector2(88, 24)
text = "Connect"
-script = ExtResource("1_oqnod")
+script = ExtResource("1_nhpm2")
[node name="PlayerMenu" type="Control" parent="."]
anchors_preset = 0
@@ -71,4 +71,4 @@ offset_top = 104.0
offset_right = 152.0
offset_bottom = 120.0
text = "Set"
-script = ExtResource("2_c3c3b")
+script = ExtResource("2_5xejq")
diff --git a/scenes/Map/OffisMi.tscn b/scenes/maps/OffisMi.tscn
similarity index 100%
rename from scenes/Map/OffisMi.tscn
rename to scenes/maps/OffisMi.tscn
diff --git a/scenes/models/ak_47.tscn b/scenes/models/ak_47.tscn
new file mode 100644
index 0000000..1003dd1
--- /dev/null
+++ b/scenes/models/ak_47.tscn
@@ -0,0 +1,13 @@
+[gd_scene load_steps=2 format=3 uid="uid://caos4gg5cd6f6"]
+
+[ext_resource type="PackedScene" uid="uid://dndsa6rm6hovq" path="res://scenes/models/automatto.dae" id="1_kapkd"]
+
+[node name="ak-47" type="Node3D"]
+transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -0.570068, 0, 0)
+
+[node name="automatto" parent="." instance=ExtResource("1_kapkd")]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.18626, -1.25157, 0)
+
+[node name="raycast" type="RayCast3D" parent="."]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.92407, 0.951779, 0)
+target_position = Vector3(-1, 0, 0)
diff --git a/scenes/models/automatto.dae b/scenes/models/automatto.dae
new file mode 100644
index 0000000..622ba22
--- /dev/null
+++ b/scenes/models/automatto.dae
@@ -0,0 +1,485 @@
+
+
+
+
+ Anonymous
+ Collada Exporter for Blender 2.6+, by Juan Linietsky (juan@codenix.com)
+
+ 2024-02-17T21:56:07Z
+ 2024-02-17T21:56:07Z
+
+ Z_UP
+
+
+
+
+
+
+
+ 0.800000011920929 0.800000011920929 0.800000011920929 1.0
+
+
+ 0.0 0.0 0.0 1.0
+
+
+ 0.6400000095367432 0.6400000095367432 0.6400000095367432 0.8
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 50
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 1.2
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+ 0.800000011920929 0.800000011920929 0.800000011920929 1.0
+
+
+ 0.0 0.0 0.0 1.0
+
+
+ 0.6400000095367432 0.6400000095367432 0.6400000095367432 0.8
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 50
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 1.2
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+ 0.800000011920929 0.800000011920929 0.800000011920929 1.0
+
+
+ 0.0 0.0 0.0 1.0
+
+
+ 0.6400000095367432 0.6400000095367432 0.6400000095367432 0.8
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 50
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 1.2
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 1 2 3
+ 4 5 6 7
+ 8 9 10 11
+ 12 13 14 15
+ 16 17 18 19
+ 20 21 22 23
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 1 2 3
+ 4 5 6 7
+ 8 9 10 11
+ 12 13 14 15
+ 16 17 18 19
+ 20 21 22 23
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 1 2 3
+ 4 5 6 7
+ 8 9 10 11
+ 12 13 14 15
+ 16 17 18 19
+ 20 21 22 23
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 1 2 3
+ 4 5 6 7
+ 8 9 10 11
+ 12 13 14 15
+ 16 17 18 19
+ 20 21 22 23
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 1 2 3
+ 4 5 6 7
+ 8 9 10 11
+ 12 13 14 15
+ 16 17 18 19
+ 20 21 22 23
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 1 2 3
+ 4 5 6 7
+ 8 9 10 11
+ 12 13 14 15
+ 16 17 18 19
+ 20 21 22 23
+
+
+
+
+
+
+
+ 2.6000001430511475 0.0 0.0 0.0 0.0 0.19977541267871857 0.0 0.0 0.0 0.0 0.4598263204097748 2.203359842300415 0.0 0.0 0.0 1.0
+
+
+
+
+
+
+
+
+
+ -1.57242467935248e-08 0.0009324373677372932 0.2314780056476593 1.6276607513427734 1.6476175090929246e-08 0.11205510795116425 -0.0019261838169768453 -0.012317478656768799 -0.5210391283035278 3.515240321050328e-09 -7.046598859972164e-09 1.4152696132659912 0.0 0.0 0.0 1.0
+
+
+
+
+
+
+
+
+
+ 0.012317821383476257 0.0 -0.23190557956695557 -1.2648444175720215 0.0 0.11228424310684204 0.0 -0.016380950808525085 0.9720970988273621 0.0 0.002938566030934453 1.156082034111023 0.0 0.0 0.0 1.0
+
+
+
+
+
+
+
+
+
+ 0.4965575635433197 0.0 0.0 2.8978543281555176 0.0 0.16011132299900055 0.0 -0.0013670185580849648 0.0 0.0 0.24370159208774567 2.1922411918640137 0.0 0.0 0.0 1.0
+
+
+
+
+
+
+
+
+
+ 0.4965575635433197 0.0 0.0 3.762096643447876 0.0 0.19658255577087402 0.0 -0.0028609037399291992 0.0 0.0 0.28466933965682983 2.1854066848754883 0.0 0.0 0.0 1.0
+
+
+
+
+
+
+
+
+
+ 0.3889171779155731 0.0 0.0 -2.7596819400787354 0.0 0.06061943992972374 0.0 0.0 0.0 0.0 0.06876473128795624 2.203359842300415 0.0 0.0 0.0 1.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scenes/models/automatto.dae.import b/scenes/models/automatto.dae.import
new file mode 100644
index 0000000..2689e23
--- /dev/null
+++ b/scenes/models/automatto.dae.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="scene"
+importer_version=1
+type="PackedScene"
+uid="uid://dndsa6rm6hovq"
+path="res://.godot/imported/automatto.dae-f7024c685fe1af02633a09bb6d2a998a.scn"
+
+[deps]
+
+source_file="res://scenes/models/automatto.dae"
+dest_files=["res://.godot/imported/automatto.dae-f7024c685fe1af02633a09bb6d2a998a.scn"]
+
+[params]
+
+nodes/root_type=""
+nodes/root_name=""
+nodes/apply_root_scale=true
+nodes/root_scale=1.0
+meshes/ensure_tangents=true
+meshes/generate_lods=true
+meshes/create_shadow_meshes=true
+meshes/light_baking=1
+meshes/lightmap_texel_size=0.2
+meshes/force_disable_compression=false
+skins/use_named_skins=true
+animation/import=true
+animation/fps=30
+animation/trimming=false
+animation/remove_immutable_tracks=true
+import_script/path=""
+_subresources={}
+gltf/naming_version=1
+gltf/embedded_image_handling=1
diff --git a/scenes/models/buddy.glb b/scenes/models/buddy.glb
new file mode 100644
index 0000000..31bd4aa
Binary files /dev/null and b/scenes/models/buddy.glb differ
diff --git a/scenes/models/buddy.glb.import b/scenes/models/buddy.glb.import
new file mode 100644
index 0000000..4a9c362
--- /dev/null
+++ b/scenes/models/buddy.glb.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="scene"
+importer_version=1
+type="PackedScene"
+uid="uid://coa22cxx7aoe1"
+path="res://.godot/imported/buddy.glb-8ddedc557e087d8081a0b6ce807345a2.scn"
+
+[deps]
+
+source_file="res://scenes/models/buddy.glb"
+dest_files=["res://.godot/imported/buddy.glb-8ddedc557e087d8081a0b6ce807345a2.scn"]
+
+[params]
+
+nodes/root_type=""
+nodes/root_name=""
+nodes/apply_root_scale=true
+nodes/root_scale=1.0
+meshes/ensure_tangents=true
+meshes/generate_lods=true
+meshes/create_shadow_meshes=true
+meshes/light_baking=1
+meshes/lightmap_texel_size=0.2
+meshes/force_disable_compression=false
+skins/use_named_skins=true
+animation/import=true
+animation/fps=30
+animation/trimming=false
+animation/remove_immutable_tracks=true
+import_script/path=""
+_subresources={}
+gltf/naming_version=1
+gltf/embedded_image_handling=1
diff --git a/scenes/models/buddy_1613124237_95-p-fon-kozha-zheltaya-205.jpg b/scenes/models/buddy_1613124237_95-p-fon-kozha-zheltaya-205.jpg
new file mode 100644
index 0000000..9e986d7
Binary files /dev/null and b/scenes/models/buddy_1613124237_95-p-fon-kozha-zheltaya-205.jpg differ
diff --git a/scenes/models/buddy_1613124237_95-p-fon-kozha-zheltaya-205.jpg.import b/scenes/models/buddy_1613124237_95-p-fon-kozha-zheltaya-205.jpg.import
new file mode 100644
index 0000000..b3daa63
--- /dev/null
+++ b/scenes/models/buddy_1613124237_95-p-fon-kozha-zheltaya-205.jpg.import
@@ -0,0 +1,36 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://dirdtjfuc7ibi"
+path.s3tc="res://.godot/imported/buddy_1613124237_95-p-fon-kozha-zheltaya-205.jpg-ae0efba9d59eb45d45ee0c23fbb9243e.s3tc.ctex"
+metadata={
+"imported_formats": ["s3tc_bptc"],
+"vram_texture": true
+}
+generator_parameters={}
+
+[deps]
+
+source_file="res://scenes/models/buddy_1613124237_95-p-fon-kozha-zheltaya-205.jpg"
+dest_files=["res://.godot/imported/buddy_1613124237_95-p-fon-kozha-zheltaya-205.jpg-ae0efba9d59eb45d45ee0c23fbb9243e.s3tc.ctex"]
+
+[params]
+
+compress/mode=2
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=true
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=0
diff --git a/scenes/models/pistol.tscn b/scenes/models/pistol.tscn
new file mode 100644
index 0000000..15d694d
--- /dev/null
+++ b/scenes/models/pistol.tscn
@@ -0,0 +1,12 @@
+[gd_scene load_steps=2 format=3 uid="uid://cnu1vf8k5i3tv"]
+
+[ext_resource type="PackedScene" uid="uid://hf47u08p80fo" path="res://scenes/models/pistoletto.dae" id="1_hdcb6"]
+
+[node name="pistol" type="Node3D"]
+
+[node name="pistoletto" parent="." instance=ExtResource("1_hdcb6")]
+transform = Transform3D(0.21, 0, 0, 0, 0.21, 0, 0, 0, 0.21, 0, 0, 0)
+
+[node name="raycast" type="RayCast3D" parent="."]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.461124, 0.0946267, 2.01564e-08)
+target_position = Vector3(-1, 0, 0)
diff --git a/scenes/models/pistoletto.dae b/scenes/models/pistoletto.dae
new file mode 100644
index 0000000..05c9c8a
--- /dev/null
+++ b/scenes/models/pistoletto.dae
@@ -0,0 +1,218 @@
+
+
+
+
+ Anonymous
+ Collada Exporter for Blender 2.6+, by Juan Linietsky (juan@codenix.com)
+
+ 2024-02-17T21:50:36Z
+ 2024-02-17T21:50:36Z
+
+ Z_UP
+
+
+
+
+
+
+
+ 0.800000011920929 0.800000011920929 0.800000011920929 1.0
+
+
+ 0.0 0.0 0.0 1.0
+
+
+ 0.6400000095367432 0.6400000095367432 0.6400000095367432 0.8
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 50
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 1.2
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+ 0.800000011920929 0.800000011920929 0.800000011920929 1.0
+
+
+ 0.0 0.0 0.0 1.0
+
+
+ 0.6400000095367432 0.6400000095367432 0.6400000095367432 0.8
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 50
+
+
+ 0.5 0.5 0.5 1.0
+
+
+ 1.2
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 1 2 3
+ 4 5 6 7
+ 8 9 10 11
+ 12 13 14 15
+ 16 17 18 19
+ 20 21 22 23
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 1 2 3
+ 4 5 6 7
+ 8 9 10 11
+ 12 13 14 15
+ 16 17 18 19
+ 20 21 22 23
+
+
+
+
+
+
+
+ 0.28390204906463623 0.0 0.30559131503105164 -0.016092630103230476 0.0 0.11151131987571716 0.0 0.0 -0.7800144553184509 0.0 0.1112261414527893 -0.06142665445804596 0.0 0.0 0.0 1.0
+
+
+
+
+
+
+
+
+
+ 1.2125928401947021 0.0 0.0 -1.1341843605041504 0.0 0.12897871434688568 0.0 0.0 0.0 0.0 0.33654701709747314 0.5419423580169678 0.0 0.0 0.0 1.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scenes/models/pistoletto.dae.import b/scenes/models/pistoletto.dae.import
new file mode 100644
index 0000000..d1a1f19
--- /dev/null
+++ b/scenes/models/pistoletto.dae.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="scene"
+importer_version=1
+type="PackedScene"
+uid="uid://hf47u08p80fo"
+path="res://.godot/imported/pistoletto.dae-04bdabc945b0c35e4dde01b17b4398c8.scn"
+
+[deps]
+
+source_file="res://scenes/models/pistoletto.dae"
+dest_files=["res://.godot/imported/pistoletto.dae-04bdabc945b0c35e4dde01b17b4398c8.scn"]
+
+[params]
+
+nodes/root_type=""
+nodes/root_name=""
+nodes/apply_root_scale=true
+nodes/root_scale=1.0
+meshes/ensure_tangents=true
+meshes/generate_lods=true
+meshes/create_shadow_meshes=true
+meshes/light_baking=1
+meshes/lightmap_texel_size=0.2
+meshes/force_disable_compression=false
+skins/use_named_skins=true
+animation/import=true
+animation/fps=30
+animation/trimming=false
+animation/remove_immutable_tracks=true
+import_script/path=""
+_subresources={}
+gltf/naming_version=1
+gltf/embedded_image_handling=1
diff --git a/scenes/models/player.tscn b/scenes/models/player.tscn
new file mode 100644
index 0000000..81df13f
--- /dev/null
+++ b/scenes/models/player.tscn
@@ -0,0 +1,53 @@
+[gd_scene load_steps=7 format=3 uid="uid://b2jhgtduapovl"]
+
+[ext_resource type="Script" path="res://scripts/Player.gd" id="1_8hh2g"]
+[ext_resource type="PackedScene" uid="uid://cnu1vf8k5i3tv" path="res://scenes/models/pistol.tscn" id="2_86kn4"]
+[ext_resource type="PackedScene" uid="uid://caos4gg5cd6f6" path="res://scenes/models/ak_47.tscn" id="3_sko6x"]
+
+[sub_resource type="SphereMesh" id="SphereMesh_fp0bl"]
+
+[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_yyp7b"]
+
+[sub_resource type="CapsuleMesh" id="CapsuleMesh_jqfxo"]
+
+[node name="player" type="Node3D"]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.10113, 0)
+
+[node name="CharacterBody3D" type="CharacterBody3D" parent="."]
+script = ExtResource("1_8hh2g")
+
+[node name="Head" type="Node3D" parent="CharacterBody3D"]
+
+[node name="Camera" type="Camera3D" parent="CharacterBody3D/Head"]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.675496, 0)
+
+[node name="viewRaycast" type="RayCast3D" parent="CharacterBody3D/Head/Camera"]
+target_position = Vector3(0, 0, -100)
+
+[node name="Hand" type="Node3D" parent="CharacterBody3D/Head/Camera"]
+transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.72454, -0.463491, -0.808041)
+
+[node name="knife" type="MeshInstance3D" parent="CharacterBody3D/Head/Camera/Hand"]
+transform = Transform3D(0.16, 0, 0, 0, 0.16, 0, 0, 0, 0.16, 0, 0, 0)
+visible = false
+mesh = SubResource("SphereMesh_fp0bl")
+
+[node name="raycast" type="RayCast3D" parent="CharacterBody3D/Head/Camera/Hand/knife"]
+
+[node name="pistol" parent="CharacterBody3D/Head/Camera/Hand" instance=ExtResource("2_86kn4")]
+transform = Transform3D(1, 0, -3.55271e-15, 0, 1, 0, 3.55271e-15, 0, 1, 0, 0, 0)
+visible = false
+
+[node name="ak-47" parent="CharacterBody3D/Head/Camera/Hand" instance=ExtResource("3_sko6x")]
+visible = false
+
+[node name="Nickname" type="Label3D" parent="CharacterBody3D/Head"]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.24983, 0)
+billboard = 1
+text = "Unnamed"
+
+[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"]
+shape = SubResource("CapsuleShape3D_yyp7b")
+
+[node name="MeshInstance3D" type="MeshInstance3D" parent="CharacterBody3D"]
+mesh = SubResource("CapsuleMesh_jqfxo")
diff --git a/scenes/models/spectator.tscn b/scenes/models/spectator.tscn
new file mode 100644
index 0000000..f309fa8
--- /dev/null
+++ b/scenes/models/spectator.tscn
@@ -0,0 +1,8 @@
+[gd_scene load_steps=2 format=3 uid="uid://bf6uev4mtg2ls"]
+
+[ext_resource type="Script" path="res://scripts/SpectatorControls.gd" id="1_uqbjn"]
+
+[node name="head" type="Node3D"]
+script = ExtResource("1_uqbjn")
+
+[node name="Camera" type="Camera3D" parent="."]
diff --git a/scenes/terrain.gd b/scenes/terrain.gd
deleted file mode 100644
index 92626b9..0000000
--- a/scenes/terrain.gd
+++ /dev/null
@@ -1,11 +0,0 @@
-extends Node3D
-
-
-# Called when the node enters the scene tree for the first time.
-func _ready():
- pass # Replace with function body.
-
-
-# Called every frame. 'delta' is the elapsed time since the previous frame.
-func _process(delta):
- pass
diff --git a/scenes/test_map.tscn b/scenes/test_map.tscn
deleted file mode 100644
index 7dda5d9..0000000
--- a/scenes/test_map.tscn
+++ /dev/null
@@ -1,5 +0,0 @@
-[gd_scene format=3 uid="uid://d0tdlmmo1texv"]
-
-[node name="test_map" type="Node3D"]
-
-[node name="terrain" type="Node3D" parent="."]
diff --git a/scripts/Networking.gd b/scripts/Networking.gd
index ab60971..3234eda 100644
--- a/scripts/Networking.gd
+++ b/scripts/Networking.gd
@@ -3,7 +3,7 @@ var player_script := preload("res://scripts/Player.gd")
var server_map
@onready var Weapons = GameData.Weapons
-var player_model = preload("res://models/player.tscn")
+var player_model = preload("res://scenes/models/player.tscn")
var peer = ENetMultiplayerPeer.new()
var settings
var clients = {}
@@ -29,10 +29,10 @@ func _ready():
var path
if (arguments.has("map")):
map_root_name = str(arguments["map"])
- path = "res://scenes/Map/" + str(arguments["map"]) + ".tscn"
+ path = "res://scenes/maps/" + str(arguments["map"]) + ".tscn"
else:
map_root_name = "OffisMi"
- path = "res://scenes/Map/OffisMi.tscn"
+ path = "res://scenes/maps/OffisMi.tscn"
StartServer(path)
map_path = path
#######################################SERVER####################################
@@ -66,7 +66,7 @@ func StartServer(map_name):
peer.connect("peer_connected", _Peer_Connected)
peer.connect("peer_disconnected", _Peer_Disconnected)
- var spectator = preload("res://models/spectator.tscn").instantiate()
+ var spectator = preload("res://scenes/models/spectator.tscn").instantiate()
server_map.add_child(spectator)
func send_everyone_except(client_id, args):
@@ -127,7 +127,7 @@ func client_ready(client_id):
var internal_id = client["internal_id"]
send_everyone_except(client_id, ["spawn_puppet", clients[client_id]])
-
+
clients[client_id]["ready"] = true
var client_cb3d = find_cb3d_by_internal_id(internal_id)
var class_spawnpoint = find_class_type_by_number(client["class_type"])["spawnpoint"]
@@ -187,12 +187,7 @@ func shot(client_id):
var internal_id = client["internal_id"]
var current_weapon = settings["game"]["weapons"].find_key(find_weapon_by_number(client["current_weapon"]["number"]))
var current_weapon_settings = settings["game"]["weapons"][current_weapon]
-
- #var view_raycast:RayCast3D = find_cb3d_by_internal_id(internal_id).get_node("Head/Camera/viewRaycast")
- #var raycast:RayCast3D = find_cb3d_by_internal_id(internal_id).get_node("Head/Camera/viewRaycast")
- #var weapon_raycast:RayCast3D = find_cb3d_by_internal_id(internal_id).get_node("Head/Camera/Hand/" + str(current_weapon) + "/raycast")
-
- print(current_weapon)
+
var client_cb3d = find_cb3d_by_internal_id(internal_id)
var raycast:RayCast3D = client_cb3d.get_node("Head/Camera/viewRaycast")
var weapon_raycast:RayCast3D = client_cb3d.get_node("Head/Camera/Hand/" + str(current_weapon) + "/raycast")
@@ -203,10 +198,10 @@ func shot(client_id):
weapon_raycast.target_position = weapon_raycast.to_local(target_point) #- weapon_raycast.position)
weapon_raycast.get_node("..").rotation.y = - atan((weapon_raycast.position.x - client_cb3d.position.x) / ((-current_weapon_settings["range"]) - (abs(weapon_raycast.position.z - client_cb3d.position.z))))
- #weapon_raycast.target_position = weapon_raycast.to_local(raycast.to_global(raycast.target_position) - weapon_raycast.position)
+
weapon_raycast.target_position.y += current_weapon_settings["spreading"] * randf() * sin(randf() * 2 * PI)
weapon_raycast.target_position.z += current_weapon_settings["spreading"] * randf() * cos(randf() * 2 * PI)
- print(str(weapon_raycast.target_position))
+
weapon_raycast.force_raycast_update()
weapon_raycast.force_update_transform()
@@ -226,7 +221,6 @@ func shot(client_id):
if (time_since_last_shot < current_weapon_settings["fireRate"] and client["last_shot"] > 0):
return
- print(client["current_weapon"]["magazine"])
if (client["current_weapon"]["magazine"] == 0):
return
@@ -286,8 +280,7 @@ func get_map(client_id):
##########################################CLIENT#######################
var player
-var menu = preload("res://scenes/menu.tscn")
-var test_map = preload("res://scenes/test_map.tscn")
+var menu = preload("res://scenes/HUD/menu.tscn")
var current_map_instance
@rpc ("reliable", "call_remote")
@@ -313,6 +306,22 @@ func despawn_puppet(internal_id):
func receive_map(p):
map_path = p
map_root_name = (map_path.split("/")[-1]).split(".")[0]
+
+@rpc("authority", "reliable", "call_remote")
+func switch_team(team):
+ pass
+
+func spawn_player():
+ var player_node = player_model.instantiate()
+ var CB3D = player_node.find_child("CharacterBody3D")
+ var properties = player_script.new().properties.duplicate()
+ properties = player
+ properties["is_playable"] = true
+ properties["ready"] = true
+ CB3D.set_properties(properties)
+
+ current_map_instance.add_child(player_node)
+
func ConnectToServer(ip, port):
peer.create_client(ip, port)
multiplayer.multiplayer_peer = peer
@@ -346,23 +355,17 @@ func _Connection_Succseeded():
await get_tree().create_timer(0.05).timeout # костыль # tp
rpc_id(1, "get_server_settings", multiplayer.get_unique_id())
- var player_node = player_model.instantiate()
- var CB3D = player_node.find_child("CharacterBody3D")
- var properties = player_script.new().properties.duplicate()
- properties = player
- properties["is_playable"] = true
- properties["ready"] = true
- CB3D.set_properties(properties)
+ await spawn_player()
- current_map_instance.add_child(player_node)
- await get_tree().create_timer(0.05).timeout # костыль
+ #var choose_team_hud = preload("res://scenes/HUD/choose_team.tscn").instantiate()
+ #current_map_instance.add_child(choose_team_hud)
rpc_id(1, "client_ready", multiplayer.get_unique_id())
func _Server_Disconnected():
print("Server has disconnected")
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
- get_tree().change_scene_to_file("res://scenes/menu.tscn")
+ get_tree().change_scene_to_file("res://scenes/HUD/menu.tscn")
multiplayer.multiplayer_peer = null
peer = ENetMultiplayerPeer.new()
multiplayer.multiplayer_peer = peer
diff --git a/scenes/Nickname.gd b/scripts/Nickname.gd
similarity index 100%
rename from scenes/Nickname.gd
rename to scripts/Nickname.gd
diff --git a/scripts/Player.gd b/scripts/Player.gd
index 7e4ab42..e5260e4 100644
--- a/scripts/Player.gd
+++ b/scripts/Player.gd
@@ -94,16 +94,12 @@ func find_current_weapon_by_number(number):
return found_weapon
func _ready():
- #if ($"..".name == "player"):
- #properties["offline_mode"] = true
- #properties["is_playable"] = true
- #await Networking.StartServer("res://scenes/Map/OffisMi.tscn")
position = Vector3(0, 5, 0)
$"Head/Nickname".text = properties["nickname"]
if (!properties["is_playable"]): return
camera.make_current()
print("I am alive")
- var hud = load("res://scenes/hud.tscn").instantiate()
+ var hud = load("res://scenes/HUD/hud.tscn").instantiate()
add_child(hud)
HUD = $"HUD"
healthBar = HUD.get_node("HealthBar")
@@ -178,7 +174,6 @@ func _unhandled_input(event):
func _physics_process(delta):
if (!properties["is_playable"]): return
- #if (game_settings == null and !properties["offline_mode"]): return
if (game_settings == null): return
if (multiplayer.multiplayer_peer == null):
properties["is_playable"] = false
diff --git a/scripts/Select.gd b/scripts/Select.gd
new file mode 100644
index 0000000..3965fc8
--- /dev/null
+++ b/scripts/Select.gd
@@ -0,0 +1,11 @@
+extends Button
+
+@onready var button = $"."
+func _ready():
+ button.pressed.connect(self._button_pressed)
+
+func _button_pressed():
+ if name == "Select_CS":
+ print("Selected CS")
+ elif name == "Select_OS":
+ print("Selected OS")