Move the real player authority to server
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Add rust bindings for the server player controller - Implement reconciliation loop for checking the player state - Place spawners on the test map - Add Containerfile and helm chart
This commit is contained in:
@ -15,8 +15,6 @@ func _process(delta: float) -> void:
|
||||
|
||||
|
||||
func _on_head_collision_body_part_hit(dam: Variant) -> void:
|
||||
#print("head is hit" + str(dam))
|
||||
#print(owner_placeholder)
|
||||
#if owner_placeholder.has_method("take_damage"):
|
||||
if owner_placeholder:
|
||||
owner_placeholder.take_damage(dam)
|
||||
|
@ -1419,12 +1419,12 @@ shape = SubResource("SphereShape3D_axep3")
|
||||
[node name="PhysicalBoneSimulator3D" type="PhysicalBoneSimulator3D" parent="Body/Armature/Skeleton3D"]
|
||||
|
||||
[node name="Physical Bone mixamorig_Hips" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(82.5044, -54.0559, -16.4615, 55.0482, 83.4649, 1.8195, 12.756, -10.5629, 98.619, 1.31498, 0.290624, -87.4646)
|
||||
transform = Transform3D(82.5044, -54.0559, -16.4615, 55.0482, 83.4649, 1.8195, 12.756, -10.5629, 98.619, 1.31498, 0.290625, -87.4646)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.35312e-08, -5.58794e-09, 0.0499956)
|
||||
body_offset = Transform3D(100, -0.0695305, -0.00860751, -1.19209e-05, 12.2744, -99.2438, 0.0700493, 99.2438, 12.2744, 0.00043869, 4.96175, -0.613665)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.11306e-07, -5.58794e-09, 0.0499956)
|
||||
body_offset = Transform3D(100, -0.0695305, -0.00860918, -1.4782e-05, 12.2744, -99.2438, 0.0700493, 99.2438, 12.2744, 0.000441551, 4.96175, -0.613665)
|
||||
mass = 20.0
|
||||
bone_name = "mixamorig_Hips"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1436,12 +1436,12 @@ transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-1
|
||||
shape = SubResource("CapsuleShape3D_0ptuo")
|
||||
|
||||
[node name="Physical Bone mixamorig_Spine" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(80.9412, -58.546, -4.56913, 57.6046, 80.6695, -13.1964, 11.4119, 8.0493, 99.0201, 2.40599, 0.973749, -98.2036)
|
||||
transform = Transform3D(80.9412, -58.546, -4.56913, 57.6046, 80.6695, -13.1964, 11.4119, 8.04929, 99.0201, 2.40599, 0.973749, -98.2036)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.2222e-09, 2.2377e-09, 0.05866)
|
||||
body_offset = Transform3D(100, 7.62939e-06, 9.05991e-06, 4.76837e-06, -1.90735e-06, -100, -1.52588e-05, 100, -3.8147e-06, -9.53674e-07, 5.866, 0)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.10332e-09, 5.59426e-10, 0.05866)
|
||||
body_offset = Transform3D(100, 7.62939e-06, 1.09673e-05, 4.76837e-06, 0, -100, -1.52588e-05, 100, -9.53674e-07, -9.53674e-07, 5.866, 0)
|
||||
mass = 20.0
|
||||
bone_name = "mixamorig_Spine"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1457,8 +1457,8 @@ transform = Transform3D(-97.8019, 4.47329, 20.366, -15.8369, -79.4709, -58.5966,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.90306e-08, -1.39698e-07, 0.0981531)
|
||||
body_offset = Transform3D(-100, -0.00220013, -0.000778198, -5.24521e-06, 33.8066, -94.1122, 0.00232792, -94.1122, -33.8066, 7.24792e-05, 9.23741, 3.31821)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.71765e-08, -1.39698e-07, 0.0981531)
|
||||
body_offset = Transform3D(-100, -0.00220013, -0.000778198, -5.24521e-06, 33.8066, -94.1122, 0.00232792, -94.1122, -33.8066, 6.86646e-05, 9.23741, 3.31821)
|
||||
mass = 7.0
|
||||
bone_name = "mixamorig_Head"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1470,12 +1470,12 @@ transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-1
|
||||
shape = SubResource("CapsuleShape3D_1gw5y")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(86.1165, 14.0252, -48.8594, -45.4995, 64.1262, -61.787, 22.6659, 75.4396, 61.6046, 16.1942, 31.0309, -132.592)
|
||||
transform = Transform3D(86.1165, 14.0252, -48.8594, -45.4995, 64.1262, -61.787, 22.6659, 75.4395, 61.6046, 16.1942, 31.0309, -132.592)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.65892e-08, 2.39336e-07, 0.137023)
|
||||
body_offset = Transform3D(100, -3.05176e-05, -2.67029e-05, 2.09808e-05, 100, -7.62939e-06, 1.71661e-05, -3.8147e-06, 100, 0, -2.28882e-05, -13.7023)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.17137e-09, 2.34109e-07, 0.137023)
|
||||
body_offset = Transform3D(100, -4.19617e-05, -2.47955e-05, 2.86102e-05, 100, -3.8147e-06, 1.71661e-05, -3.8147e-06, 100, 3.8147e-06, -2.28882e-05, -13.7023)
|
||||
mass = 3.0
|
||||
bone_name = "mixamorig_LeftArm"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1487,12 +1487,12 @@ transform = Transform3D(0.01, 0, 0, 0, 0.00997432, -0.000716193, 0, 0.000716193,
|
||||
shape = SubResource("CapsuleShape3D_krlof")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftForeArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-48.2566, -12.058, 86.752, -78.7312, -37.4258, -48.997, 38.3757, -91.9452, 8.56699, 1.36485, 46.9033, -104.66)
|
||||
transform = Transform3D(-48.2566, -12.058, 86.752, -78.7312, -37.4258, -48.997, 38.3757, -91.9452, 8.56699, 1.36484, 46.9033, -104.66)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.47239e-07, 6.31263e-08, 0.138072)
|
||||
body_offset = Transform3D(100, 3.05176e-05, -4.19617e-05, -3.8147e-05, 0, -100, -3.8147e-06, 100, 9.53674e-06, 3.05176e-05, 13.8072, -7.62939e-06)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.99827e-07, 6.04928e-08, 0.138072)
|
||||
body_offset = Transform3D(100, 3.05176e-05, -4.19617e-05, -3.8147e-05, 0, -100, -3.8147e-06, 100, 1.14441e-05, 4.57764e-05, 13.8072, -7.62939e-06)
|
||||
mass = 3.0
|
||||
bone_name = "mixamorig_LeftForeArm"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1541,8 +1541,8 @@ transform = Transform3D(24.3552, 37.4063, 89.4852, -25.0101, 91.5653, -31.4688,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.40737e-07, -2.80688e-08, 0.138072)
|
||||
body_offset = Transform3D(100, -1.14441e-05, 8.58307e-06, -3.8147e-06, 100, 9.53674e-06, 5.72205e-06, -5.72205e-06, 100, -1.52588e-05, 1.49012e-06, -13.8072)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.40737e-07, -5.19106e-08, 0.138072)
|
||||
body_offset = Transform3D(100, -1.14441e-05, 8.58307e-06, -3.8147e-06, 100, 9.53674e-06, 5.72205e-06, -5.72205e-06, 100, -1.52588e-05, 3.8743e-06, -13.8072)
|
||||
mass = 3.0
|
||||
bone_name = "mixamorig_RightForeArm"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1558,8 +1558,8 @@ transform = Transform3D(89.0767, -24.8074, -38.0781, 5.05123, 88.6726, -45.9527,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.86265e-08, 2.31434e-07, 0.0264903)
|
||||
body_offset = Transform3D(-58.5197, -57.9893, -56.6805, -1.19209e-05, 69.8991, -71.5131, 81.0891, -41.8492, -40.9048, 1.5015, 1.89439, 1.08359)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.86265e-08, 2.30502e-07, 0.0264903)
|
||||
body_offset = Transform3D(-58.5197, -57.9893, -56.6805, -1.33514e-05, 69.8991, -71.5131, 81.0891, -41.8492, -40.9048, 1.5015, 1.89439, 1.08359)
|
||||
bone_name = "mixamorig_RightHand"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
@ -1575,7 +1575,7 @@ collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.78612e-08, -7.74374e-09, 0.202997)
|
||||
body_offset = Transform3D(100, -2.86102e-05, 9.53674e-06, 7.62939e-06, 7.62939e-06, -100, 3.71933e-05, 100, 3.8147e-06, -5.72205e-06, 20.2997, 0)
|
||||
body_offset = Transform3D(100, -4.3869e-05, 9.53674e-06, 9.53674e-06, 7.62939e-06, -100, 4.673e-05, 100, 3.8147e-06, -5.72205e-06, 20.2997, 0)
|
||||
mass = 5.0
|
||||
bone_name = "mixamorig_LeftUpLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1604,12 +1604,12 @@ transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-1
|
||||
shape = SubResource("CapsuleShape3D_vwdij")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftFoot" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-93.6712, -34.5296, 5.78095, -34.9451, 91.207, -21.4506, 2.13418, -22.1132, -97.501, 11.7385, 3.12728, -14.5678)
|
||||
transform = Transform3D(-93.6712, -34.5296, 5.78095, -34.9451, 91.207, -21.4506, 2.13419, -22.1132, -97.501, 11.7385, 3.12728, -14.5678)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.66258e-09, 5.6483e-08, 0.078608)
|
||||
body_offset = Transform3D(100, 5.72205e-06, -2.38419e-06, -2.86102e-06, -1.52588e-05, -100, -5.72205e-06, 100, -3.24249e-05, 9.53674e-07, 7.8608, -3.09944e-06)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.41225e-09, 7.07881e-08, 0.078608)
|
||||
body_offset = Transform3D(100, 5.72205e-06, -1.43051e-06, -9.53674e-07, -1.52588e-05, -100, -5.72205e-06, 100, -3.24249e-05, 9.53674e-07, 7.8608, -4.52995e-06)
|
||||
bone_name = "mixamorig_LeftFoot"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
@ -1641,8 +1641,8 @@ transform = Transform3D(-91.8175, -23.5086, -31.8888, -36.0103, 83.0805, 42.437,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.27453e-09, -2.4944e-07, 0.210495)
|
||||
body_offset = Transform3D(100, -1.71661e-05, 1.33514e-05, -9.53674e-07, 4.19617e-05, -100, 1.90735e-05, 100, 6.86646e-05, -3.33786e-06, 21.0495, 1.04904e-05)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.48112e-08, -2.68514e-07, 0.210495)
|
||||
body_offset = Transform3D(100, -1.71661e-05, 1.33514e-05, -9.53674e-07, 4.19617e-05, -100, 1.90735e-05, 100, 6.86646e-05, -4.29153e-06, 21.0495, 1.23978e-05)
|
||||
mass = 5.0
|
||||
bone_name = "mixamorig_RightLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
|
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://b10lpwfjgxds4"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://b10lpwfjgxds4"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/player/player_input_controller.gd" id="1_q75ai"]
|
||||
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="2_lsd7c"]
|
||||
[ext_resource type="Script" path="res://scenes/characters/player_input_controller.gd" id="3_n3epd"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jc50w"]
|
||||
margin = 0.5
|
||||
@ -10,14 +11,20 @@ height = 1.6
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_tl74a"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = false
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 1
|
||||
properties/1/path = NodePath(".:rotation")
|
||||
properties/1/spawn = false
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 1
|
||||
properties/2/path = NodePath(".:health")
|
||||
properties/2/spawn = false
|
||||
properties/2/spawn = true
|
||||
properties/2/replication_mode = 2
|
||||
properties/3/path = NodePath(".:velocity")
|
||||
properties/3/spawn = true
|
||||
properties/3/replication_mode = 1
|
||||
properties/4/path = NodePath(".:owner_id")
|
||||
properties/4/spawn = true
|
||||
properties/4/replication_mode = 1
|
||||
|
||||
[sub_resource type="Animation" id="Animation_falg4"]
|
||||
length = 0.001
|
||||
@ -83,11 +90,23 @@ font_size = 70
|
||||
font_size = 100
|
||||
font_color = Color(0.756874, 0, 0.223924, 1)
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_eour5"]
|
||||
properties/0/path = NodePath(".:input_direction")
|
||||
properties/0/spawn = false
|
||||
properties/0/replication_mode = 2
|
||||
properties/1/path = NodePath(".:jumping")
|
||||
properties/1/spawn = false
|
||||
properties/1/replication_mode = 2
|
||||
|
||||
[node name="CharacterPlaceholder" type="CharacterBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.799455, 0)
|
||||
collision_layer = 9
|
||||
collision_mask = 9
|
||||
script = ExtResource("1_q75ai")
|
||||
health = null
|
||||
owner_id = null
|
||||
jump_height = null
|
||||
camera_sens = null
|
||||
|
||||
[node name="Collision" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0150437, 0)
|
||||
@ -118,6 +137,7 @@ libraries = {
|
||||
}
|
||||
|
||||
[node name="HUD" type="Control" parent="FirstPersonCameraMount"]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@ -163,3 +183,8 @@ label_settings = SubResource("LabelSettings_1j1uq")
|
||||
|
||||
[node name="ModelMount" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.790262, 0)
|
||||
|
||||
[node name="PlayerInput" type="MultiplayerSynchronizer" parent="."]
|
||||
root_path = NodePath(".")
|
||||
replication_config = SubResource("SceneReplicationConfig_eour5")
|
||||
script = ExtResource("3_n3epd")
|
||||
|
35
scenes/characters/player_input_controller.gd
Normal file
35
scenes/characters/player_input_controller.gd
Normal file
@ -0,0 +1,35 @@
|
||||
extends MultiplayerSynchronizer
|
||||
|
||||
@export var jumping := false
|
||||
@export var input_direction := Vector2()
|
||||
|
||||
@onready var camera_mount = $"../FirstPersonCameraMount"
|
||||
@onready var placeholder = $".."
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
#set_process(get_multiplayer_authority() == multiplayer.get_unique_id())
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
input_direction = Input.get_vector("move_left", "move_right", "move_forward", "move_backwards")
|
||||
set_input_direction.rpc(input_direction)
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
jump.rpc_id(1)
|
||||
|
||||
var camera_sens: float = 0.002
|
||||
func _input(event):
|
||||
if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
placeholder.rotate_y(-event.relative.x * camera_sens)
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func set_input_direction(direction: Vector2):
|
||||
input_direction = direction
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func jump():
|
||||
jumping = true
|
Reference in New Issue
Block a user