Physics Tests
This commit is contained in:
parent
c483a438c7
commit
97ac75c936
10 changed files with 69 additions and 56 deletions
|
@ -13,7 +13,7 @@ func error(message: String, alert_message: String) -> void:
|
|||
if OS.shell_open(OS.get_user_data_dir()) != OK:
|
||||
Log.warning("Couldn't open file explorer!")
|
||||
else:
|
||||
OS.alert("An error has occured. The program will now exit.", "Error!")
|
||||
OS.alert("An error has occurred. The program will now exit.", "Error!")
|
||||
get_tree().quit()
|
||||
mutex.unlock()
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ func _ready() -> void:
|
|||
Log.error("FAILED to connect the peer_disconnected signal to _on_peer_disconnected!", "Internal Error: Failed to connect signal.")
|
||||
if playerlist_changed.connect(_on_playerlist_changed) != OK:
|
||||
Log.error("FAILED to connect the playerlist_changed signal to _on_playerlist_changed!", "Internal Error: Failed to connect signal.")
|
||||
|
||||
|
||||
func _on_playerlist_changed() -> void:
|
||||
pass
|
||||
|
@ -44,6 +43,7 @@ func join_server() -> Error:
|
|||
# Close all network connections.
|
||||
func close_network() -> void:
|
||||
multiplayer.multiplayer_peer = null
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
Log.info("Closed all network connections.")
|
||||
|
||||
## Matchmaking Code
|
||||
|
@ -151,8 +151,7 @@ func peer_disconnected_message(id: int) -> void:
|
|||
Log.warning("Couldn't emit playerlist_changed signal.")
|
||||
return
|
||||
Log.info("Peer %d successfully removed." % id)
|
||||
|
||||
|
||||
|
||||
# This is the initial server response, which tells the client what its role is.
|
||||
@rpc("authority", "call_remote", "reliable")
|
||||
func server_response(status: int, manager: int) -> void:
|
||||
|
@ -217,7 +216,7 @@ func request_playerlist(peername: String) -> void:
|
|||
Log.warning("Couldn't send failure response to peer %d!" % multiplayer.get_remote_sender_id())
|
||||
Log.warning("Peer %d tried to send this client a request meant for the room host!" % multiplayer.get_remote_sender_id())
|
||||
|
||||
# Recive the playerlist on the client.
|
||||
# Receive the playerlist on the client.
|
||||
@rpc("any_peer", "call_remote", "reliable")
|
||||
func send_playerlist(status: int, newPeers: Dictionary) -> void:
|
||||
if multiplayer.get_remote_sender_id() == managerID:
|
||||
|
@ -229,7 +228,7 @@ func send_playerlist(status: int, newPeers: Dictionary) -> void:
|
|||
Log.error("Couldn't change to the lobby scene! Closing application.", "Couldn't change to the lobby scene!")
|
||||
1:
|
||||
peers = newPeers
|
||||
Log.debug("Playerlist recived.")
|
||||
Log.debug("Playerlist received.")
|
||||
if emit_signal("playerlist_changed") != OK:
|
||||
Log.warning("Couldn't emit playerlist_changed signal.")
|
||||
2:
|
||||
|
@ -265,10 +264,11 @@ func start_game() -> void:
|
|||
|
||||
func player_sync_call(position: Vector3, rotation: Vector3) -> void:
|
||||
for peer: int in Networking.get_ids():
|
||||
if rpc_id(peer, "player_sync", position, rotation) != OK:
|
||||
Log.warning("Couldn't send RPC to %d!" % peer)
|
||||
if peer != multiplayer.get_unique_id():
|
||||
if rpc_id(peer, "player_sync", position, rotation) != OK:
|
||||
Log.warning("Couldn't send RPC to %d!" % peer)
|
||||
|
||||
# Starts the game.
|
||||
# Synchronizes the player state.
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func player_sync(position: Vector3, rotation: Vector3) -> void:
|
||||
if verify_id(multiplayer.get_remote_sender_id()):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue