Browse Source

Sync classref with current source

Rémi Verschelde 7 years ago
parent
commit
28d09cf550
3 changed files with 12 additions and 8 deletions
  1. 2 2
      classes/class_file.rst
  2. 4 6
      classes/class_multiplayerapi.rst
  3. 6 0
      classes/class_scenetree.rst

+ 2 - 2
classes/class_file.rst

@@ -150,13 +150,13 @@ Here's a sample on how to write and read from a file:
 
 
     func save(content):
     func save(content):
         var file = File.new()
         var file = File.new()
-        file.open("user://save_game.dat", file.WRITE)
+        file.open("user://save_game.dat", File.WRITE)
         file.store_string(content)
         file.store_string(content)
         file.close()
         file.close()
     
     
     func load():
     func load():
         var file = File.new()
         var file = File.new()
-        file.open("user://save_game.dat", file.READ)
+        file.open("user://save_game.dat", File.READ)
         var content = file.get_as_text()
         var content = file.get_as_text()
         file.close()
         file.close()
         return content
         return content

+ 4 - 6
classes/class_multiplayerapi.rst

@@ -100,10 +100,10 @@ enum **RPCMode**
 
 
 - **RPC_MODE_DISABLED** = **0** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to disable a method or property for all RPC calls, making it unavailable. Default for all methods.
 - **RPC_MODE_DISABLED** = **0** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to disable a method or property for all RPC calls, making it unavailable. Default for all methods.
 - **RPC_MODE_REMOTE** = **1** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on the remote end, not locally. Analogous to the ``remote`` keyword. Calls and property changes are accepted from all remote peers, no matter if they are node's master or slaves.
 - **RPC_MODE_REMOTE** = **1** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on the remote end, not locally. Analogous to the ``remote`` keyword. Calls and property changes are accepted from all remote peers, no matter if they are node's master or slaves.
-- **RPC_MODE_SYNC** = **2** --- Behave like constant RPC_MODE_REMOTE but also make the call or property change locally. Analogous to the ``sync`` keyword.
+- **RPC_MODE_SYNC** = **2** --- Behave like ``RPC_MODE_REMOTE`` but also make the call or property change locally. Analogous to the ``sync`` keyword.
 - **RPC_MODE_MASTER** = **3** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on the network master for this node. Analogous to the ``master`` keyword. Only accepts calls or property changes from the node's network slaves, see :ref:`Node.set_network_master<class_Node_set_network_master>`.
 - **RPC_MODE_MASTER** = **3** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on the network master for this node. Analogous to the ``master`` keyword. Only accepts calls or property changes from the node's network slaves, see :ref:`Node.set_network_master<class_Node_set_network_master>`.
 - **RPC_MODE_SLAVE** = **4** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on slaves for this node. Analogous to the ``slave`` keyword. Only accepts calls or property changes from the node's network master, see :ref:`Node.set_network_master<class_Node_set_network_master>`.
 - **RPC_MODE_SLAVE** = **4** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on slaves for this node. Analogous to the ``slave`` keyword. Only accepts calls or property changes from the node's network master, see :ref:`Node.set_network_master<class_Node_set_network_master>`.
-- **RPC_MODE_REMOTESYNC** = **5** --- Behave like ``RPC_MODE_REMOTE`` but also make the call or property change locally. Same as constant RPC_MODE_SYNC which is only kept for compatibility. Analogous to the ``remotesync`` keyword.
+- **RPC_MODE_REMOTESYNC** = **5** --- Behave like ``RPC_MODE_REMOTE`` but also make the call or property change locally. Same as ``RPC_MODE_SYNC`` which is only kept for compatibility. Analogous to the ``remotesync`` keyword.
 - **RPC_MODE_MASTERSYNC** = **6** --- Behave like ``RPC_MODE_MASTER`` but also make the call or property change locally. Analogous to the ``mastersync`` keyword.
 - **RPC_MODE_MASTERSYNC** = **6** --- Behave like ``RPC_MODE_MASTER`` but also make the call or property change locally. Analogous to the ``mastersync`` keyword.
 - **RPC_MODE_SLAVESYNC** = **7** --- Behave like ``RPC_MODE_SLAVE`` but also make the call or property change locally. Analogous to the ``slavesync`` keyword.
 - **RPC_MODE_SLAVESYNC** = **7** --- Behave like ``RPC_MODE_SLAVE`` but also make the call or property change locally. Analogous to the ``slavesync`` keyword.
 
 
@@ -162,11 +162,9 @@ Returns ``true`` if this MultiplayerAPI's :ref:`network_peer<class_MultiplayerAP
 
 
 - void **poll** **(** **)**
 - void **poll** **(** **)**
 
 
-Method used for polling the MultiplayerAPI.
+Method used for polling the MultiplayerAPI. You only need to worry about this if you are using :ref:`Node.custom_multiplayer<class_Node_custom_multiplayer>` override or you set :ref:`SceneTree.multiplayer_poll<class_SceneTree_multiplayer_poll>` to ``false``. By default :ref:`SceneTree<class_scenetree>` will poll its MultiplayerAPI for you.
 
 
-You only need to worry about this if you are using :ref:`Node.custom_multiplayer<class_Node_custom_multiplayer>` override.
-
-SceneTree will poll the default MultiplayerAPI for you.
+NOTE: This method results in RPCs and RSETs being called, so they will be executed in the same context of this function (e.g. ``_process``, ``physics``, :ref:`Thread<class_thread>`).
 
 
 .. _class_MultiplayerAPI_send_bytes:
 .. _class_MultiplayerAPI_send_bytes:
 
 

+ 6 - 0
classes/class_scenetree.rst

@@ -178,6 +178,12 @@ Member Variables
 
 
 - :ref:`MultiplayerAPI<class_multiplayerapi>` **multiplayer** - The default :ref:`MultiplayerAPI<class_multiplayerapi>` instance for this SceneTree.
 - :ref:`MultiplayerAPI<class_multiplayerapi>` **multiplayer** - The default :ref:`MultiplayerAPI<class_multiplayerapi>` instance for this SceneTree.
 
 
+  .. _class_SceneTree_multiplayer_poll:
+
+- :ref:`bool<class_bool>` **multiplayer_poll** - If ``true`` (default) enable the automatic polling of the :ref:`MultiplayerAPI<class_multiplayerapi>` for this SceneTree during :ref:`idle_frame<class_SceneTree_idle_frame>`.
+
+When ``false`` you need to manually call :ref:`MultiplayerAPI.poll<class_MultiplayerAPI_poll>` for processing network packets and delivering RPCs/RSETs. This allows to run RPCs/RSETs in a different loop (e.g. physics, thread, specific time step) and for manual :ref:`Mutex<class_mutex>` protecion when accessing the :ref:`MultiplayerAPI<class_multiplayerapi>` from threads.
+
   .. _class_SceneTree_network_peer:
   .. _class_SceneTree_network_peer:
 
 
 - :ref:`NetworkedMultiplayerPeer<class_networkedmultiplayerpeer>` **network_peer** - The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the SceneTree will become a network server (check with :ref:`is_network_server()<class_SceneTree_is_network_server()>`) and will set root node's network mode to master (see NETWORK_MODE\_\* constants in :ref:`Node<class_node>`), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals.
 - :ref:`NetworkedMultiplayerPeer<class_networkedmultiplayerpeer>` **network_peer** - The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the SceneTree will become a network server (check with :ref:`is_network_server()<class_SceneTree_is_network_server()>`) and will set root node's network mode to master (see NETWORK_MODE\_\* constants in :ref:`Node<class_node>`), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals.