From 2f4181a18b3d61df79ddeae0747a51b0c5035bea Mon Sep 17 00:00:00 2001 From: leca Date: Mon, 26 Feb 2024 18:18:52 +0300 Subject: [PATCH] Player now respawns at proper spawnpoint --- scenes/maps/OffisMi.tscn | 12 +++++++++--- scripts/Networking.gd | 12 ++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/scenes/maps/OffisMi.tscn b/scenes/maps/OffisMi.tscn index 993605c..f30336c 100644 --- a/scenes/maps/OffisMi.tscn +++ b/scenes/maps/OffisMi.tscn @@ -13,9 +13,10 @@ sky_material = SubResource("ProceduralSkyMaterial_efxfa") [sub_resource type="Environment" id="Environment_n1nic"] background_mode = 2 sky = SubResource("Sky_e5cvk") -ambient_light_source = 1 -ambient_light_color = Color(0.133333, 0.0666667, 0.231373, 1) +ambient_light_source = 3 +ambient_light_color = Color(0.0666667, 0.0235294, 0.129412, 1) ambient_light_energy = 8.35 +reflected_light_source = 2 tonemap_mode = 3 tonemap_exposure = 0.95 tonemap_white = 4.37 @@ -139,13 +140,18 @@ depth = 3.72 material = SubResource("StandardMaterial3D_82k5s") [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] -transform = Transform3D(-8.74228e-08, 0.845236, -1.81262, 0, 1.81262, 0.845236, 2, 3.69464e-08, -7.9232e-08, -150.131, 124.745, -6.56245e-06) +transform = Transform3D(-4.6386e-08, 1.9128, -0.584111, 5.68374e-08, 0.584111, 1.9128, 2, 2.77639e-08, -6.79067e-08, -44.6165, 124.745, -6.56245e-06) +light_angular_distance = 11.76 +shadow_enabled = true +shadow_bias = 0.665 [node name="DirectionalLight3D2" type="DirectionalLight3D" parent="DirectionalLight3D"] transform = Transform3D(-0.974707, 1.21025e-08, -0.223488, 4.34577e-09, 1, 5.54761e-08, 0.223488, 5.96046e-08, -0.974707, 53.6944, 48.8626, -146.432) +visible = false [node name="DirectionalLight3D3" type="DirectionalLight3D" parent="DirectionalLight3D"] transform = Transform3D(0.925554, -2.03326e-09, 0.378616, 2.1968e-09, 1, 6.99426e-09, -0.378616, -6.51286e-16, 0.925554, 31.1673, 0, 0) +visible = false [node name="spawnpoint" parent="." instance=ExtResource("1_cgcr3")] transform = Transform3D(2.31248, 0, 0, 0, 3.73308, 0, 0, 0, 3.56885, 0.708866, 2.06979, 7.38256) diff --git a/scripts/Networking.gd b/scripts/Networking.gd index dc838af..01c9087 100644 --- a/scripts/Networking.gd +++ b/scripts/Networking.gd @@ -247,10 +247,18 @@ func shot(client_id): target_client["HP"] -= damage if (target_client["HP"] <= 0): - target_cb3d.teleport.rpc_id(target_client_id, Vector3(0, 10, 0)) + #target_cb3d.teleport.rpc_id(target_client_id, Vector3(0, 10, 0)) + var index = abs(client["class_type"]) + var respawn = Vector3(0, 10 ,0) + if (target_client["class_type"] > 0): + respawn = spawnpoints_os.pick_random().get_class_spawnpoint(index) + elif (target_client["class_type"] < 0): + respawn = spawnpoints_cs.pick_random().get_class_spawnpoint(index) + + target_client["position"] = respawn target_client["HP"] = 100 + target_cb3d.teleport.rpc_id(target_client_id, target_client["position"]) target_cb3d.set_hp.rpc_id(target_client_id, target_client["HP"]) - @rpc("reliable", "call_remote", "any_peer") func change_weapon(client_id, new_weapon_number): var client = clients[client_id]