NodotProject / nodot

A video game node library for Godot 4
https://nodotproject.github.io/nodot/
MIT License
329 stars 11 forks source link

Main and multiplayer menus #141

Closed krazyjakee closed 1 year ago

krazyjakee commented 1 year ago

Introduces several changes related to the main and multiplayer menus.

In the InputManager.gd file, the add_action_event_key function was modified to only execute if the key value is greater than 0. This change ensures that the function is not called with an invalid key value.

In the NetworkManager.gd file, a new reset function was added to close the current connection and create a new multiplayer peer. This function is useful for resetting the multiplayer state.

In the PlayerManager.gd file, a new players variable of type UniqueSet was added to keep track of all players in the game. This variable allows for easy management of players and their settings.

In the CharacterExtension3D.gd file, several new functions (is_authority, is_authority_owner, is_host) were added to check the multiplayer authority and ownership of the character. These functions are useful for handling multiplayer-specific behavior.

In the FirstPersonCharacter.gd file, the _enter_tree function was modified to add the current player to the PlayerManager.players set and set the multiplayer authority if the NetworkManager is enabled.

In the FirstPersonIronSight.gd file, the character_camera variable was modified to correctly reference the parent's character camera.

In the FirstPersonItem.gd file, the connect_magazine function was modified to call the hitscan_node.action.rpc() method when the magazine is discharged. This change ensures that the hitscan action is properly synchronized in multiplayer.

In the FirstPersonMouseInput.gd file, the mouse_sensitivity variable was moved to the global InputManager, and the character variable was added to correctly reference the parent's character. Additionally, the _input function was modified to only process input if the character has authority ownership.

These changes enhance the main and multiplayer menus by improving multiplayer synchronization, adding player management functionality, and ensuring correct input processing.