diff --git a/Game/Assets/Characters/Player.gd b/Game/Assets/Characters/Player.gd index 14c6cd1..b030123 100644 --- a/Game/Assets/Characters/Player.gd +++ b/Game/Assets/Characters/Player.gd @@ -109,11 +109,11 @@ func _ready() -> void: generate_info() - rpc_config(&"move_and_slide", MultiplayerAPI.RPC_MODE_PUPPETSYNC) - rpc_config(&"aim", MultiplayerAPI.RPC_MODE_PUPPETSYNC) - rpc_config(&"set_global_transform", MultiplayerAPI.RPC_MODE_PUPPET) - rpc_config(&"set_linear_velocity", MultiplayerAPI.RPC_MODE_PUPPET) - head.rpc_config(&"set_rotation", MultiplayerAPI.RPC_MODE_PUPPETSYNC) +# rpc_config(&"move_and_slide", MultiplayerAPI.RPC_MODE_PUPPETSYNC) +# rpc_config(&"aim", MultiplayerAPI.RPC_MODE_PUPPETSYNC) +# rpc_config(&"set_global_transform", MultiplayerAPI.RPC_MODE_PUPPET) +# rpc_config(&"set_linear_velocity", MultiplayerAPI.RPC_MODE_PUPPET) +# head.rpc_config(&"set_rotation", MultiplayerAPI.RPC_MODE_PUPPETSYNC) #rpc_config(&"set_info", MultiplayerAPI.RPC_MODE_PUPPETSYNC) func aim(event) -> void: @@ -140,8 +140,9 @@ func _input(event) -> void: tween.interpolate_property(self, "view_zoom", view_zoom, 1.0, 0.25, Tween.TRANS_SINE, Tween.EASE_IN_OUT) tween.start() - rpc_unreliable(&'aim', event) -# rpc(&'aim', event) +# rpc_unreliable(&'aim', event) + aim(event) + rpc(&'aim', event) if Input.is_action_just_pressed("trigger_primary"): weapon.rpc(&'trigger', 0, true) @@ -153,10 +154,10 @@ func _input(event) -> void: weapon.rpc(&'trigger', 1, false) func _physics_process(delta): - rpc_unreliable(&'set_global_transform', global_transform) - head.rpc_unreliable(&'set_rotation', head.get_rotation()) -# rpc(&'set_global_transform', global_transform) -# head.rpc(&'set_rotation', head.get_rotation()) +# rpc_unreliable(&'set_global_transform', global_transform) +# head.rpc_unreliable(&'set_rotation', head.get_rotation()) + rpc(&'set_global_transform', global_transform) + head.rpc(&'set_rotation', head.get_rotation()) direction = Vector3.ZERO @@ -193,11 +194,11 @@ func _physics_process(delta): linear_velocity = velocity + gravity_vec #slide = move_and_slide_with_snap(movement, snap, Vector3.UP) - rpc_unreliable(&'set_linear_velocity', linear_velocity) - rpc_unreliable(&"move_and_slide") -# rpc(&'set_linear_velocity', linear_velocity) -# rpc(&"move_and_slide") - #move_and_slide() +# rpc_unreliable(&'set_linear_velocity', linear_velocity) +# rpc_unreliable(&"move_and_slide") + rpc(&'set_linear_velocity', linear_velocity) + rpc(&"move_and_slide") + move_and_slide() if not is_on_floor() and not ground_check.is_colliding(): # while in mid-air collisions affect momentum velocity.x = linear_velocity.x diff --git a/Game/Assets/Weapons/Weapon.gd b/Game/Assets/Weapons/Weapon.gd index 774d312..28c7064 100644 --- a/Game/Assets/Weapons/Weapon.gd +++ b/Game/Assets/Weapons/Weapon.gd @@ -10,7 +10,7 @@ extends Node3D print("Weapon " + str(name) + ", Trigger " + str(index) + ", active: " + str(active)) if index == 0 and active: - $Flash/Particles.emitting = true + $Flash/AnimationPlayer.play("Flash") # Called when the node enters the scene tree for the first time. func _ready(): diff --git a/Game/Assets/Weapons/Weapon.tscn b/Game/Assets/Weapons/Weapon.tscn index 0b1365e..6c0fbdf 100644 --- a/Game/Assets/Weapons/Weapon.tscn +++ b/Game/Assets/Weapons/Weapon.tscn @@ -1,55 +1,65 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://Assets/Weapons/Handgun/Handgun.gltf" type="PackedScene" id=1] [ext_resource path="res://Assets/Weapons/Weapon.gd" type="Script" id=2] -[sub_resource type="Gradient" id=1] -offsets = PackedFloat32Array( 0.00362319, 0.148551, 0.34058, 0.630435, 1 ) -colors = PackedColorArray( 0, 0, 0, 1, 0.921875, 0.903307, 0.80304, 1, 0.867188, 0.723618, 0.342133, 1, 0.382812, 0.302671, 0.0897217, 1, 0, 0, 0, 1 ) +[sub_resource type="Animation" id=1] +resource_name = "Flash" +length = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("MeshInstance3D:mesh:material:albedo_color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1), +"transitions": PackedFloat32Array(0.420448, 1), +"update": 0, +"values": [Color(4, 2, 0.3, 1), Color(0, 0, 0, 1)] +} -[sub_resource type="GradientTexture" id=2] -gradient = SubResource( 1 ) -width = 64 +[sub_resource type="Animation" id=2] +resource_name = "Off" +length = 0.001 +tracks/0/type = "value" +tracks/0/path = NodePath("MeshInstance3D:mesh:material:albedo_color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0, 0, 0, 1)] +} -[sub_resource type="Curve" id=3] -_data = [ Vector2( 0, 0 ), 0.0, 9.39008, 0, 0, Vector2( 0.0844156, 0.972727 ), 0.649118, 0.649118, 0, 0, Vector2( 1, 0 ), -0.0393939, 0.0, 0, 0 ] +[sub_resource type="Animation" id=3] +length = 0.001 +tracks/0/type = "value" +tracks/0/path = NodePath("MeshInstance3D:mesh:material:albedo_color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(4, 2, 0.3, 1)] +} -[sub_resource type="CurveTexture" id=4] -curve = SubResource( 3 ) - -[sub_resource type="ParticlesMaterial" id=5] -lifetime_randomness = 0.01 -particle_flag_rotate_y = true -direction = Vector3( -1, 0, 0 ) -spread = 0.0 -gravity = Vector3( 0, 0, 0 ) -initial_velocity = 50.0 -initial_velocity_random = 0.9 -angular_velocity = 1.0 -angular_velocity_random = 1.0 -damping = 8.0 -angle = 360.0 -angle_random = 1.0 -scale_random = 0.2 -scale_curve = SubResource( 4 ) -color_ramp = SubResource( 2 ) -anim_offset = 1.0 -anim_offset_random = 1.0 -attractor_interaction_enabled = false - -[sub_resource type="StandardMaterial3D" id=6] +[sub_resource type="StandardMaterial3D" id=4] blend_mode = 1 shading_mode = 0 -vertex_color_use_as_albedo = true -albedo_color = Color( 1, 1, 1, 0.196078 ) -billboard_mode = 3 -particles_anim_h_frames = 2 -particles_anim_v_frames = 2 -particles_anim_loop = false +albedo_color = Color(4, 2, 0.3, 1) +proximity_fade_distance = 3.94 -[sub_resource type="QuadMesh" id=7] -material = SubResource( 6 ) -size = Vector2( 0.3, 0.3 ) +[sub_resource type="SphereMesh" id=5] +material = SubResource( 4 ) +radial_segments = 16 +rings = 8 [node name="Weapon" type="Node3D"] script = ExtResource( 2 ) @@ -57,20 +67,23 @@ script = ExtResource( 2 ) [node name="Handgun" parent="." instance=ExtResource( 1 )] [node name="AnimationPlayer" parent="Handgun" index="4"] -blend_times = [ ] +blend_times = [] [node name="Flash" type="Node3D" parent="."] script = null -[node name="Particles" type="GPUParticles3D" parent="Flash"] -transform = Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.340809, 0.124171, 0 ) -emitting = false -lifetime = 0.15 -one_shot = true -explosiveness = 1.0 -fixed_fps = 60 -process_material = SubResource( 5 ) -draw_pass_1 = SubResource( 7 ) +[node name="AnimationPlayer" type="AnimationPlayer" parent="Flash"] +autoplay = "Off" +anims/Flash = SubResource( 1 ) +anims/Off = SubResource( 2 ) +anims/RESET = SubResource( 3 ) +blend_times = [] +script = null + +[node name="MeshInstance3D" type="MeshInstance3D" parent="Flash"] +transform = Transform3D(-0.299894, 0, 0, 0, -0.119659, 0, 0, 0, -0.119659, -0.620616, 0.124179, 0) +mesh = SubResource( 5 ) +surface_material_override/0 = null script = null [editable path="Handgun"] diff --git a/Game/Main.gd b/Game/Main.gd index a23523d..deb865c 100644 --- a/Game/Main.gd +++ b/Game/Main.gd @@ -45,7 +45,7 @@ func _input(_event) -> void: func create_player(id: int, is_local: bool) -> void: - var new_player = player_scene.instance() + var new_player = player_scene.instantiate() var spawnpoint = $Map/SpawnPoints.get_children()[randi() % len($Map/SpawnPoints.get_children())] new_player.name = str(id) new_player.global_transform = spawnpoint.global_transform diff --git a/Game/Main.tscn b/Game/Main.tscn index 44b17cf..a1ea22a 100644 --- a/Game/Main.tscn +++ b/Game/Main.tscn @@ -16,7 +16,7 @@ script = ExtResource( 3 ) script = null [node name="Map" parent="." instance=ExtResource( 1 )] -transform = Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1 ) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1) [node name="NetworkTesting" type="VBoxContainer" parent="."] anchor_bottom = 1.0 @@ -43,5 +43,23 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="TextEdit" type="TextEdit" parent="NetworkTesting"] +offset_top = 66.0 +offset_right = 100.0 +offset_bottom = 96.0 +rect_min_size = Vector2(100, 30) +text = "name" +structured_text_bidi_override_options = [] +script = null + +[node name="ColorPickerButton" type="ColorPickerButton" parent="NetworkTesting"] +offset_top = 100.0 +offset_right = 100.0 +offset_bottom = 129.0 +script = null +__meta__ = { +"_edit_use_anchors_": false +} + [connection signal="pressed" from="NetworkTesting/Host" to="." method="_on_Host_pressed"] [connection signal="pressed" from="NetworkTesting/Connect" to="." method="_on_Connect_pressed"]