Fix the network synchronizer demo for pandemonium.

This commit is contained in:
Relintai 2023-12-25 20:47:45 +01:00
parent d34578c442
commit 255d45d9ca
4 changed files with 16 additions and 24 deletions

View File

@ -89,7 +89,7 @@ func _on_client_disconnected(peer_id):
# --------------------------------------------------------------------------------- Remote functions # --------------------------------------------------------------------------------- Remote functions
remote func _spawn_new_player(player_id, peer_id): func _spawn_new_player(player_id, peer_id):
print("Spawn player id: ", player_id, ", Peer_id: ", peer_id) print("Spawn player id: ", player_id, ", Peer_id: ", peer_id)
print("While my peer id is: ", get_tree().multiplayer.network_peer.get_unique_id()) print("While my peer id is: ", get_tree().multiplayer.network_peer.get_unique_id())
@ -100,7 +100,13 @@ remote func _spawn_new_player(player_id, peer_id):
character.set_color(COLORS_LIST[player_id]) character.set_color(COLORS_LIST[player_id])
remote func _remove_player(player_id): func _remove_player(player_id):
var player_node = get_tree().get_current_scene().get_node("player_" + str(player_id)) var player_node = get_tree().get_current_scene().get_node("player_" + str(player_id))
if player_node != null: if player_node != null:
player_node.queue_free() player_node.queue_free()
func _ready() -> void:
rpc_config(@"_spawn_new_player", MultiplayerAPI.RPC_MODE_REMOTE)
rpc_config(@"_remove_player", MultiplayerAPI.RPC_MODE_REMOTE)

View File

@ -5,7 +5,7 @@
[sub_resource type="ProceduralSky" id=1] [sub_resource type="ProceduralSky" id=1]
[sub_resource type="Environment" id=2] [sub_resource type="Environment3D" id=2]
background_mode = 2 background_mode = 2
background_sky = SubResource( 1 ) background_sky = SubResource( 1 )
@ -27,7 +27,7 @@ radius = 0.25
[node name="Node" type="Node"] [node name="Node" type="Node"]
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="WorldEnvironment" type="WorldEnvironment" parent="."] [node name="WorldEnvironment3D" type="WorldEnvironment3D" parent="."]
environment = SubResource( 2 ) environment = SubResource( 2 )
[node name="DirectionalLight" type="DirectionalLight" parent="."] [node name="DirectionalLight" type="DirectionalLight" parent="."]

View File

@ -1,4 +1,4 @@
[gd_resource type="Environment" load_steps=2 format=2] [gd_resource type="Environment3D" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1] [sub_resource type="ProceduralSky" id=1]

View File

@ -8,16 +8,6 @@
config_version=4 config_version=4
_global_script_classes=[ {
"base": "SpringArm3D",
"class": @"PlayerCamera",
"language": @"GDScript",
"path": "res://player_camera.gd"
} ]
_global_script_class_icons={
@"PlayerCamera": ""
}
[NetworkSynchronizer] [NetworkSynchronizer]
debug_doll_speedup=true debug_doll_speedup=true
@ -53,27 +43,27 @@ singletons=[ ]
forward={ forward={
"deadzone": 0.5, "deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":87,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":87,"unicode":0,"echo":false,"action_match_force_exact":false,"script":null)
] ]
} }
backward={ backward={
"deadzone": 0.5, "deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":83,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":83,"unicode":0,"echo":false,"action_match_force_exact":false,"script":null)
] ]
} }
left={ left={
"deadzone": 0.5, "deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":65,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":65,"unicode":0,"echo":false,"action_match_force_exact":false,"script":null)
] ]
} }
right={ right={
"deadzone": 0.5, "deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":68,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":68,"unicode":0,"echo":false,"action_match_force_exact":false,"script":null)
] ]
} }
jump={ jump={
"deadzone": 0.5, "deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":32,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":32,"unicode":0,"echo":false,"action_match_force_exact":false,"script":null)
] ]
} }
@ -86,7 +76,3 @@ jump={
common/physics_jitter_fix=0.0 common/physics_jitter_fix=0.0
common/enable_pause_aware_picking=true common/enable_pause_aware_picking=true
[rendering]
environment/default_environment="res://default_env.tres"