Compare commits

..

11 commits

45 changed files with 412 additions and 600 deletions

View file

@ -2,9 +2,11 @@
Current plans:
Different damage based on body part
Knife:
Behaviour
Model
Animation
Audio system:
Positional sound
Distance and wall dampening
Gameplay HUD:
Weapon display
Ability display
@ -12,7 +14,6 @@ Current plans:
Molik
Flashbang
Wall smoke
Anticheat:
Replace authority over player to server
Make rpc's to sync state
Implement client side state changes and sync calls
Kamikadze?
Think of something better

Binary file not shown.

View file

@ -1,19 +0,0 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://bixhakxpo8epv"
path="res://.godot/imported/test_damaged.ogg-a578462684ffc3782af3d53325026b1e.oggvorbisstr"
[deps]
source_file="res://audio/test_damaged.ogg"
dest_files=["res://.godot/imported/test_damaged.ogg-a578462684ffc3782af3d53325026b1e.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -1,13 +0,0 @@
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://ybeuqwdb504c"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_xjw7r"]
sky_top_color = Color(0.6256585, 0.8292434, 0.9808864, 1)
sky_horizon_color = Color(0.53361595, 0.7450959, 0.83056223, 1)
ground_horizon_color = Color(0.53361595, 0.7450959, 0.83056223, 1)
[sub_resource type="Sky" id="Sky_nv7aj"]
sky_material = SubResource("ProceduralSkyMaterial_xjw7r")
[resource]
background_mode = 2
sky = SubResource("Sky_nv7aj")

View file

@ -1,7 +1,6 @@
[gd_scene load_steps=24 format=3 uid="uid://cqrh2cc7m2i7f"]
[gd_scene load_steps=21 format=3 uid="uid://cqrh2cc7m2i7f"]
[ext_resource type="Environment" uid="uid://d0cfgtx2yxw13" path="res://environments/prototype_environment.tres" id="1_i6jab"]
[ext_resource type="Script" uid="uid://ypgm3aplt78m" path="res://scripts/multiplayer/team_spawner.gd" id="4_pi0y7"]
[ext_resource type="Material" uid="uid://bx3f5vx71ynh5" path="res://materials/Graymat.tres" id="4_y6i55"]
[ext_resource type="Material" uid="uid://dynpcduei1wfn" path="res://materials/Bluemat.tres" id="4_yx0ab"]
[ext_resource type="Material" uid="uid://mlha6r17v2en" path="res://materials/DarkBluemat.tres" id="5_bno23"]
@ -15,22 +14,9 @@
[ext_resource type="Script" uid="uid://dk1gjbuydemmb" path="res://scripts/multiplayer/plant_site/plant_site.gd" id="8_oujx2"]
[ext_resource type="Script" uid="uid://b4cpux52fmx5o" path="res://scripts/multiplayer/plant_site/plant_deadzone.gd" id="9_1wlgq"]
[ext_resource type="Material" uid="uid://c6xa4phihtya2" path="res://materials/Redmat.tres" id="9_ysk2e"]
[ext_resource type="Script" path="res://scripts/multiplayer/spawn_system/team_spawner.gd" id="10_02ic3"]
[ext_resource type="Script" uid="uid://3i00rp8urth7" path="res://scripts/object_container.gd" id="11_02ic3"]
[sub_resource type="Animation" id="Animation_y6i55"]
length = 0.001
[sub_resource type="Animation" id="Animation_pi0y7"]
resource_name = "main"
length = 5.0
loop_mode = 2
[sub_resource type="AnimationLibrary" id="AnimationLibrary_bno23"]
_data = {
&"RESET": SubResource("Animation_y6i55"),
&"main": SubResource("Animation_pi0y7")
}
[sub_resource type="BoxShape3D" id="BoxShape3D_ysk2e"]
size = Vector3(15.324341, 0.96273804, 21.381592)
@ -98,12 +84,6 @@ operation = 2
size = Vector3(3.9233856, 4.9065094, 8.765167)
material = ExtResource("5_bno23")
[node name="CSGBox3D7" type="CSGBox3D" parent="CSGCombiner3D/CSGBox3D5"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.4006386, 1.7042251, 3.8919868)
operation = 2
size = Vector3(3.9233856, 6.302376, 16.471077)
material = ExtResource("5_bno23")
[node name="CSGBox3D6" type="CSGBox3D" parent="CSGCombiner3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14.816613, 1.4951501, 14.911085)
size = Vector3(7.2811394, 2.1549835, 16.348633)
@ -239,30 +219,24 @@ operation = 2
size = Vector3(20.339264, 4.566284, 3.4625244)
material = ExtResource("7_8bje3")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_bno23")
}
autoplay = "main"
[node name="PlayersContainer" type="Node3D" parent="." node_paths=PackedStringArray("exlusion_list")]
script = ExtResource("11_02ic3")
exlusion_list = [NodePath("DefenceSpawn"), NodePath("AttackSpawn"), NodePath("SpectatorSpawn"), NodePath("MultiplayerSpawner")]
[node name="DefenceSpawn" type="Marker3D" parent="PlayersContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 37.170197, 0.5180037, -11.271502)
script = ExtResource("4_pi0y7")
script = ExtResource("10_02ic3")
spawn_radius = 10.0
[node name="AttackSpawn" type="Marker3D" parent="PlayersContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -31.553003, 0.5180037, 20.371899)
script = ExtResource("4_pi0y7")
script = ExtResource("10_02ic3")
team = 1
spawn_radius = 5.0
[node name="SpectatorSpawn" type="Marker3D" parent="PlayersContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.1422176, 39.792877, -1.3889732)
script = ExtResource("4_pi0y7")
script = ExtResource("10_02ic3")
team = 2
spawn_radius = 10.0
@ -275,7 +249,7 @@ script = ExtResource("11_02ic3")
exlusion_list = [NodePath("MultiplayerSpawner"), NodePath("Bomb")]
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="DynamicObjectsContainer"]
_spawnable_scenes = PackedStringArray("uid://dtbpyfdawb02b", "uid://cxdgk74ln5xpn", "uid://dgfqppi21c2u0")
_spawnable_scenes = PackedStringArray("uid://cxdgk74ln5xpn", "uid://dgfqppi21c2u0")
spawn_path = NodePath("..")
script = ExtResource("6_oujx2")

View file

@ -1,218 +0,0 @@
[gd_scene load_steps=8 format=3 uid="uid://cc2v2f2ppu68w"]
[ext_resource type="Environment" uid="uid://ybeuqwdb504c" path="res://environments/split_environment.tres" id="1_muj2s"]
[ext_resource type="Material" uid="uid://bx3f5vx71ynh5" path="res://materials/Graymat.tres" id="4_mj4b4"]
[ext_resource type="Script" uid="uid://3i00rp8urth7" path="res://scripts/object_container.gd" id="9_klida"]
[ext_resource type="Script" uid="uid://ypgm3aplt78m" path="res://scripts/multiplayer/team_spawner.gd" id="10_n3y50"]
[ext_resource type="Script" uid="uid://bqjv6l7hh0lix" path="res://scripts/multiplayer/spawn_system/dyn_objects_spawner.gd" id="11_ydk8w"]
[ext_resource type="Script" uid="uid://dncldab5y4yod" path="res://scripts/item_spawner.gd" id="12_kry5j"]
[ext_resource type="PackedScene" uid="uid://cxdgk74ln5xpn" path="res://scenes/weapons/droppable_bomb.tscn" id="13_hy0sx"]
[node name="PrototypeScene" type="Node3D"]
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.36256826, -0.8070987, 0.46597853, 2.7805946e-08, 0.49999994, 0.86602545, -0.93195724, -0.31399333, 0.18128408, 0, 0, 0)
shadow_enabled = true
shadow_opacity = 0.72
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource("1_muj2s")
[node name="PlayersContainer" type="Node3D" parent="." node_paths=PackedStringArray("exlusion_list")]
script = ExtResource("9_klida")
exlusion_list = [NodePath("DefenceSpawn"), NodePath("AttackSpawn"), NodePath("SpectatorSpawn"), NodePath("MultiplayerSpawner")]
[node name="DefenceSpawn" type="Marker3D" parent="PlayersContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 37.170197, 0.5180037, -11.271502)
script = ExtResource("10_n3y50")
spawn_radius = 10.0
[node name="AttackSpawn" type="Marker3D" parent="PlayersContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.38304234, -4.809286, -89.24379)
script = ExtResource("10_n3y50")
team = 1
spawn_radius = 5.0
[node name="SpectatorSpawn" type="Marker3D" parent="PlayersContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.1422176, 39.792877, -1.3889732)
script = ExtResource("10_n3y50")
team = 2
spawn_radius = 10.0
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="PlayersContainer"]
_spawnable_scenes = PackedStringArray("uid://dpsr6ug3pkb40", "uid://ckjabjcvgki6n")
spawn_path = NodePath("..")
[node name="DynamicObjectsContainer" type="Node3D" parent="." node_paths=PackedStringArray("exlusion_list")]
script = ExtResource("9_klida")
exlusion_list = [NodePath("MultiplayerSpawner"), NodePath("Bomb")]
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="DynamicObjectsContainer"]
_spawnable_scenes = PackedStringArray("uid://dtbpyfdawb02b", "uid://cxdgk74ln5xpn", "uid://dgfqppi21c2u0")
spawn_path = NodePath("..")
script = ExtResource("11_ydk8w")
[node name="Bomb" type="Node3D" parent="DynamicObjectsContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.75895405, 1.4657042, -82.2781)
script = ExtResource("12_kry5j")
item = ExtResource("13_hy0sx")
[node name="CSGBox3D" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.10182953, 0, 0.008199692)
use_collision = true
size = Vector3(200, 30, 200)
material = ExtResource("4_mj4b4")
metadata/_edit_lock_ = true
[node name="CSGBox3D" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.76431274, 5.190714, -85.495895)
operation = 2
size = Vector3(19.616089, 20, 18.007202)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.439907, 5.190714, -79.43837)
operation = 2
size = Vector3(40.967278, 20, 5.892151)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D4" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -28.936323, 5.190714, -73.65309)
operation = 2
size = Vector3(17.32446, 20, 5.892151)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D5" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, -36.057262, 5.190712, -68.04524)
operation = 2
size = Vector3(20.04846, 20, 5.892151)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D6" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1.3113416e-07, 0, -1, 0, 1, 0, 1, 0, 1.3113416e-07, -43.110355, 5.190712, -50.205387)
operation = 2
size = Vector3(41.6351, 20, 5.892151)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D8" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1.3113416e-07, 0, -1, 0, 1, 0, 1, 0, 1.3113416e-07, -49.17052, 5.190712, -54.688)
operation = 2
size = Vector3(14.743811, 20, 18.012482)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D9" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -32.214684, 5.190712, -37.012585)
operation = 2
size = Vector3(23.657562, 20, 5.892151)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D13" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(0.9438586, -0.33034965, 1.6502948e-07, 0.33034965, 0.9438586, 5.7760168e-08, -1.7484555e-07, 0, 1, -14.318398, 8.97945, -37.012585)
operation = 2
size = Vector3(21.155441, 21.89746, 5.892151)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D10" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -27.3817, 5.190712, -36.001347)
operation = 2
size = Vector3(13.4241905, 20, 13.434586)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D14" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -2.32983, 11.473099, -34.799385)
operation = 2
size = Vector3(13.4241905, 20, 15.838509)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D17" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -2.3298304, 12.957962, -22.154272)
operation = 2
size = Vector3(13.4241905, 17.030273, 10.398869)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D25" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -1.975194, 6.971512, -15.152288)
operation = 2
size = Vector3(4.9866176, 5.057373, 4.5284653)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D27" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -15.839454, 6.971512, -4.5533996)
operation = 2
size = Vector3(4.9866176, 5.057373, 4.5284653)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D26" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -6.483385, 8.4767, -5.505255)
operation = 2
size = Vector3(14.003002, 8.067749, 18.016186)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D16" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, -5.9264146e-08, 0.9408039, 0.3389514, -1.6449538e-07, -0.3389514, 0.9408039, -2.0993683, 12.163487, -25.798256)
operation = 2
size = Vector3(5.523605, 18.881592, 9.313798)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D11" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -27.768564, 5.190712, -25.174095)
operation = 2
size = Vector3(5.836166, 20, 10.473482)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D12" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -25.51088, 5.190712, -3.9385576)
operation = 2
size = Vector3(14.805191, 20, 34.73304)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D19" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -43.27089, 5.190712, 11.546464)
operation = 2
size = Vector3(25.511751, 20, 3.7630043)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D20" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -46.06128, 5.190712, 11.546465)
operation = 2
size = Vector3(19.930973, 20, 3.7630043)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D15" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -43.858833, 5.190712, -2.757196)
operation = 2
size = Vector3(26.825138, 20, 19.381424)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D22" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -44.94732, -0.57845306, -2.144785)
size = Vector3(2.5832448, 8.46167, 7.311594)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D24" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -20.040934, -0.57845306, -4.000236)
size = Vector3(3.9078333, 8.46167, 11.022496)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D23" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -34.202385, -2.0242548, 5.7241755)
size = Vector3(2.5832448, 5.5700684, 3.402379)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D21" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 1.7484555e-07, 0, 1, 0, -1.7484555e-07, 0, 1, -51.895195, 5.190712, 8.622506)
operation = 2
size = Vector3(10.752413, 20, 9.287149)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D18" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(0.9759396, 0, 0.21804121, 0, 1, 0, -0.21804121, 0, 0.9759396, -42.8084, 5.190712, -11.5842705)
operation = 2
size = Vector3(27.158907, 20, 8.102915)
material = ExtResource("4_mj4b4")
[node name="CSGBox3D3" type="CSGBox3D" parent="CSGBox3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12.069462, 5.190714, -73.87635)
operation = 2
size = Vector3(5.8275757, 20, 5.892151)
material = ExtResource("4_mj4b4")

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

View file

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://50bjd4m600y"
path="res://.godot/imported/molikman_ingame_tex_Molikman.png-fa994ec91481577d99049156480274fc.ctex"
metadata={
"vram_texture": false
}
generator_parameters={
"md5": "adf17223cdac27afac207ae40df37427"
}
[deps]
source_file="res://models/characters/worldmodels/molikman_ingame_tex_Molikman.png"
dest_files=["res://.godot/imported/molikman_ingame_tex_Molikman.png-fa994ec91481577d99049156480274fc.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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=1

View file

@ -21,7 +21,6 @@ PlayerGlobal="*res://scripts/player/player_global.gd"
Lobby="*res://scripts/multiplayer/lobby.gd"
Session="*res://scripts/multiplayer/session.gd"
ClientSettings="*res://scripts/client_settings.gd"
Registry="*res://scripts/registry.gd"
[display]
@ -167,3 +166,7 @@ menu_settings={
3d_physics/layer_5="Players Attack Team"
3d_physics/layer_6="Players Defence Team"
3d_physics/layer_7="Interactible"
[physics]
3d/default_gravity=39.2

View file

@ -46,7 +46,7 @@ layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/GameplayMainAudio"]
layout_mode = 2
text = "Геймплейные звуки"
text = "Геймплей"
[node name="GameplayMainSlider" type="HSlider" parent="VBoxContainer/GameplayMainAudio"]
layout_mode = 2

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=81 format=4 uid="uid://dpsr6ug3pkb40"]
[gd_scene load_steps=83 format=4 uid="uid://dpsr6ug3pkb40"]
[ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"]
[ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"]
@ -33,10 +33,10 @@
[ext_resource type="AudioStream" uid="uid://cc2mp4y3bkpgp" path="res://audio/plant.ogg" id="19_nquoi"]
[ext_resource type="Script" uid="uid://tb140f8fweug" path="res://scripts/player/states/death.gd" id="19_rwwcc"]
[ext_resource type="AudioStream" uid="uid://c2y8wd427mmdw" path="res://audio/shoot.ogg" id="20_moxwy"]
[ext_resource type="AudioStream" uid="uid://bixhakxpo8epv" path="res://audio/test_damaged.ogg" id="23_b2eak"]
[ext_resource type="Script" uid="uid://b2djbdh05pbcn" path="res://scripts/player/team_color_switcher.gd" id="25_1mtds"]
[ext_resource type="Material" uid="uid://cjb0h3of85nc2" path="res://materials/players/molikman/mat_Molikman.tres" id="26_r2jxp"]
[ext_resource type="Texture2D" uid="uid://15mf4452fse0" path="res://textures/players/molikman/molikman_ingame_Molikman_blue.png" id="27_j3w78"]
[ext_resource type="Script" uid="uid://dfvnx8f1v6m5g" path="res://scripts/multiplayer/player_input.gd" id="37_b2eak"]
[sub_resource type="ArrayMesh" id="ArrayMesh_lot4n"]
_surfaces = [{
@ -7401,6 +7401,14 @@ _data = {
&"baked_sp_shoot_empty": SubResource("Animation_do7kw")
}
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_b2eak"]
properties/0/path = NodePath(".:rotation")
properties/0/spawn = true
properties/0/replication_mode = 1
properties/1/path = NodePath("..:rotation")
properties/1/spawn = true
properties/1/replication_mode = 1
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g2els"]
height = 1.2958984
@ -7411,18 +7419,21 @@ font_size = 32
properties/0/path = NodePath(".:position")
properties/0/spawn = true
properties/0/replication_mode = 1
properties/1/path = NodePath(".:rotation")
properties/1/path = NodePath(".:hp")
properties/1/spawn = true
properties/1/replication_mode = 1
properties/2/path = NodePath("Camera3D:rotation")
properties/2/path = NodePath(".:team")
properties/2/spawn = true
properties/2/replication_mode = 1
properties/3/path = NodePath(".:hp")
properties/2/replication_mode = 2
properties/3/path = NodePath(".:player_id")
properties/3/spawn = true
properties/3/replication_mode = 1
properties/4/path = NodePath(".:team")
properties/3/replication_mode = 0
properties/4/path = NodePath(".:collision_layer")
properties/4/spawn = true
properties/4/replication_mode = 2
properties/4/replication_mode = 0
properties/5/path = NodePath(".:collision_mask")
properties/5/spawn = true
properties/5/replication_mode = 0
[sub_resource type="Curve" id="Curve_fbysy"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 2.5229826, 0.0, 0, 0]
@ -7605,6 +7616,14 @@ _data = {
radius = 0.82177734
height = 3.7087402
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_5amik"]
properties/0/path = NodePath("PlayerInput:direction")
properties/0/spawn = true
properties/0/replication_mode = 1
properties/1/path = NodePath("PlayerInput:compressed_states")
properties/1/spawn = true
properties/1/replication_mode = 1
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("weapon_models")]
collision_layer = 2
collision_mask = 3
@ -7617,6 +7636,7 @@ weapon_models = {
[node name="molikman_ingame" type="Node3D" parent="."]
transform = Transform3D(0.75, 0, 0, 0, 0.74999994, 0, 0, 0, 0.74999994, 0, 1.1793717, 0)
visible = false
[node name="Armature" type="Node3D" parent="molikman_ingame"]
@ -8087,10 +8107,6 @@ mesh = SubResource("ArrayMesh_aj0lc")
skin = SubResource("Skin_53wat")
surface_material_override/0 = ExtResource("26_r2jxp")
[node name="VisibleEnabler" type="Node" parent="molikman_ingame"]
script = ExtResource("4_smehm")
visible_for_others = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_u8vuu")
@ -8580,6 +8596,9 @@ script = ExtResource("4_smehm")
fov = 90.0
script = ExtResource("8_rwwcc")
[node name="CameraSync" type="MultiplayerSynchronizer" parent="Camera3D"]
replication_config = SubResource("SceneReplicationConfig_b2eak")
[node name="StandArea" type="Area3D" parent="."]
collision_layer = 0
@ -8702,7 +8721,7 @@ grow_vertical = 2
visible = false
layout_mode = 2
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
[node name="PlayerPropertiesSync" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_qhqgy")
[node name="StepAudio" type="AudioStreamPlayer3D" parent="."]
@ -8735,14 +8754,6 @@ bus = &"GameplayMain"
script = ExtResource("17_0cqlf")
metadata/_custom_type_script = "uid://da0xv360va3b3"
[node name="DamageAudio" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource("23_b2eak")
max_distance = 100.0
max_polyphony = 10
bus = &"GameplayMain"
script = ExtResource("17_0cqlf")
metadata/_custom_type_script = "uid://da0xv360va3b3"
[node name="ShootAudio" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource("20_moxwy")
attenuation_model = 1
@ -8758,7 +8769,7 @@ script = ExtResource("8_f1ej7")
current_state = NodePath("Stand")
metadata/_custom_type_script = "uid://3777rkbebgjm"
[node name="Crouch" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("stand_up_area", "player", "player_movement", "animation_player", "weapon_system")]
[node name="Crouch" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("stand_up_area", "player", "player_movement", "player_input", "animation_player", "weapon_system")]
script = ExtResource("9_oprun")
max_speed = 3.0
acceleration = 50.0
@ -8766,35 +8777,38 @@ deceleration = 50.0
stand_up_area = NodePath("../../StandArea")
player = NodePath("../..")
player_movement = NodePath("../../PlayerMovement")
player_input = NodePath("../../PlayerInput")
animation_player = NodePath("../../AnimationPlayer")
weapon_system = NodePath("../../WeaponSystem")
[node name="Stand" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "weapon_system", "audio")]
[node name="Stand" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "player_input", "weapon_system", "audio")]
script = ExtResource("10_a8ls1")
max_speed = 6.0
acceleration = 100.0
deceleration = 50.0
JUMP_VELOCITY = 6.0
player = NodePath("../..")
player_movement = NodePath("../../PlayerMovement")
player_input = NodePath("../../PlayerInput")
weapon_system = NodePath("../../WeaponSystem")
audio = NodePath("../../StepAudio")
step_delay = 0.25
step_speed_curve = SubResource("Curve_fbysy")
[node name="Walk" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "weapon_system")]
[node name="Walk" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "player_input", "weapon_system")]
script = ExtResource("11_qfm1y")
max_speed = 3.0
acceleration = 50.0
deceleration = 50.0
player = NodePath("../..")
player_movement = NodePath("../../PlayerMovement")
player_input = NodePath("../../PlayerInput")
weapon_system = NodePath("../../WeaponSystem")
[node name="Fall" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "weapon_system", "land_sound")]
[node name="Fall" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "player_input", "weapon_system", "land_sound")]
script = ExtResource("12_fulsm")
player = NodePath("../..")
player_movement = NodePath("../../PlayerMovement")
player_input = NodePath("../../PlayerInput")
acceleration = 25.0
weapon_system = NodePath("../../WeaponSystem")
land_sound = NodePath("../../LandAudio")
@ -8803,9 +8817,11 @@ land_sound = NodePath("../../LandAudio")
script = ExtResource("19_rwwcc")
animation_player = NodePath("../../AnimationPlayer")
[node name="PlayerMovement" type="Node" parent="." node_paths=PackedStringArray("player")]
[node name="PlayerMovement" type="Node" parent="." node_paths=PackedStringArray("player", "player_input")]
script = ExtResource("19_70eug")
player = NodePath("..")
player_input = NodePath("../PlayerInput")
jump_velocity = 12.0
[node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("animation_player", "camera", "player")]
script = ExtResource("4_qlg0r")
@ -8850,12 +8866,14 @@ material = ExtResource("26_r2jxp")
player = NodePath("..")
blue_team_texture = ExtResource("27_j3w78")
[connection signal="died" from="." to="molikman_ingame/VisibleEnabler" method="reverse"]
[node name="PlayerInput" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_5amik")
script = ExtResource("37_b2eak")
[connection signal="died" from="." to="Camera3D" method="disable"]
[connection signal="died" from="." to="Camera3D/DeadSpectator" method="set_active"]
[connection signal="died" from="." to="BodyStateMachine/Death" method="on_death"]
[connection signal="died" from="." to="PlayerMovement" method="disable"]
[connection signal="died" from="." to="WeaponSystem" method="disable"]
[connection signal="health_changed" from="." to="HUD/Healthbar" method="on_hp_changed"]
[connection signal="spawned" from="." to="TeamUpdater" method="on_spawned"]
[connection signal="ammo_updated" from="WeaponSystem" to="HUD/AmmoDisplay" method="on_ammo_updated"]

View file

@ -9,7 +9,7 @@
[node name="Bomb" type="Node" node_paths=PackedStringArray("enter_state")]
script = ExtResource("1_krsgt")
animation_prefix = &"baked_bomb_"
index = &"bomb"
droppable = &"uid://cxdgk74ln5xpn"
visibility_target = &"bomb"
max_ammo = 1
ammo_mags = 0

View file

@ -21,7 +21,7 @@ point_count = 5
[node name="StartingPistol" type="Node" node_paths=PackedStringArray("enter_state")]
script = ExtResource("1_g7s1i")
animation_prefix = &"baked_sp_"
index = &"sp"
droppable = &"uid://dgfqppi21c2u0"
visibility_target = &"sp"
max_ammo = 20
speed_modifier = 0.9

View file

@ -2,3 +2,6 @@ extends Node
var SENSITIVITY: float = 0.02
var TOGGLE_CROUCH: bool = false
var TOGGLE_SCOPE: bool = false
var TOGGLE_WALK: bool = false

View file

@ -0,0 +1,182 @@
extends MultiplayerSynchronizer
class_name PlayerInput
const SCOPE: int = 0b1
const CROUCH: int = 0b10
const WALK: int = 0b100
#region SYNC
@export var direction: Vector2
@export var compressed_states: int
#endregion
signal jumped
signal drop
signal switch_weapon(to_slot: StringName)
signal fire_begin
signal fire_end
signal alternate_state
signal switch_firemode
signal reload
signal scope_begin
signal scope_end
signal crouch_begin
signal crouch_end
signal walk_begin
signal walk_end
signal interact_begin
signal interact_end
func _process(_delta: float) -> void:
if not is_multiplayer_authority(): return
direction = Input.get_vector("plr_strafe_r","plr_strafe_l", "plr_back","plr_forward")
func _input(event: InputEvent) -> void:
if not is_multiplayer_authority(): return
if event.is_action_pressed("plr_ult"):
switch_on_server.rpc_id(1,"ultimate")
elif event.is_action_pressed("plr_bomb"):
switch_on_server.rpc_id(1,"bomb")
elif event.is_action_pressed("plr_primary"):
switch_on_server.rpc_id(1,"primary")
elif event.is_action_pressed("plr_active_first"):
switch_on_server.rpc_id(1,"ability_first")
elif event.is_action_pressed("plr_active_second"):
switch_on_server.rpc_id(1,"ability_second")
elif event.is_action_pressed("plr_active_third"):
switch_on_server.rpc_id(1,"ability_third")
elif event.is_action_pressed("plr_secondary"):
switch_on_server.rpc_id(1,"secondary")
elif event.is_action_pressed("plr_knife"):
switch_on_server.rpc_id(1,"knife")
if event.is_action_pressed("plr_fire"):
fire_on_server.rpc_id(1,false)
if event.is_action_released("plr_fire"):
fire_on_server.rpc_id(1,true)
if event.is_action_pressed("plr_scope"):
alternate_state_on_server.rpc_id(1)
if event.is_action_pressed("plr_firemode"):
switch_firemode_on_server.rpc_id(1)
if event.is_action_pressed("plr_drop"):
drop_on_server.rpc_id(1)
var crouching: bool = compressed_states & CROUCH
var walking: bool = compressed_states & WALK
var scoping: bool = compressed_states & SCOPE
if event.is_action_pressed("plr_crouch"):
if ClientSettings.TOGGLE_CROUCH:
crouch_on_server.rpc_id(1,crouching)
compressed_states ^= CROUCH
elif not crouching:
compressed_states |= CROUCH
crouch_on_server.rpc_id(1,false)
if event.is_action_released("plr_crouch") and not ClientSettings.TOGGLE_CROUCH and crouching:
compressed_states &= ~CROUCH
crouch_on_server.rpc_id(1,true)
if event.is_action_pressed("plr_walk"):
if ClientSettings.TOGGLE_WALK:
walk_on_server.rpc_id(1,walking)
compressed_states ^= WALK
elif not walking:
compressed_states |= WALK
walk_on_server.rpc_id(1,false)
if event.is_action_released("plr_walk") and not ClientSettings.TOGGLE_WALK and walking:
compressed_states &= ~WALK
walk_on_server.rpc_id(1,true)
if event.is_action_pressed("plr_scope"):
if ClientSettings.TOGGLE_SCOPE:
scope_on_server.rpc_id(1,scoping)
compressed_states ^= SCOPE
elif not scoping:
compressed_states |= SCOPE
scope_on_server.rpc_id(1,false)
if event.is_action_released("plr_scope") and not ClientSettings.TOGGLE_SCOPE and scoping:
compressed_states &= ~SCOPE
scope_on_server.rpc_id(1,true)
if event.is_action_pressed("plr_reload"):
reload_on_server.rpc_id(1)
if event.is_action_pressed("plr_interact"):
interact_on_server.rpc_id(1,false)
if event.is_action_released("plr_interact"):
interact_on_server.rpc_id(1,true)
if event.is_action_pressed("plr_jump"):
jump_on_server.rpc_id(1)
@rpc("authority","call_local","reliable")
func switch_on_server(slot: StringName) -> void:
if not multiplayer.is_server(): return
switch_weapon.emit(slot)
@rpc("authority","call_local","reliable")
func drop_on_server() -> void:
if not multiplayer.is_server(): return
drop.emit()
@rpc("authority","call_local","reliable")
func fire_on_server(end: bool) -> void:
if not multiplayer.is_server(): return
if end:
fire_end.emit()
else:
fire_begin.emit()
@rpc("authority","call_local","reliable")
func alternate_state_on_server() -> void:
if not multiplayer.is_server(): return
alternate_state.emit()
@rpc("authority","call_local","reliable")
func switch_firemode_on_server() -> void:
if not multiplayer.is_server(): return
switch_firemode.emit()
@rpc("authority","call_local","reliable")
func crouch_on_server(end: bool) -> void:
if not multiplayer.is_server(): return
if end:
crouch_end.emit()
else:
crouch_begin.emit()
@rpc("authority","call_local","reliable")
func walk_on_server(end: bool) -> void:
if not multiplayer.is_server(): return
if end:
walk_end.emit()
else:
walk_begin.emit()
@rpc("authority","call_local","reliable")
func scope_on_server(end: bool) -> void:
if not multiplayer.is_server(): return
if end:
scope_end.emit()
else:
scope_begin.emit()
@rpc("authority","call_local","reliable")
func reload_on_server() -> void:
if not multiplayer.is_server(): return
reload.emit()
@rpc("authority","call_local","reliable")
func interact_on_server(end: bool) -> void:
if not multiplayer.is_server(): return
if end:
interact_end.emit()
else:
interact_begin.emit()
@rpc("authority","call_local","reliable")
func jump_on_server() -> void:
if not multiplayer.is_server(): return
jumped.emit()

View file

@ -0,0 +1 @@
uid://dfvnx8f1v6m5g

View file

@ -86,7 +86,7 @@ func _process(_delta: float) -> void:
func update_clock(time: float):
reference_round_time = time
@rpc("any_peer","call_remote","reliable")
@rpc("authority","call_remote","reliable")
func start_session() -> void:
if not is_server_request():
return
@ -100,7 +100,7 @@ func start_session() -> void:
start_round()
@rpc("any_peer","call_remote","reliable")
@rpc("authority","call_remote","reliable")
func end_session() -> void:
if not is_server_request():
return
@ -114,7 +114,7 @@ func end_session() -> void:
session_started = false
@rpc("any_peer","call_remote","reliable")
@rpc("authority","call_remote","reliable")
func start_round() -> void:
if not is_server_request():
return
@ -134,7 +134,7 @@ func start_round() -> void:
round_state = ROUND_STATES.BUY
round_state_changed.emit.call_deferred(round_state)
@rpc("any_peer","call_remote","reliable")
@rpc("authority","call_remote","reliable")
func end_round(win_team: int) -> void:
if not is_server_request():
return
@ -150,7 +150,7 @@ func end_round(win_team: int) -> void:
round_state = ROUND_STATES.AFTER_ROUND
round_state_changed.emit(round_state)
@rpc("any_peer","call_remote","reliable")
@rpc("authority","call_remote","reliable")
func begin_main_stage() -> void:
if not is_server_request():
return
@ -161,7 +161,7 @@ func begin_main_stage() -> void:
round_state = ROUND_STATES.ROUND
round_state_changed.emit(round_state)
@rpc("any_peer","call_remote","reliable")
@rpc("authority","call_remote","reliable")
func begin_bomb_stage() -> void:
if not is_server_request():
return
@ -179,7 +179,6 @@ func defuse_win() -> void:
bomb_timer.stop()
end_round(TEAMS.DEFENCE)
@rpc("any_peer","call_local","reliable")
func add_dead(team: int):
if multiplayer.is_server() == false:
return
@ -204,12 +203,7 @@ func is_server_request() -> bool:
## ammo, remaining_ammo, slot - data for dropped weapon [br]
## for more, see dyn_objects_spawner.gd
func spawn(data: Dictionary) -> void:
spawn_internal.rpc_id(1,data)
@rpc("any_peer","call_local","reliable")
func spawn_internal(data: Dictionary) -> void:
if multiplayer.is_server() == false:
printerr(str(multiplayer.get_remote_sender_id())+" tried to spawn internally on "+str(multiplayer.get_unique_id()))
return
var object = dynamic_objects_spawner.spawn(data)
@ -217,25 +211,14 @@ func spawn_internal(data: Dictionary) -> void:
if data.has("position"):
object.global_position = data.position
func despawn(path: NodePath):
despawn_internal.rpc_id(1,path)
@rpc("any_peer","call_local","reliable")
func despawn_internal(path: NodePath) -> void:
func despawn(path: NodePath) -> void:
if multiplayer.is_server() == false:
printerr(str(multiplayer.get_remote_sender_id())+" tried to despawn internally on "+str(multiplayer.get_unique_id()))
return
get_node(path).queue_free()
func shoot(damage: int,distance: float = 100) -> void:
if multiplayer.get_unique_id() == 1:
shoot_internal(1,damage,distance)
else:
shoot_internal.rpc_id(1,multiplayer.get_unique_id(),damage,distance)
@rpc("any_peer","call_local","reliable")
func shoot_internal(id:int , damage: int, distance: float) -> void:
func shoot(id:int , damage: int, distance: float) -> void:
if multiplayer.is_server() == false:
return
@ -260,16 +243,12 @@ func shoot_internal(id:int , damage: int, distance: float) -> void:
if collision != {} and collision["collider"] is Player:
collision["collider"].take_damage.rpc_id(int(collision["collider"].name),damage)
func interact() -> void:
if multiplayer.get_unique_id() == 1:
interact_internal(1)
else:
interact_internal.rpc_id(1,multiplayer.get_unique_id())
@rpc("any_peer","call_local","reliable")
func interact_internal(id:int) -> void:
func interact() -> void:
if multiplayer.is_server() == false:
return
var id = multiplayer.get_remote_sender_id()
var player: Player = player_nodes[id]
var player_camera: Camera3D = player.get_node("Camera3D")
@ -285,16 +264,11 @@ func interact_internal(id:int) -> void:
if collision != {} and collision["collider"] is Interactible:
collision["collider"].interaction_start(id)
func stop_interact():
if multiplayer.get_unique_id() == 1:
stop_interact_internal(1)
else:
stop_interact_internal.rpc_id(1,multiplayer.get_unique_id())
@rpc("any_peer","call_local","reliable")
func stop_interact_internal(id: int) -> void:
func stop_interact() -> void:
if multiplayer.is_server() == false:
return
var id = multiplayer.get_remote_sender_id()
player_stopped_interacting.emit(id)
func is_on_site() -> bool:

View file

@ -5,40 +5,20 @@ func _ready() -> void:
Session.dynamic_objects_spawner = self
func request_spawn(data: Variant) -> Node:
if is_multiplayer_authority() == false: return
if data.has("type") == false or data.has("spawn_name") == false:
if data.has("scene") == false:
return Node.new()
match data.type:
"weapon":
var weapon: DroppableWeapon = Registry.weapons[data.spawn_name].dropped_scene.instantiate()
weapon.apply_central_impulse(data.impulse)
weapon.weapon.ammo = data.ammo
weapon.weapon.remaining_ammo = data.remaining_ammo
weapon.slot = Registry.weapons[data.spawn_name].slot
for key in data.keys():
if key == "impulse" or key == "ammo" or key == "remaining_ammo":
continue
weapon.set(key,data[key])
return weapon
"projectile":
var projectile: RigidBody3D = Registry.spawnable_objects[data.spawn_name].instantiate()
projectile.apply_central_impulse(data.impulse)
for key in data.keys():
if key == "impulse":
continue
projectile.set(key,data[key])
return projectile
"object":
var object: Node3D = Registry.spawnable_objects[data.spawn_name].instantiate()
for key in data.keys():
object.set(key,data[key])
return object
_:
return Node.new()
var node = load(data.scene).instantiate()
if data.has("impulse"):
if data.has_all(["ammo","remaining_ammo","slot"]):
node.weapon.ammo = data.ammo
node.weapon.remaining_ammo = data.remaining_ammo
node.slot = data.slot
node.apply_impulse(data.impulse)
for key in data.keys():
if key in ["scene","ammo","remaining_ammo","slot","position","rotation"]:
continue
node.set(key,data[key])
return node

View file

@ -15,6 +15,8 @@ func _exit_tree() -> void:
Session.round_started.disconnect(spawn)
func spawn():
if not multiplayer.is_server():
return
match team:
Session.TEAMS.ATTACK:
for attacker in Lobby.attack_team:
@ -36,18 +38,22 @@ func spawn_player(id: int) -> void:
elif team == Session.TEAMS.ATTACK:
Session.attackers_alive += 1
deferred_setup.bind(inst,team).call_deferred()
var distance = randf_range(0,spawn_radius)
var angle = randf_range(0,TAU)
var new_position = global_position + Vector3.RIGHT.rotated(Vector3.UP,angle) * distance
inst.player_id = id
get_parent().add_child(inst)
inst.global_position = new_position
inst.team = team
func spawn_spectator(id: int) -> void:
var spectator: PackedScene = load("res://scenes/spectator.tscn")
var inst = spectator.instantiate()
inst.name = str(id)
deferred_setup.bind(inst,Session.TEAMS.SPECTATE).call_deferred()
func deferred_setup(what: Node3D, new_team: Session.TEAMS):
get_parent().add_child(what,true)
var distance = randf_range(0,spawn_radius)
var angle = randf_range(0,TAU)
var new_position = global_position + Vector3.RIGHT.rotated(Vector3.UP,angle) * distance
what.set_after_spawn.rpc_id(int(what.name),new_position,new_team)
get_parent().add_child(inst)
inst.global_position = new_position
inst.team = team

View file

@ -7,17 +7,10 @@ extends Node
const ATTACK_LAYER: int = 0b10000
const DEFENCE_LAYER: int = 0b100000
func on_spawned() -> void:
func _ready() -> void:
if is_multiplayer_authority() == false: return
var mask = (ATTACK_LAYER if (player.team == Session.TEAMS.DEFENCE != inverse) else DEFENCE_LAYER)
if layer:
get_parent().collision_layer |= mask
else:
get_parent().collision_mask |= mask
global_update.rpc(layer,mask)
@rpc
func global_update(new_layer,mask) -> void:
if new_layer:
get_parent().collision_layer |= mask
else:
get_parent().collision_mask |= mask

View file

@ -4,9 +4,8 @@ extends Camera3D
var active: bool
func _ready() -> void:
if not is_multiplayer_authority():
return
func _enter_tree() -> void:
set_multiplayer_authority(int(get_parent().get_parent().name))
func set_active() -> void:
if not is_multiplayer_authority():

View file

@ -1,11 +0,0 @@
extends Node
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View file

@ -1 +0,0 @@
uid://cg0v1nmwuuoej

View file

@ -4,10 +4,14 @@ class_name Player
@export var team: Session.TEAMS
@export var weapon_models: Dictionary[StringName,Node3D]
@export var player_id: int = 1:
set(id):
player_id = id
$PlayerInput.set_multiplayer_authority(id)
$Camera3D.set_multiplayer_authority(id)
var passived: bool = false
signal spawned
signal health_changed(to: int)
signal died
@ -26,52 +30,24 @@ const MAX_HP = 100
get:
return hp
func _enter_tree() -> void:
set_multiplayer_authority(str(name).to_int())
func _physics_process(_delta: float) -> void:
if not is_multiplayer_authority():
if not multiplayer.is_server():
return
move_and_slide()
func die() -> void:
if (not is_multiplayer_authority()):
if (not multiplayer.is_server()):
return
Session.add_dead.rpc(team)
Session.add_dead(team)
died.emit()
passived = true
@rpc("any_peer","call_local","reliable")
func passive() -> void:
passived = true
@rpc("any_peer","call_local","reliable")
func depassive() -> void:
passived = false
@rpc("any_peer","call_local","reliable")
func kill_request() -> void:
if multiplayer.get_remote_sender_id() != 1:
return
die()
@rpc("any_peer","call_local","reliable")
func set_after_spawn(start_position: Vector3,new_team: int):
global_position = start_position
team = new_team as Session.TEAMS
spawned.emit()
@rpc("any_peer","call_local","reliable")
func take_damage(damage: int):
hp -= damage
$DamageAudio.multiplayer_play()
func _input(event: InputEvent) -> void:
if not is_multiplayer_authority():
return
if event.is_action_pressed("plr_interact"):
Session.interact()
if event.is_action_released("plr_interact"):
Session.stop_interact()

View file

@ -3,6 +3,9 @@ extends Node
class_name PlayerMovement
@export var player: Player
@export var player_input: PlayerInput
@export var jump_velocity: float
var disabled: bool
func disable() -> void:
@ -15,7 +18,7 @@ func process_movement(max_speed: float,acceleration: float,deceleration: float,d
player.velocity.x = 0
player.velocity.z = 0
return
var input_dir := Input.get_vector("plr_strafe_r","plr_strafe_l", "plr_back","plr_forward")
var input_dir := player_input.direction
var direction := (player.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
player.velocity.x = clamp(player.velocity.x + direction.x * acceleration * delta,-max_speed*abs(direction.x),max_speed*abs(direction.x))
@ -23,3 +26,6 @@ func process_movement(max_speed: float,acceleration: float,deceleration: float,d
else:
player.velocity.x = move_toward(player.velocity.x, 0, deceleration*delta)
player.velocity.z = move_toward(player.velocity.z, 0, deceleration*delta)
func jump() -> void:
player.velocity.y = jump_velocity

View file

@ -8,22 +8,22 @@ extends State
@export var stand_up_area: Area3D
@export var player: Player
@export var player_movement: PlayerMovement
@export var player_input: PlayerInput
@export var animation_player: AnimationPlayer
@export var crouch_time: float = 0.1
@export var weapon_system: WeaponSystem
func enter() -> void:
animation_player.play("crouch",-1,1/crouch_time)
player_input.crouch_end.connect(try_end_crouch)
func exit() -> void:
animation_player.play("crouch",-1,-1/crouch_time,true)
player_input.crouch_end.disconnect(try_end_crouch)
func physics_update(delta: float) -> void:
if not is_multiplayer_authority():
return
if Input.is_action_just_pressed("plr_jump") and player.is_on_floor() and toggle:
transition.emit("Stand")
return
if not player.is_on_floor():
transition.emit("Fall")
@ -31,7 +31,6 @@ func physics_update(delta: float) -> void:
player_movement.process_movement(max_speed * weapon_system.get_speed_modifier(),acceleration,deceleration,delta)
func state_input(event: InputEvent) -> void:
if (toggle == true and event.is_action_pressed("plr_crouch")) or (toggle == false and event.is_action_released("plr_crouch")):
if stand_up_area.has_overlapping_bodies() == false:
transition.emit("Stand")
func try_end_crouch() -> void:
if player.is_on_floor() and stand_up_area.has_overlapping_bodies() == false:
transition.emit("Stand")

View file

@ -2,6 +2,7 @@ extends State
@export var player: Player
@export var player_movement: PlayerMovement
@export var player_input: PlayerInput
@export var max_speed: float = 5.0
@export var acceleration: float
@export var weapon_system: WeaponSystem
@ -18,7 +19,12 @@ func physics_update(delta: float) -> void:
if not is_multiplayer_authority():
return
if player.is_on_floor():
transition.emit("Stand")
if player_input.compressed_states & PlayerInput.CROUCH:
transition.emit("Crouch")
elif player_input.compressed_states & PlayerInput.WALK:
transition.emit("Walk")
else:
transition.emit("Stand")
land_sound.multiplayer_play()
player.velocity += player.get_gravity() * delta

View file

@ -3,9 +3,9 @@ extends State
@export var max_speed: float = 5.0
@export var acceleration: float = 2.0
@export var deceleration: float = 200.0
@export var JUMP_VELOCITY: float = 4.5
@export var player: Player
@export var player_movement: PlayerMovement
@export var player_input: PlayerInput
@export var weapon_system: WeaponSystem
@export var audio: MultiplayerAudio3D
@export var step_delay: float
@ -14,18 +14,19 @@ extends State
var step_time: float
func enter() -> void:
pass
player_input.jumped.connect(on_jumped)
player_input.crouch_begin.connect(begin_crouch)
player_input.walk_begin.connect(begin_walk)
func exit() -> void:
player_input.jumped.disconnect(on_jumped)
player_input.crouch_begin.disconnect(begin_crouch)
player_input.walk_begin.disconnect(begin_walk)
step_time = 0
func physics_update(delta: float) -> void:
if not is_multiplayer_authority():
return
if Input.is_action_just_pressed("plr_jump") and player.is_on_floor():
player.velocity.y = JUMP_VELOCITY * sign(weapon_system.get_speed_modifier())
transition.emit("Fall")
return
if not player.is_on_floor():
transition.emit("Fall")
@ -38,9 +39,13 @@ func physics_update(delta: float) -> void:
player_movement.process_movement(max_speed * weapon_system.get_speed_modifier(),acceleration,deceleration,delta)
func state_input(event: InputEvent) -> void:
if event.is_action_pressed("plr_crouch"):
transition.emit("Crouch")
if event.is_action_pressed("plr_walk"):
transition.emit("Walk")
func on_jumped() -> void:
if player.is_on_floor():
player_movement.jump()
transition.emit("Fall")
func begin_walk() -> void:
transition.emit("Walk")
func begin_crouch() -> void:
transition.emit("Crouch")

View file

@ -6,21 +6,22 @@ extends State
@export var JUMP_VELOCITY: float = 4.5
@export var player: Player
@export var player_movement: PlayerMovement
@export var player_input: PlayerInput
@export var weapon_system: WeaponSystem
func enter() -> void:
pass
player_input.crouch_begin.connect(begin_crouch)
player_input.walk_end.connect(end_walk)
player_input.jumped.connect(on_jumped)
func exit() -> void:
pass
player_input.crouch_begin.disconnect(begin_crouch)
player_input.walk_end.disconnect(end_walk)
player_input.jumped.disconnect(on_jumped)
func physics_update(delta: float) -> void:
if not is_multiplayer_authority():
return
if Input.is_action_just_pressed("plr_jump") and player.is_on_floor():
player.velocity.y = JUMP_VELOCITY
transition.emit("Fall")
return
if not player.is_on_floor():
transition.emit("Fall")
@ -28,9 +29,13 @@ func physics_update(delta: float) -> void:
player_movement.process_movement(max_speed * weapon_system.get_speed_modifier(),acceleration,deceleration,delta)
func state_input(event: InputEvent) -> void:
if event.is_action_released("plr_walk"):
transition.emit("Stand")
if event.is_action_pressed("plr_crouch"):
transition.emit("Crouch")
func on_jumped() -> void:
if player.is_on_floor():
player_movement.jump()
transition.emit("Fall")
func end_walk() -> void:
transition.emit("Stand")
func begin_crouch() -> void:
transition.emit("Crouch")

View file

@ -5,8 +5,5 @@ extends Node
@export var blue_team_texture: Texture2D
func _ready() -> void:
get_tree().create_timer(1).timeout.connect(on_player_spawned)
func on_player_spawned() -> void:
if player.team == Session.TEAMS.DEFENCE:
material.albedo_texture = blue_team_texture

View file

@ -1,11 +0,0 @@
extends Node
var spawnable_objects: Dictionary[StringName,PackedScene]
var weapons: Dictionary[StringName,WeaponResource]
func _ready() -> void:
for file in ResourceLoader.list_directory("res://weapons/"):
weapons[file.trim_suffix(".tres")] = load("res://weapons/"+ file)
for file in ResourceLoader.list_directory("res://spawnables/"):
spawnable_objects[file.trim_suffix(".tscn")] = load("res://spawnables/" + file)

View file

@ -1 +0,0 @@
uid://c7p8avavia4fp

View file

@ -1,9 +0,0 @@
extends Resource
class_name WeaponResource
@export var cost: int
@export var preview: Texture2D
@export var dropped_scene: PackedScene
@export var weapon_system_scene: PackedScene
@export var slot: StringName

View file

@ -1 +0,0 @@
uid://bvnn2eiwqbu7t

View file

@ -13,6 +13,7 @@ func _ready() -> void:
else:
push_warning("Child of state machine is not state")
current_state.enter()
func on_transition_required(to: StringName):
if is_multiplayer_authority() == false:
@ -30,7 +31,7 @@ func change_state(to_state: State) -> void:
current_state = to_state
current_state.enter()
@rpc
@rpc("authority","call_local","reliable")
func change_state_to_name(to_name: StringName):
if current_state != null:
current_state.exit()

View file

@ -1,5 +1,7 @@
extends WeaponState
const active_bomb: StringName = "uid://dtbpyfdawb02b"
func enter():
machine.animation_player.play(machine.animation_prefix+"plant")
machine.animation_player.animation_finished.connect(on_animation_finished)
@ -15,7 +17,7 @@ func on_animation_finished(animation: StringName):
return
if animation == machine.animation_prefix + "plant":
Session.spawn({"type": "object","spawn_name": "active_bomb", "position": machine.player_camera.get_parent().global_position,"plant": Session.get_site().name})
Session.spawn({"scene": active_bomb, "position": machine.player_camera.get_parent().global_position,"plant": Session.get_site().name})
machine.ammo -= 1
return_to_previous.emit()

View file

@ -39,7 +39,7 @@ func fire() -> void:
machine.animation_player.play(with_morphems("shoot"))
if is_multiplayer_authority():
Session.shoot(damage,shoot_distance)
Session.shoot(int(machine.player.name),damage,shoot_distance)
fire_timer.start()
machine.player_camera.recoil(horizontal_curve.sample(bullets_shot),vertical_curve.sample(bullets_shot))

View file

@ -14,7 +14,7 @@ func exit() -> void:
func attack() -> void:
if is_multiplayer_authority():
Session.shoot(damage,1.5)
Session.shoot(int(machine.player.name),damage,1.5)
func on_animation_finished(animation):
if animation == machine.animation_prefix + "attack":

View file

@ -12,7 +12,7 @@ func exit() -> void:
func attack() -> void:
if is_multiplayer_authority():
Session.shoot(damage,1.5)
Session.shoot(int(machine.player.name),damage,1.5)
func on_animation_finished(animation):
if animation == machine.animation_prefix + "heavy_attack":

View file

@ -3,7 +3,7 @@ extends SubStateMachine
class_name WeaponSubStateMachine
@export var animation_prefix: StringName
@export var index: StringName
@export var droppable: StringName
@export var visibility_target: StringName
@export var max_ammo: int

View file

@ -78,8 +78,6 @@ func switch(to: StringName, exit: bool = true):
ammo_updated.emit(current_state.ammo,current_state.remaining_ammo)
switched_to.emit(current_state)
update_remotes.rpc(to,exit)
func return_to_previous(exit: bool = true):
if last_slot != "":
@ -87,15 +85,6 @@ func return_to_previous(exit: bool = true):
else:
switch("knife", exit)
@rpc("authority","call_remote","reliable")
func update_remotes(to: StringName,exit: bool):
if current_state != null and exit:
current_state.exit()
current_state = slots[to]
current_state.enter()
switched_to.emit(current_state)
func drop_current():
drop(current_state)
@ -103,8 +92,7 @@ func drop(weapon: WeaponSubStateMachine) -> void:
if slots.find_key(weapon) == "knife":
return
var drop_data: Dictionary = {}
drop_data.type = "weapon"
drop_data.spawn_name = weapon.index
drop_data.scene = weapon.droppable
drop_data.ammo = weapon.ammo
drop_data.remaining_ammo = weapon.remaining_ammo
drop_data.slot = weapon.slot
@ -173,40 +161,3 @@ func _physics_process(delta: float) -> void:
if current_state == null or disabled:
return
current_state.physics_update(delta)
func _input(event: InputEvent) -> void:
if is_multiplayer_authority() == false or disabled: return
if current_state != null:
current_state.state_input(event)
if event.is_action_pressed("plr_ult"):
switch("ultimate")
elif event.is_action_pressed("plr_bomb"):
switch("bomb")
elif event.is_action_pressed("plr_primary"):
switch("primary")
elif event.is_action_pressed("plr_active_first"):
switch("ability_first")
elif event.is_action_pressed("plr_active_second"):
switch("ability_second")
elif event.is_action_pressed("plr_active_third"):
switch("ability_third")
elif event.is_action_pressed("plr_secondary"):
switch("secondary")
elif event.is_action_pressed("plr_knife"):
switch("knife")
if not Session.round_state == Session.ROUND_STATES.BUY and not player.passived:
if event.is_action_pressed("plr_fire"):
current_state.use_begin.rpc()
if event.is_action_released("plr_fire"):
current_state.use_end.rpc()
if event.is_action_pressed("plr_scope"):
current_state.alternate_state()
if event.is_action_pressed("plr_firemode"):
current_state.switch_mode()
if event.is_action_pressed("plr_drop"):
drop_current()

View file

@ -1,14 +0,0 @@
[gd_resource type="Resource" script_class="WeaponResource" load_steps=5 format=3 uid="uid://b1obqb8w0o3ma"]
[ext_resource type="PackedScene" uid="uid://cxdgk74ln5xpn" path="res://scenes/weapons/droppable_bomb.tscn" id="1_sbnmj"]
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://scripts/resources/weapon_resource.gd" id="1_w2ux2"]
[ext_resource type="Texture2D" uid="uid://dnxw4x3cmu7io" path="res://icon.svg" id="2_vkfbs"]
[ext_resource type="PackedScene" uid="uid://bxdatd1ilfgmc" path="res://scenes/weapons/bomb.tscn" id="4_shxvo"]
[resource]
script = ExtResource("1_w2ux2")
preview = ExtResource("2_vkfbs")
dropped_scene = ExtResource("1_sbnmj")
weapon_system_scene = ExtResource("4_shxvo")
slot = &"bomb"
metadata/_custom_type_script = "uid://bvnn2eiwqbu7t"

View file

@ -1,15 +0,0 @@
[gd_resource type="Resource" script_class="WeaponResource" load_steps=5 format=3 uid="uid://2jxguk5jxlim"]
[ext_resource type="PackedScene" uid="uid://dgfqppi21c2u0" path="res://scenes/weapons/droppable_sp.tscn" id="1_vpohq"]
[ext_resource type="Texture2D" uid="uid://dnxw4x3cmu7io" path="res://icon.svg" id="2_c0lu7"]
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://scripts/resources/weapon_resource.gd" id="3_eyl1o"]
[ext_resource type="PackedScene" uid="uid://djwjl8xll53vn" path="res://scenes/weapons/starting_pistol.tscn" id="4_vpohq"]
[resource]
script = ExtResource("3_eyl1o")
cost = 200
preview = ExtResource("2_c0lu7")
dropped_scene = ExtResource("1_vpohq")
weapon_system_scene = ExtResource("4_vpohq")
slot = &"secondary"
metadata/_custom_type_script = "uid://bvnn2eiwqbu7t"